Best way to not have html in the exported markdown? #692
-
Our hugo build process strips html from the markdown files in order to prevent potentially malicious stuff. Right now I just manually delete html that lands in my exports, but I am sure someone has a little snippet that I could save a bunch of time with. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
It's not possible to export HTML-free Markdown.
To truly protect your site from malicious attacks, look into CSP (content security protection) headers. I have this setting in the hugo config for all my sites for many years (and I have CSP enabled): https://ox-hugo.scripter.co/doc/goldmark/#enable-unsafe-html . That will prevent Hugo from stripping away the HTML. |
Beta Was this translation helpful? Give feedback.
-
If you just want to remove all the HTML, Hugo already does that by default.. which is this:
.. but proceed with that at your own risk; you will find a lot of features added by |
Beta Was this translation helpful? Give feedback.
ox-hugo
relies on having HTML in the exported Markdown to match a lot of features that Org Mode has.It's not possible to export HTML-free Markdown.
To truly protect your site from malicious attacks, look into CSP (content security protection) headers.
I have this setting in the hugo config for all my sites for many years (and I have CSP enabled): https://ox-hugo.scripter.co/doc/goldmark/#enable-unsafe-html . That will prevent Hugo from stripping away the HTML.