0%

Crayon Syntax Highlighter转义问题解决

在博客里面贴代码的时候发现,Dockerfile里面的指令中2个连接的'&'符号,被Crayon Syntax Highlighter代码插件转义为"&&"了。 网上找到了几个日文的资料来取消Crayon Syntax Highlighter对'&'符号的转义,步骤如下:

1.修改wp-content/plugins/crayon-syntax-highlighter/crayon_formatter.class.php文件,将第554行代码注释掉:

1
2
3
4
/* Convert <, > and & characters to entities, as these can appear as HTML tags and entities. */
if ($escape) {
/* $code = CrayonUtil::htmlspecialchars($code); */
}
2.修改wp-content/plugins/crayon-syntax-highlighter/langs/default/operator.txt文件,在其中的"&="和"&"前面加上'#'号注释掉。
1
2
3
4
5
6
7
before:
&=
&

after:
#&=
#&
参考文档: