Skip to content

Commit b967541

Browse files
committed
codex: address PR review feedback (#1128)
1 parent ef155be commit b967541

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/utils/InlineFieldParser.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff 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 = `
8396
Id:: 343434

src/utils/InlineFieldParser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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
/**

0 commit comments

Comments
 (0)