Strip GFM disallowed tags during index.ipynb to conversion

I created an nbdev repo with a fairly fully-featured index.ipynb. The resulting github is quite complex and nbdev/quarto does a great job!

Unfortunately, at some point, the output GFM started containing raw HTML <style> tags (may be related to introduction of tables). Since GFM does not allow this, I was winding up with those elements being visible as text on the GH readme.

This seems like a problem that would affect many people, so I did a search for a solution. I couldn’t find one. So I created a quarto extension, GitHub - restlessronin/gfm-strip-disallowed: A quarto extension to strip raw HTML blocks (such as '<style>') that are disallowed by GFM., that will filter out those tags from the GFM output.

Hopefully this extension will help others who may be in the same boat. Suggestions for improvement are welcome.


That’s clever! With the suggested config you show there, it looks like it will only run for the README, since you specify gfm format – is that right?

Yup. The HTML conversions are unaffected.

1 Like