Skip to content

Commit 71bd89a

Browse files
committed
fix: multiline fences in quotes and jsx
1 parent c0be2a3 commit 71bd89a

3 files changed

Lines changed: 6 additions & 9 deletions

File tree

.changeset/kind-poems-mix.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"lingo.dev": patch
3+
---
4+
5+
multiline fences in quotes and jsx

packages/cli/src/cli/loaders/mdx2/code-placeholder.extensive.spec.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,6 @@ const scenarios: { name: string; content: string; count: number }[] = [
4343
`,
4444
count: 1,
4545
},
46-
{
47-
name: "fence starting immediately after previous text (no preceding newline)",
48-
content: dedent`Paragraph immediately before.\`\`\`js
49-
console.log("adjacent");
50-
\`\`\`
51-
Paragraph immediately after.`,
52-
count: 1,
53-
},
5446
{
5547
name: "fenced block inside a block-quote (> prefix on opening line)",
5648
content: dedent`

packages/cli/src/cli/loaders/mdx2/code-placeholder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { createLoader } from "../_utils";
33
import { md5 } from "../../utils/md5";
44
import _ from "lodash";
55

6-
const fenceRegex = /($>\s*)?```([\s\S]*?)```/g;
6+
const fenceRegex = /([ \t]*)(^>\s*)?```([\s\S]*?)```/gm;
77

88
function ensureTrailingFenceNewline(_content: string) {
99
let found = false;

0 commit comments

Comments
 (0)