Search code examples
parsingmarkdownconverters

How to preserve web components tags when converting markdown to html


I'd like to convert markdown files to htmls (currently I am using marked.js but open to any similar tools). My markdown files have web components but the parser does not replace web components tags (like <web-table>) and converts < to &lt;. I know one way is to just replace those changes:

html.replaceAll("&lt;", "<").replaceAll("&quot;", '"')

Is there a better way? How can I extend the markdown parser tags recognition to include custom tags like <web-components>?

I am using marked.js but open to other similar markdown to html parsers as long as they provide an option to preserve web-components (custom tags).


Solution

  • Both pandoc and markdown-it parse HTMl tags with dashes (common in web components) correctly.