angular-markdown-directive not displaying content as HTML

1.2k Views Asked by At

I'm trying to get angular-markdown-directive working in my Angular app but I've had no success yet.

I've followed all the instructions (included sanitize, showdown and markdown etc) and added:

<btf-markdown>
  #Markdown directive
  *It works!*
</btf-markdown>

into my page but the markdown renders as it is, not as HTML.

I've included the scripts too;

<script src='/bower_components/showdown/src/showdown.js'></script>
<script src='/bower_components/angular-markdown-directive/markdown.js'></script>

and the module btford.markdown

There are no errors in my console either so I'm really unsure what the issue could be - I'm hoping someone else has some advice on this matter.

My version of markdown is 0.3.1

3

There are 3 best solutions below

0
On

Most of the time <btf-markdown> directive is not working as expected. I face the same issue while using this and finally move on and create my own directive for it.

Here is plunker

it working fine for me and hope also for you.

Don't forgot to add showdown lib

ShowDown lib

0
On

You might want to have a look at the official angular-showdown integration lib.

The angular-markdown-directive lib uses an outdated version of showdown which might explain why it's not working for you.

0
On

I recently used angular-marked in my angular app and it works very well. had a little bit of trouble with adding "target='_blank'" attribute to my links in the marked down text. turns out they have a very convenient config for that. hope it comes handy for you