@@ -8,23 +8,32 @@ import {
88 BlockquoteSpecs ,
99 italicMarkName ,
1010 ItalicSpecs ,
11+ ImageSpecs ,
12+ imageNodeName ,
13+ ImageAttr ,
1114} from '../../markdown/specs' ;
1215import { CutNode , YfmCutSpecs } from './YfmCutSpecs' ;
1316
1417const { schema, parser, serializer} = new ExtensionsManager ( {
1518 extensions : ( builder ) =>
16- builder . use ( BaseSpecsPreset , { } ) . use ( ItalicSpecs ) . use ( BlockquoteSpecs ) . use ( YfmCutSpecs , { } ) ,
19+ builder
20+ . use ( BaseSpecsPreset , { } )
21+ . use ( ItalicSpecs )
22+ . use ( BlockquoteSpecs )
23+ . use ( YfmCutSpecs , { } )
24+ . use ( ImageSpecs ) ,
1725} ) . buildDeps ( ) ;
1826
19- const { doc, p, i, bq, cut, cutTitle, cutContent} = builders ( schema , {
27+ const { doc, p, i, bq, img , cut, cutTitle, cutContent} = builders ( schema , {
2028 doc : { nodeType : BaseNode . Doc } ,
2129 p : { nodeType : BaseNode . Paragraph } ,
2230 i : { markType : italicMarkName } ,
2331 bq : { nodeType : blockquoteNodeName } ,
32+ img : { nodeType : imageNodeName } ,
2433 cut : { nodeType : CutNode . Cut } ,
2534 cutTitle : { nodeType : CutNode . CutTitle } ,
2635 cutContent : { nodeType : CutNode . CutContent } ,
27- } ) as PMTestBuilderResult < 'doc' | 'p' | 'bq' | 'cut' | 'cutTitle' | 'cutContent' , 'i' > ;
36+ } ) as PMTestBuilderResult < 'doc' | 'p' | 'bq' | 'img' | ' cut' | 'cutTitle' | 'cutContent' , 'i' > ;
2837
2938const { same} = createMarkupChecker ( { parser, serializer} ) ;
3039
@@ -94,6 +103,31 @@ cut content
94103 same ( markup , doc ( cut ( cutTitle ( i ( 'cut italic title' ) ) , cutContent ( p ( 'cut content' ) ) ) ) ) ;
95104 } ) ;
96105
106+ it ( 'should parse yfm-cut with inline node in cut title' , ( ) => {
107+ const markup = `
108+ {% cut "" %}
109+
110+ cut content
111+
112+ {% endcut %}
113+ ` . trim ( ) ;
114+
115+ same (
116+ markup ,
117+ doc (
118+ cut (
119+ cutTitle (
120+ img ( {
121+ [ ImageAttr . Src ] : 'path/to/img' ,
122+ [ ImageAttr . Alt ] : 'img' ,
123+ } ) ,
124+ ) ,
125+ cutContent ( p ( 'cut content' ) ) ,
126+ ) ,
127+ ) ,
128+ ) ;
129+ } ) ;
130+
97131 it ( 'should parse yfm-note from html' , ( ) => {
98132 parseDOM (
99133 schema ,
0 commit comments