Skip to content

Commit

Permalink
add support for wrapping code in script tempalte to avoid html parser #…
Browse files Browse the repository at this point in the history
  • Loading branch information
hakimel committed Jun 5, 2020
1 parent 6772518 commit 37d8337
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 14 deletions.
24 changes: 12 additions & 12 deletions demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,35 +102,35 @@ <h2 data-id="code-title">Pretty Code</h2>

<section data-auto-animate>
<h2 data-id="code-title">With animations</h2>
<pre data-id="code-animation"><code class="hljs" data-trim data-line-numbers="|4,8-11|17|22-24">
<pre data-id="code-animation"><code class="hljs" data-trim data-line-numbers="|4,8-11|17|22-24"><script type="text/template">
import React, { useState } from 'react';

function Example() {
const [count, setCount] = useState(0);

return (
&lt;div&gt;
&lt;p&gt;You clicked {count} times&lt;/p&gt;
&lt;button onClick={() =&gt; setCount(count + 1)}&gt;
<div>
<p>You clicked {count} times</p>
<button onClick={() => setCount(count + 1)}>
Click me
&lt;/button&gt;
&lt;/div&gt;
</button>
</div>
);
}

function SecondExample() {
const [count, setCount] = useState(0);

return (
&lt;div&gt;
&lt;p&gt;You clicked {count} times&lt;/p&gt;
&lt;button onClick={() =&gt; setCount(count + 1)}&gt;
<div>
<p>You clicked {count} times</p>
<button onClick={() => setCount(count + 1)}>
Click me
&lt;/button&gt;
&lt;/div&gt;
</button>
</div>
);
}
</code></pre>
</script></code></pre>
</section>

<section>
Expand Down
2 changes: 1 addition & 1 deletion plugin/highlight/highlight.esm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 37d8337

Please sign in to comment.