You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some platforms like Github allows raw HTML tags to be used in Markdown. This can be useful if creators want to include raw HTML from trusted sources, or want to introduce extra layout and semantic flexibilities that would be hard to implement with only Markdown tags / require extra post-processing.
Current Situation
ContentLayer's Markdown processing middleware currently does not provide this possibility.
For this to work in ContentLayer, remark-rehype requires an additional option of { allowDangerousHtml: true } , which allows the processor to pass the nodes as-is, so that it can be parsed again either by rehype-raw or rehype-stringify.
Proposal
To allow for this to happen, we can allow options specified in contentlayer.config.js (maybe something like remarkRehypeOptions for remark-rehype, as an example) to be passed into the respective default processors. Since this is optional, users will have to be aware of its security implications (if any) and enable them consciously.
The text was updated successfully, but these errors were encountered:
Thanks a lot for opening this issue. This case will be addressed by the upcoming 0.2.5 release which will support the following pattern:
importrehypeStringifyfrom'rehype-stringify'importremarkFrontmatterfrom'remark-frontmatter'importremarkParsefrom'remark-parse'importremark2rehypefrom'remark-rehype'makeSource({// your other options ...markdown: (builder)=>{builder.use(remarkFrontmatter).use(remarkParse).use(remark2rehype,{allowDangerousHtml: true}).use(rehypeStringify)}})
From here: contentlayerdev/website#43
Context
Some platforms like Github allows raw HTML tags to be used in Markdown. This can be useful if creators want to include raw HTML from trusted sources, or want to introduce extra layout and semantic flexibilities that would be hard to implement with only Markdown tags / require extra post-processing.
Current Situation
ContentLayer's Markdown processing middleware currently does not provide this possibility.
For this to work in ContentLayer,
remark-rehype
requires an additional option of{ allowDangerousHtml: true }
, which allows the processor to pass the nodes as-is, so that it can be parsed again either byrehype-raw
orrehype-stringify
.Proposal
To allow for this to happen, we can allow options specified in
contentlayer.config.js
(maybe something likeremarkRehypeOptions
forremark-rehype
, as an example) to be passed into the respective default processors. Since this is optional, users will have to be aware of its security implications (if any) and enable them consciously.The text was updated successfully, but these errors were encountered: