11import { visit } from 'unist-util-visit'
22import type { Node , Parent } from 'unist'
33import type { Blockquote , Paragraph , Text } from 'mdast'
4- import { NOTE_TYPES } from './lib/types/index.js'
54import { styles } from './lib/styles.js'
65import { createNoteStructure } from './lib/node-structure.js'
6+ import { VALID_NOTE_TYPES , ValidNoteType } from './lib/icons-hast.js'
77
88export default function remarkNotes ( ) {
99 let hasInjectedStyles = false
@@ -37,10 +37,10 @@ export default function remarkNotes() {
3737 const match = textNode . value . match ( / ^ \[ ! ( \w + ) \] / )
3838 if ( ! match ) return
3939
40- const noteType = match [ 1 ] . toLowerCase ( )
40+ const noteType = match [ 1 ] . toLowerCase ( ) as ValidNoteType
4141
4242 // Only transform if it's a recognized note type
43- if ( ! ( noteType in NOTE_TYPES ) ) return
43+ if ( ! VALID_NOTE_TYPES . includes ( noteType ) ) return
4444
4545 // Clone children to preserve original markdown structure
4646 const children = [ ...node . children ]
@@ -61,12 +61,8 @@ export default function remarkNotes() {
6161 }
6262 }
6363
64- // Get the icon for this note type
65- const noteConfig = NOTE_TYPES [ noteType ] ;
66- const iconSvg = noteConfig . icon ;
67-
68- // Create the note structure using proper mdast nodes
69- const noteContainer = createNoteStructure ( noteType , iconSvg , children ) ;
64+ // Create the note structure using proper mdast nodes (with hast-converted SVG icons)
65+ const noteContainer = createNoteStructure ( noteType , children ) ;
7066
7167 // Replace the blockquote with the container
7268 ( parent as Parent ) . children [ index ] = noteContainer ;
0 commit comments