Ignore specified HTML blocks in markdown-it?

594 Views Asked by At

I have following markdown:

> Acronis True Image does not allow to clone a single partition; only cloning of an entire disk is possible
> [Acronis True Image: how to clone a disk | Knowledge Base](https://kb.acronis.com/content/56634)

But you can use <a href="https://px.a8.net/svt/ejp?a8mat=3H7MDC+20NGN6+49QG+5YJRM" rel="nofollow">this</a><img border="0" width="1" height="1" src="https://www11.a8.net/0.gif?a8mat=3H7MDC+20NGN6+49QG+5YJRM" alt="">. 

markdown-it renders the one to like this:

<blockquote>
<p>Acronis True Image does not allow to clone a single partition; only cloning of an entire disk is possible    
<a href="https://kb.acronis.com/content/56634">Acronis True Image: how to clone a disk | Knowledge Base</a></p> 
</blockquote>
<p>But you can use &lt;a href=&quot;https://px.a8.net/svt/ejp?a8mat=3H7MDC+20NGN6+49QG+5YJRM&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt;&lt;img border=&quot;0&quot; width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://www11.a8.net/0.gif?a8mat=3H7MDC+20NGN6+49QG+5YJRM&quot; alt=&quot;&quot;&gt;.</p>

But actually I want to render the one to something like this:

<blockquote>
<p>Acronis True Image does not allow to clone a single partition; only cloning of an entire disk is possible    
<a href="https://kb.acronis.com/content/56634">Acronis True Image: how to clone a disk | Knowledge Base</a></p> 
</blockquote>
<p>But you can use <a href="https://px.a8.net/svt/ejp?a8mat=3H7MDC+20NGN6+49QG+5YJRM" rel="nofollow">this</a><img border="0" width="1" height="1" src="https://www11.a8.net/0.gif?a8mat=3H7MDC+20NGN6+49QG+5YJRM" alt="">.</p>

How can I do this?

1

There are 1 best solutions below

1
On

You need to enable the html option:

var md = require('markdown-it')({
  html: true,
});

As documented, html is disabled by default, which explains why it is being escaped.

options:

  • html - false. Set true to enable HTML tags in source. Be careful! That's not safe! You may need external sanitizer to protect output from XSS. It's better to extend features via plugins, instead of enabling HTML.