fix: render code block without language (#276)
This commit is contained in:
parent
18d5fd4804
commit
0f06653636
4 changed files with 32 additions and 7 deletions
|
@ -25,6 +25,22 @@ exports[`content-rich > code frame 2 1`] = `
|
|||
"
|
||||
`;
|
||||
|
||||
exports[`content-rich > code frame empty 1`] = `
|
||||
"<p></p>
|
||||
<pre></pre>
|
||||
<br />
|
||||
<p></p>
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`content-rich > code frame no lang 1`] = `
|
||||
"<p></p>
|
||||
<pre>hello world</pre>
|
||||
<br />no lang
|
||||
<p></p>
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`content-rich > custom emoji 1`] = `
|
||||
"Daniel Roe
|
||||
<img
|
||||
|
|
|
@ -39,6 +39,16 @@ describe('content-rich', () => {
|
|||
const { formatted } = await render('<p><span class=\"h-card\"><a href=\"https://mas.to/@antfu\" class=\"u-url mention\">@<span>antfu</span></a></span> Testing<br />```ts<br />const a = hello<br />```</p>')
|
||||
expect(formatted).toMatchSnapshot()
|
||||
})
|
||||
|
||||
it('code frame no lang', async () => {
|
||||
const { formatted } = await render('<p>```<br />hello world<br />```<br />no lang</p>')
|
||||
expect(formatted).toMatchSnapshot()
|
||||
})
|
||||
|
||||
it('code frame empty', async () => {
|
||||
const { formatted } = await render('<p>```<br /><br />```<br /></p>')
|
||||
expect(formatted).toMatchSnapshot()
|
||||
})
|
||||
})
|
||||
|
||||
async function render(content: string, emojis?: Record<string, Emoji>) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue