perf: replace parse5 with ultrahtml (#336)

This commit is contained in:
Daniel Roe 2022-12-04 22:10:10 +00:00 committed by GitHub
parent 04615e443e
commit 1c0f8b0147
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 94 additions and 143 deletions

View file

@ -1,45 +1,25 @@
// Vitest Snapshot v1
exports[`content-rich > code frame 1`] = `
"<p>Testing code block</p>
<p></p>
<pre lang=\\"ts\\">
import { useMouse, usePreferredDark } from &#39;@vueuse/core&#39;
"<p>Testing code block</p><p><pre lang=\\"ts\\">import { useMouse, usePreferredDark } from &#39;@vueuse/core&#39;
// tracks mouse position
const { x, y } = useMouse()
// is the user prefers dark theme
const isDark = usePreferredDark()</pre
>
<p></p>
"
const isDark = usePreferredDark()</pre></p>"
`;
exports[`content-rich > code frame 2 1`] = `
"<p>
<span class=\\"h-card\\"><a class=\\"u-url mention\\" to=\\"/@antfu@mas.to\\"></a></span>
<span class=\\"h-card\\"><a class=\\"u-url mention\\" to=\\"/mas.to/@antfu\\"></a></span>
Testing<br />
<pre lang=\\"ts\\">const a = hello</pre>
</p>
<pre lang=\\"ts\\">const a = hello</pre>
<p></p>
"
`;
exports[`content-rich > code frame empty 1`] = `
"<p></p>
<pre></pre>
<br />
<p></p>
"
`;
exports[`content-rich > code frame empty 1`] = `"<p><pre></pre><br></p>"`;
exports[`content-rich > code frame no lang 1`] = `
"<p></p>
<pre>hello world</pre>
<br />no lang
<p></p>
"
`;
exports[`content-rich > code frame no lang 1`] = `"<p><pre>hello world</pre><br>no lang</p>"`;
exports[`content-rich > custom emoji 1`] = `
"Daniel Roe
@ -61,7 +41,7 @@ exports[`content-rich > link + mention 1`] = `
><a
class=\\"u-url mention\\"
rel=\\"nofollow noopener noreferrer\\"
to=\\"/@vitest@mas.to\\"
to=\\"/mas.to/@vitest\\"
></a
></span>
(migrated from chai+mocha)

View file

@ -1,24 +1,18 @@
// Vitest Snapshot v1
exports[`html-parse > code frame > html 1`] = `
"<p>Testing code block</p>
<p></p>
<pre><code class=\\"language-ts\\">import { useMouse, usePreferredDark } from '@vueuse/core'
"<p>Testing code block</p><p><pre><code class=\\"language-ts\\">import { useMouse, usePreferredDark } from &#39;@vueuse/core&#39;
// tracks mouse position
const { x, y } = useMouse()
// is the user prefers dark theme
const isDark = usePreferredDark()</code></pre>
<p></p>
"
const isDark = usePreferredDark()</code></pre></p>"
`;
exports[`html-parse > code frame > text 1`] = `
"Testing code block
\`\`\`ts
import { useMouse, usePreferredDark } from '@vueuse/core'
import { useMouse, usePreferredDark } from &#39;@vueuse/core&#39;
// tracks mouse position
const { x, y } = useMouse()
// is the user prefers dark theme
@ -34,9 +28,8 @@ exports[`html-parse > code frame 2 > html 1`] = `
></span
>
Testing<br />
<pre><code class=\\"language-ts\\">const a = hello</code></pre>
</p>
<pre><code class=\\"language-ts\\">const a = hello</code></pre>
<p></p>
"
`;
@ -65,13 +58,7 @@ exports[`html-parse > empty > html 1`] = `""`;
exports[`html-parse > empty > text 1`] = `""`;
exports[`html-parse > inline markdown > html 1`] = `
"<p>text <code>code</code> <b>bold</b> <em>italic</em> <del>del</del></p>
<p></p>
<pre><code class=\\"language-js\\">code block</code></pre>
<p></p>
"
`;
exports[`html-parse > inline markdown > html 1`] = `"<p>text <code>code</code> <b>bold</b> <em>italic</em> <del>del</del></p><p><pre><code class=\\"language-js\\">code block</code></pre></p>"`;
exports[`html-parse > inline markdown > text 1`] = `
"text \`code\` **bold** *italic* ~~del~~