88 BlockquoteSpecs ,
99 italicMarkName ,
1010 blockquoteNodeName ,
11+ ImageSpecs ,
12+ imageNodeName ,
13+ ImageAttr ,
1114} from '../../markdown/specs' ;
1215import { YfmNoteSpecs } from './YfmNoteSpecs' ;
1316import { NoteAttrs , NoteNode } from './const' ;
@@ -18,21 +21,23 @@ const {schema, parser, serializer} = new ExtensionsManager({
1821 . use ( BaseSpecsPreset , { } )
1922 . use ( ItalicSpecs )
2023 . use ( BlockquoteSpecs )
21- . use ( YfmNoteSpecs , { } ) ,
24+ . use ( YfmNoteSpecs , { } )
25+ . use ( ImageSpecs ) ,
2226} ) . buildDeps ( ) ;
2327
24- const { doc, p, i, bq, note, noteTitle} = builders ( schema , {
28+ const { doc, p, i, bq, img , note, noteTitle} = builders ( schema , {
2529 doc : { nodeType : BaseNode . Doc } ,
2630 p : { nodeType : BaseNode . Paragraph } ,
2731 i : { markType : italicMarkName } ,
2832 bq : { nodeType : blockquoteNodeName } ,
33+ img : { nodeType : imageNodeName } ,
2934 note : {
3035 nodeType : NoteNode . Note ,
3136 [ NoteAttrs . Type ] : 'info' ,
3237 [ NoteAttrs . Class ] : 'yfm-note yfm-accent-info' ,
3338 } ,
3439 noteTitle : { nodeType : NoteNode . NoteTitle } ,
35- } ) as PMTestBuilderResult < 'doc' | 'p' | 'bq' | 'note' | 'noteTitle' , 'i' > ;
40+ } ) as PMTestBuilderResult < 'doc' | 'p' | 'bq' | 'img' | ' note' | 'noteTitle' , 'i' > ;
3641
3742const { same} = createMarkupChecker ( { parser, serializer} ) ;
3843
@@ -91,10 +96,34 @@ note content
9196{% endnote %}
9297 ` . trim ( ) ;
9398
94- // eslint-disable-next-line prettier/prettier
9599 same ( markup , doc ( note ( noteTitle ( i ( 'note italic title' ) ) , p ( 'note content' ) ) ) ) ;
96100 } ) ;
97101
102+ it ( 'should parse yfm-note with inline node in note title' , ( ) => {
103+ const markup = `
104+ {% note info "" %}
105+
106+ note content
107+
108+ {% endnote %}
109+ ` . trim ( ) ;
110+
111+ same (
112+ markup ,
113+ doc (
114+ note (
115+ noteTitle (
116+ img ( {
117+ [ ImageAttr . Src ] : 'path/to/img' ,
118+ [ ImageAttr . Alt ] : 'img' ,
119+ } ) ,
120+ ) ,
121+ p ( 'note content' ) ,
122+ ) ,
123+ ) ,
124+ ) ;
125+ } ) ;
126+
98127 // TODO: parsed: doc(paragraph("YfmNote title"), paragraph("YfmNote content"))
99128 it . skip ( 'should parse yfm-note from html' , ( ) => {
100129 parseDOM (
0 commit comments