File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -19,12 +19,21 @@ export default function remarkNotes(options: RemarkNotesOptions = {}) {
1919
2020 return ( tree : Node ) => {
2121 // Inject styles at the beginning of the document (only once) if enabled
22+ // Using proper mdast node instead of HTML string for MDX compatibility
2223 if ( injectStyles && ! hasInjectedStyles ) {
2324 const root = tree as Parent
2425 if ( root . children ) {
26+ // Create a proper mdast node that will be transformed to <style> tag
2527 root . children . unshift ( {
26- type : 'html' ,
27- value : `<style>${ styles } </style>`
28+ type : 'paragraph' ,
29+ data : {
30+ hName : 'style' ,
31+ hProperties : { }
32+ } ,
33+ children : [ {
34+ type : 'text' ,
35+ value : styles
36+ } ]
2837 } as any )
2938 hasInjectedStyles = true
3039 }
You can’t perform that action at this time.
0 commit comments