Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/modelFactory/markdownPrefixStripper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ export class MarkdownPrefixStripper {
let remaining = line;

// Layer 1: Blockquote markers (always strip - unambiguous Markdown syntax)
const bqMatch = remaining.match(/^(\s*(?:>\s*)+)/);
const bqMatch = remaining.match(/^([^\S\r\n]*(?:>[^\S\r\n]*)+)/);
if (bqMatch) {
prefix += bqMatch[1];
remaining = remaining.substring(bqMatch[1].length);
}

// Layer 2: List markers (only strip when followed by whitespace + |, i.e., bordered tables)
const listMatch = remaining.match(/^(\s*(?:\d+[.)]|[-*+]))(?=\s+\|)/);
const listMatch = remaining.match(/^([^\S\r\n]*(?:\d+[.)]|[-*+]))(?=[^\S\r\n]+\|)/);
if (listMatch) {
prefix += listMatch[1];
}
Expand Down
9 changes: 8 additions & 1 deletion test/systemTests/cliPrettyfierSystemTests.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@ fs.readdir(path.resolve(__dirname, "resources/"), function(err, files) {
for (let fileNameRoot of distinctTests) {
test(`[${fileNameRoot}]`, () => {
const input = readFileContents(`${fileNameRoot}-input.md`);
assert.throws(() => CliPrettify.check(input));
const expected = readFileContents(`${fileNameRoot}-expected.md`);
const cliOptions = SystemTestsConfig.getCliOptionsFor(fileNameRoot);

if (input === expected) {
assert.doesNotThrow(() => CliPrettify.check(input, cliOptions));
} else {
assert.throws(() => CliPrettify.check(input, cliOptions));
}
});
}
});
Expand Down
25 changes: 25 additions & 0 deletions test/systemTests/resources/blockQuoteNewLineNoTable-expected.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
> First line of my note.
>
> Second line.

> [!NOTE]
> First line of my note.
>
> ```text
> some_code
> ```

# Awesome file

> [!NOTE]
> First line of my note.
>
> ```text
> some_code
> ```

Here is a paragraph.

> A marvelous quotation.

Second paragraph.
25 changes: 25 additions & 0 deletions test/systemTests/resources/blockQuoteNewLineNoTable-input.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
> First line of my note.
>
> Second line.

> [!NOTE]
> First line of my note.
>
> ```text
> some_code
> ```

# Awesome file

> [!NOTE]
> First line of my note.
>
> ```text
> some_code
> ```

Here is a paragraph.

> A marvelous quotation.

Second paragraph.
Loading