File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,19 @@ Id:: inside
7878 expect ( result . get ( "Id" ) ) . toEqual ( new Set ( [ "outside" ] ) ) ;
7979 } ) ;
8080
81+ it ( "should parse allowlisted fenced blocks with indented closing fences" , ( ) => {
82+ const content = `
83+ \`\`\`ad-note
84+ Id:: 121212
85+ \`\`\`
86+ ` ;
87+ const result = InlineFieldParser . parseInlineFields ( content , {
88+ includeCodeBlocks : [ "ad-note" ] ,
89+ } ) ;
90+
91+ expect ( result . get ( "Id" ) ) . toEqual ( new Set ( [ "121212" ] ) ) ;
92+ } ) ;
93+
8194 it ( "should include fields inside allowlisted fenced code blocks" , ( ) => {
8295 const content = `
8396Id:: 343434
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ export class InlineFieldParser {
66
77 private static readonly FRONTMATTER_REGEX = / ^ - - - \r ? \n [ \s \S ] * ?\r ? \n - - - \r ? \n / ;
88 private static readonly FENCED_CODE_BLOCK_REGEX =
9- / ( ` { 3 , } ) ( [ ^ \r \n ` ] * ) \r ? \n ( [ \s \S ] * ?) (?: \r ? \n ) ? \1/ g;
9+ / ( ` { 3 , } ) ( [ ^ \r \n ` ] * ) \r ? \n ( [ \s \S ] * ?) (?: \r ? \n [ \t ] * | [ \t ] * ) \1/ g;
1010 private static readonly INLINE_CODE_SPAN_REGEX = / ` [ ^ ` ] * ` / g;
1111
1212 /**
You can’t perform that action at this time.
0 commit comments