File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed
Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -186,13 +186,18 @@ export class MarkdownParser implements Parser {
186186
187187 if ( tokenSpec . noCloseToken ) {
188188 this . openNode ( schemaSpec , attrs ) ;
189- let { content} = yfmToken ;
190- if ( tokenSpec . prepareContent ) {
191- content = tokenSpec . prepareContent ( content ) ;
189+
190+ if ( tokenSpec . contentField === 'children' && yfmToken . children ?. length ) {
191+ this . parseTokens ( yfmToken . children ) ;
192+ } else {
193+ let { content} = yfmToken ;
194+ if ( tokenSpec . prepareContent ) {
195+ content = tokenSpec . prepareContent ( content ) ;
196+ }
197+ this . addText ( content ) ;
192198 }
193- this . addText ( content ) ;
194- this . closeNode ( ) ;
195199
200+ this . closeNode ( ) ;
196201 return ;
197202 }
198203
Original file line number Diff line number Diff line change @@ -23,4 +23,9 @@ export interface ParserToken {
2323 code ?: boolean ;
2424 /** only for tokens with type=block */
2525 prepareContent ?: ( content : string ) => string ;
26+ /**
27+ * only for tokens with type=block and noCloseToken=true
28+ * @default 'content'
29+ */
30+ contentField ?: 'content' | 'children' ;
2631}
You can’t perform that action at this time.
0 commit comments