From da26c38e59cf665c3d64ec6430a7e9f8882692bd Mon Sep 17 00:00:00 2001
From: nove-b
`
})
.replace(/`([^`\n]*)`/g, (_1, raw) => {
- return raw ? `${code}
${htmlToText(raw).replace(//g, '>')}
` : ''
+ return raw ? `${htmlToText(raw).replace(//g, '>').replace(/\*/g, '*')}
` : ''
})
}
diff --git a/tests/nuxt/__snapshots__/content-rich.test.ts.snap b/tests/nuxt/__snapshots__/content-rich.test.ts.snap
index 4e99489c..645c08ba 100644
--- a/tests/nuxt/__snapshots__/content-rich.test.ts.snap
+++ b/tests/nuxt/__snapshots__/content-rich.test.ts.snap
@@ -1,5 +1,12 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
+exports[`content-rich > asterisk paris in code block 1`] = `"1 * 2 * 3
1 * 2 * 3
[(\`number string) (\`tag string)]"`; exports[`content-rich > block with injected html, with a known language 1`] = ` diff --git a/tests/nuxt/content-rich.test.ts b/tests/nuxt/content-rich.test.ts index e1eb2d9b..3eb7982f 100644 --- a/tests/nuxt/content-rich.test.ts +++ b/tests/nuxt/content-rich.test.ts @@ -186,6 +186,16 @@ describe('content-rich', () => { `) expect(formatted).toMatchSnapshot() }) + + it ('asterisk paris in inline code', async () => { + const { formatted } = await render('
`1 * 2 * 3`
') + expect(formatted).toMatchSnapshot() + }) + + it ('asterisk paris in code block', async () => { + const { formatted } = await render('```
1 * 2 * 3
```