I'm trying to parse a string which contains some Markdown code (like bold or italic), and I want it to be parsed and shown as HTML code.
I created a pipe which detects some Markdown tags (bold and italic only at the moment), so it car convert it into html tags like this:
<span>{{ line | markdown }}</span>
Imagine the following string this is *italic* and this is **bold**.
The parsing is working, so it returns this line:
this is <em>italic</em> and this is <strong>bold</strong>.
The problem is the page doesn't interpret the String as html code, but a plain text.
So I tried to ad [innerHTML] tag like this:
<span [innerHTML]=line>{{ line | markdown }}</span>
Now, the page shows this :
this is *italic* and this is bold
Why does it parse the bold but ignores italic, and how can I get what I want?
it should be <span [innerHtml]="line | markdown"></span>. it this case output of a pipe will be passed as innerHtml to a span
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With