Custom HTML elements and Markdown parsing

284 Views Asked by At

I have defined a number of custom HTML elements <my-element1>, <my-element2> (in JavaScript via extends HTMLElement) ... and inside these elements, I am writing Markdown that needs to be parsed:

<!-- no parsing inside this element -->
<my-element1>
This is *markdown* with a bit of `code`.
</my-element1>

However, the markdown is not being parsed.

The standard solution seems to be to set the attribute markdown="1" inside an HTML element to inform the kramdown parser that whatever is inside the element should be parsed. And this works if I am using a standard HTML element:

<!-- parsing goes ok -->
<div markdown="1">
This is *markdown* with a bit of `code`.
</div>

However, setting this attribute in a custom HTML element has no effect. The ugly workaround is to always add <div> (or other standard) tags inside my custom elements. But of course, that is not ideal. Does anyone know a better solution to this problem? Is there a setting inside Jekyll that can inform kramdown of which additional HTML elements have been defined?

0

There are 0 best solutions below