Skip to content

Commit 4132706

Browse files
committed
work around syntaxhighlighter bug causing empty blocks on perlsecret
perlsecret.pod has some code blocks that are very short. The syntax highlighter has a bug when it attempts to strip <![CDATA[ ]]> blocks, which ends up entirely erasing short code block content. The CDATA stripping is only enabled when the useScriptTags option is enabled, which we don't need or want. Work around the bug by disabling useScriptTags. This bug had previously been fixed by patching the vendor library to fix the CDATA stripping. That change was lost in the conversion to node_modules.
1 parent 73dc5d1 commit 4132706

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

root/static/js/syntaxhighlighter.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ SyntaxHighlighter.regexLib['url'] = /[a-z][a-z0-9.+-]*:\/\/[\w-./?%&=:@;#~]*[\w-
8585
// Use regular spaces, not &nbsp;
8686
SyntaxHighlighter.config.space = ' ';
8787

88+
// We aren't using <script type="syntaxhighlighter" />, and when enabled it
89+
// attempts to strip <![CDATA[ ]]> sections. That code is buggy, and causes
90+
// breaks on perlsecret.pod
91+
SyntaxHighlighter.config.useScriptTags = false;
92+
8893
// https://metacpan.org/source/RWSTAUNER/Acme-Syntax-Examples-0.001/lib/Acme/Syntax/Examples.pm
8994

9095
// TODO: Might be easier to do the regexp on the plain string (before

0 commit comments

Comments
 (0)