mirror of
https://github.com/Threnklyn/reveal-hugo.git
synced 2026-06-07 14:03:33 +02:00
enable Highlight.js line numbers and -highlights
This commit is contained in:
@@ -20,8 +20,12 @@ name = "Josh Dzielak"
|
|||||||
[markup.goldmark.renderer]
|
[markup.goldmark.renderer]
|
||||||
unsafe = true
|
unsafe = true
|
||||||
[markup.highlight]
|
[markup.highlight]
|
||||||
|
# setting the theme for highlighting by Hugo
|
||||||
# we need a style that looks good in both light and dark background!
|
# we need a style that looks good in both light and dark background!
|
||||||
style = "tango"
|
style = "tango"
|
||||||
|
# to allow the use of Highlight.js line numbers and highlights
|
||||||
|
# (see https://github.com/hakimel/reveal.js#line-numbers--highlights)
|
||||||
|
codeFences = false
|
||||||
|
|
||||||
[outputFormats.Reveal]
|
[outputFormats.Reveal]
|
||||||
baseName = "index"
|
baseName = "index"
|
||||||
@@ -30,6 +34,8 @@ isHTML = true
|
|||||||
|
|
||||||
[params.reveal_hugo]
|
[params.reveal_hugo]
|
||||||
history = true
|
history = true
|
||||||
|
# setting the theme for highlighting by Highlight.js
|
||||||
|
highlight_theme = "github"
|
||||||
|
|
||||||
# used in content/template-example
|
# used in content/template-example
|
||||||
[params.reveal_hugo.templates.grey]
|
[params.reveal_hugo.templates.grey]
|
||||||
|
|||||||
@@ -7,6 +7,10 @@
|
|||||||
<!-- <code> blocks processed by Hugo's highlighter have a data-lang attribute. For those, we disable -->
|
<!-- <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". -->
|
<!-- 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 -}}
|
{{- $content := replaceRE `<code class="language-\w+"\s+data-lang="\w+"` `<code class="nohighlight" data-noescape` $content -}}
|
||||||
|
<!-- enable Highlight.js line numbers when the markdown code block language selection is followed by "{}" e.g. ```js{} -->
|
||||||
|
{{- $content := replaceRE `(<code class="language-\w+){}(">)` `$1" data-line-numbers>` $content -}}
|
||||||
|
<!-- enable Highlight.js line highlights when the language selection is followed by "{<line numbers>}" e.g. ```js{1,5-7} -->
|
||||||
|
{{- $content := replaceRE `(<code class="language-\w+){(\S+)}(">)` `$1" data-line-numbers="$2">` $content -}}
|
||||||
<!-- Support both <hr /> (blackfriday) and <hr> (mmark) -->
|
<!-- Support both <hr /> (blackfriday) and <hr> (mmark) -->
|
||||||
{{- $content := replace $content "<hr>" "<hr />" -}}
|
{{- $content := replace $content "<hr>" "<hr />" -}}
|
||||||
<!-- Split the processed content by <hr /> tag -->
|
<!-- Split the processed content by <hr /> tag -->
|
||||||
|
|||||||
Reference in New Issue
Block a user