Skip to content

Commit dfefe32

Browse files
committed
feat: support fences after jsx closing bracket
1 parent f70690e commit dfefe32

3 files changed

Lines changed: 19 additions & 1 deletion

File tree

.changeset/green-eels-chew.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+
fences after jsx block

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,19 @@ Paragraph immediately after.`,
129129
`,
130130
count: 1,
131131
},
132+
{
133+
name: "code block with jsx component wrapping the fence markers",
134+
content: dedent`
135+
<Component>
136+
137+
\`\`\`js
138+
console.log("jsx wrapped fence");
139+
\`\`\`
140+
141+
</Component>
142+
`,
143+
count: 1,
144+
},
132145
];
133146

134147
describe("mdx code placeholder loader – extensive combinations", () => {

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 = /($>\s*)?```([\s\S]*?)```/g;
77

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

0 commit comments

Comments
 (0)