@@ -19,7 +19,8 @@ ava("marked - basic markdown parsing", (t) => {
1919ava ( "marked - code fence with language" , ( t ) => {
2020 const input = "```typescript\nconst x = 42;\n```"
2121 const result = marked . parse ( input )
22- t . snapshot ( result )
22+ t . is ( result , `<pre><code class="language-typescript"><span class="hljs-keyword">const</span> x = <span class="hljs-number">42</span>;
23+ </code></pre>` )
2324} )
2425
2526ava ( "marked - code fence without language" , ( t ) => {
@@ -68,7 +69,9 @@ const x = 42;
6869\`\`\`
6970` . trim ( )
7071 const result = md ( input )
71- t . snapshot ( result )
72+ t . is ( result , `<div class="p-5 prose dark:prose-dark"><h1 id="title">Title</h1>
73+ <pre><code class="language-js"><span class="hljs-keyword">const</span> x = <span class="hljs-number">42</span>;
74+ </code></pre></div>` )
7275} )
7376
7477ava ( "marked - blockquotes with markdown" , ( t ) => {
@@ -110,31 +113,44 @@ ava("md - without container classes", (t) => {
110113ava ( "marked - code fence with empty lines" , ( t ) => {
111114 const input = "```js\n\nconst x = 42;\n\n```"
112115 const result = marked . parse ( input )
113- t . snapshot ( result )
116+ t . is ( result , `<pre><code class="language-js">
117+ <span class="hljs-keyword">const</span> x = <span class="hljs-number">42</span>;
118+ </code></pre>` )
114119} )
115120
116121ava ( "marked - code fence with spaces before language" , ( t ) => {
117122 const input = "``` javascript \nconst x = 42;\n```"
118123 const result = marked . parse ( input )
119- t . snapshot ( result )
124+ t . is ( result , `<pre><code class="language-javascript"><span class="hljs-keyword">const</span> x = <span class="hljs-number">42</span>;
125+ </code></pre>` )
120126} )
121127
122128ava ( "marked - nested code fences in blockquotes" , ( t ) => {
123129 const input = "> Here's some code:\n> ```js\n> const x = 42;\n> ```"
124130 const result = marked . parse ( input )
125- t . snapshot ( result )
131+ t . is ( result , `<blockquote>
132+ <p>Here's some code:</p>
133+ <pre><code class="language-js"><span class="hljs-keyword">const</span> x = <span class="hljs-number">42</span>;
134+ </code></pre></blockquote>
135+ ` )
126136} )
127137
128138ava ( "marked - code fence with html inside" , ( t ) => {
129139 const input = "```html\n<div class='test'>\n <span>content</span>\n</div>\n```"
130140 const result = marked . parse ( input )
131- t . snapshot ( result )
141+ t . is ( result , `<pre><code class="language-html"><span class="hljs-tag"><<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">'test'</span>></span>
142+ <span class="hljs-tag"><<span class="hljs-name">span</span>></span>content<span class="hljs-tag"></<span class="hljs-name">span</span>></span>
143+ <span class="hljs-tag"></<span class="hljs-name">div</span>></span>
144+ </code></pre>` )
132145} )
133146
134147ava ( "marked - code fence with backticks inside" , ( t ) => {
135148 const input = "````\n```js\nconst x = 42;\n```\n````"
136149 const result = marked . parse ( input )
137- t . snapshot ( result )
150+ t . is ( result , `<pre><code>\`\`\`js
151+ const x = 42;
152+ \`\`\`
153+ </code></pre>` )
138154} )
139155
140156ava ( "marked - code fence with markdown inside" , ( t ) => {
@@ -146,7 +162,10 @@ ava("marked - code fence with markdown inside", (t) => {
146162ava ( "marked - code fence with mixed indentation" , ( t ) => {
147163 const input = "```js\n const x = 1;\n const y = 2;\n\tconst z = 3;\n```"
148164 const result = marked . parse ( input )
149- t . snapshot ( result )
165+ t . is ( result , `<pre><code class="language-js"> <span class="hljs-keyword">const</span> x = <span class="hljs-number">1</span>;
166+ <span class="hljs-keyword">const</span> y = <span class="hljs-number">2</span>;
167+ <span class="hljs-keyword">const</span> z = <span class="hljs-number">3</span>;
168+ </code></pre>` )
150169} )
151170
152171ava ( "marked - code fence with escaped backticks" , ( t ) => {
@@ -158,11 +177,15 @@ ava("marked - code fence with escaped backticks", (t) => {
158177ava ( "marked - code fence with unicode characters" , ( t ) => {
159178 const input = "```js\nconst greeting = '你好';\nconsole.log('🚀');\n```"
160179 const result = marked . parse ( input )
161- t . snapshot ( result )
180+ t . is ( result , `<pre><code class="language-js"><span class="hljs-keyword">const</span> greeting = <span class="hljs-string">'你好'</span>;
181+ <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">'🚀'</span>);
182+ </code></pre>` )
162183} )
163184
164185ava ( "marked - code fence with tabs at line start" , ( t ) => {
165186 const input = "```js\n\tlet x = 1;\n\t\tlet y = 2;\n```"
166187 const result = marked . parse ( input )
167- t . snapshot ( result )
188+ t . is ( result , `<pre><code class="language-js"> <span class="hljs-keyword">let</span> x = <span class="hljs-number">1</span>;
189+ <span class="hljs-keyword">let</span> y = <span class="hljs-number">2</span>;
190+ </code></pre>` )
168191} )
0 commit comments