Skip to content

Commit 4ba0774

Browse files
committed
Ignore inline keys when they appear in an inline codeblock.
1 parent 9ea88b9 commit 4ba0774

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Diff for: src/data-import/inline-field.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,11 @@ function findClosing(
7070
function findSeparator(line: string, start: number): { key: string; valueIndex: number } | undefined {
7171
let sep = line.indexOf("::", start);
7272
if (sep < 0) return undefined;
73+
// ignore keys
74+
let key = line.substring(start, sep).trim();
75+
if (key.indexOf('`') >=0) return undefined;
7376

74-
return { key: line.substring(start, sep).trim(), valueIndex: sep + 2 };
77+
return { key: key, valueIndex: sep + 2 };
7578
}
7679

7780
/** Try to completely parse an inline field starting at the given position. Assumes `start` is on a wrapping character. */

Diff for: src/test/parse/parse.inline.test.ts

+3
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ describe("Simple Inline Inline", () => {
3939
test("Incorrect Brackets", () => expect(extractInlineFields("[key:value]")).toEqual([]));
4040
test("Incorrect Parenthesis", () => expect(extractInlineFields("(key:value)")).toEqual([]));
4141

42+
test("Mixed inline code block", () => expect(extractInlineFields("Some `inline::codeblock`")).toEqual([]));
43+
test("Mixed inline code block between Parenthesis", () => expect(extractInlineFields("(Some `inline::codeblock`)")).toEqual([]));
44+
4245
test("Trivial Brackets", () =>
4346
expect(extractInlineFields("[key::value]")).toEqual([
4447
{

0 commit comments

Comments
 (0)