Skip to content

Commit 6bd2447

Browse files
code-in-cpptarleb
authored andcommitted
Replace '<' and '>' with "&lt;" and "&gt;" in code block
revealjs-codeblock/revealjs-codeblock.lua revealjs-codeblock/expected.html
1 parent 2f3dd16 commit 6bd2447

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

revealjs-codeblock/expected.html

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,25 @@ <h1 data-auto-animate="">Even Prettier Animations</h1>
1919
const [count, setCount] = useState(0);
2020

2121
return (
22-
<div>
23-
<p>You clicked {count} times</p>
24-
<button onClick={() => setCount(count + 1)}>
22+
&lt;div&gt;
23+
&lt;p&gt;You clicked {count} times&lt;/p&gt;
24+
&lt;button onClick={() =&gt; setCount(count + 1)}&gt;
2525
Click me
26-
</button>
27-
</div>
26+
&lt;/button&gt;
27+
&lt;/div&gt;
2828
);
2929
}
3030

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

3434
return (
35-
<div>
36-
<p>You clicked {count} times</p>
37-
<button onClick={() => setCount(count + 1)}>
35+
&lt;div&gt;
36+
&lt;p&gt;You clicked {count} times&lt;/p&gt;
37+
&lt;button onClick={() =&gt; setCount(count + 1)}&gt;
3838
Click me
39-
</button>
40-
</div>
39+
&lt;/button&gt;
40+
&lt;/div&gt;
4141
);
4242
}</code></pre>
4343
</section>

revealjs-codeblock/revealjs-codeblock.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function CodeBlock(block)
6666
local html = string.format('<pre %s><code %s>%s</code></pre>',
6767
table.concat(pre_tag_attributes, ' '),
6868
table.concat(code_tag_attributes, ' '),
69-
block.text)
69+
block.text:gsub("<", "&lt;"):gsub(">", "&gt;"))
7070
return pandoc.RawBlock('html', html)
7171
end
7272
end

0 commit comments

Comments
 (0)