Disable highlight.js for code processed by Hugo's hl

This commit is contained in:
Kostas Chatzikokolakis
2019-09-12 17:49:16 +03:00
parent cd5ca462ac
commit 83a0216daf
+3
View File
@@ -4,6 +4,9 @@
{{- if ne (len .Content) 0 -}}
<!-- Remove the <hr /> tag generated by blackfriday for footnotes -->
{{- $content := replace .Content "<div class=\"footnotes\">\n\n<hr />" "<div class=\"footnotes\">" -}}
<!-- <code> blocks processed by Hugo's highlighter have a data-lang attribute. For those, we disable -->
<!-- highlight.js by changing the language class to "nohighlight", and adding "data-noescape". -->
{{- $content := replaceRE `<code class="language-\w+"\s+data-lang="\w+"` `<code class="nohighlight" data-noescape` $content -}}
<!-- Support both <hr /> (blackfriday) and <hr> (mmark) -->
{{- $content := replace $content "<hr>" "<hr />" -}}
<!-- Split the processed content by <hr /> tag -->