Website Summary Files Commits Branches @commit @diff @stats
path: root / exampleSite / content / hugo-hl-example / _index.md
diff options
context:
space:
mode:
Commitad823cc4d72edbab10f0dadf99b30df91c3f7c50 (patch)
Author
 Dimitar Trendafilov <trendafilov.dn@gmail.com>
2020-08-16 08:38:04 +0300
Committer
 Dimitar Trendafilov <trendafilov.dn@gmail.com>
2020-08-16 08:38:04 +0300
Files6666a19acc2316d6ad5ad00291066d6d6fd42a5b /exampleSite/content/hugo-hl-example/_index.md
IPL-ad823cc4d72edbab10f0dadf99b30df91c3f7c50.tar
IPL-ad823cc4d72edbab10f0dadf99b30df91c3f7c50.tar.gz
IPL-ad823cc4d72edbab10f0dadf99b30df91c3f7c50.zip
Squashed 'website/themes/reveal-hugo/' content from commit ff9f389
git-subtree-dir: website/themes/reveal-hugo git-subtree-split: ff9f389743ae2fe5c5cc6101455db0616e8548e2
1 files changed, 113 insertions, 0 deletions
-rw-r--r--exampleSite/content/hugo-hl-example/_index.md113
diff --git a/exampleSite/content/hugo-hl-example/_index.md b/exampleSite/content/hugo-hl-example/_index.md
new file mode 100644
index 0000000..279254c
--- /dev/null
+++ b/exampleSite/content/hugo-hl-example/_index.md
@@ -0,0 +1,113 @@
++++
+title = "Hugo highlighting example"
+outputs = ["Reveal"]
+
+[reveal_hugo]
+theme = "simple"
++++
+
+## Hugo Highlighter Presentation
+
+This is an example of a presentation using Hugo's compile-time syntax highlighter.
+
+---
+
+Reveal.js uses Javascript for syntax highlighting (via Highlight.js). This might slow the presentation down if many slides contain code.
+
+---
+
+Hugo has a built-in [compile-time highlighter](https://gohugo.io/content-management/syntax-highlighting/), and it's lightning fast too!
+
+---
+
+You can enable it using the `highlight` shortcode.
+
+{{< highlight go >}}
+{{</* highlight go */>}}
+
+package main
+
+import "fmt"
+
+func main() {
+ fmt.Println("Hello world!")
+}
+
+{{</* /highlight */>}}
+{{< /highlight >}}
+
+---
+
+Several options are supported, check [Hugo's documentation](https://gohugo.io/content-management/syntax-highlighting/).
+
+{{< highlight go "style=github,linenos=inline,hl_lines=8" >}}
+{{</* highlight go "style=github,linenos=inline,hl_lines=6" */>}}
+
+package main
+
+import "fmt"
+
+func main() {
+ fmt.Println("Hello world!")
+}
+
+{{</* /highlight */>}}
+{{< / highlight >}}
+
+---
+
+You can also use Hugo's highlighter in markdown code fences,
+by putting this in `config.toml`:
+
+{{< highlight toml "style=github" >}}
+
+# use Hugo's hl in markdown (with or without a language tag)
+[markup.highlight]
+codeFences = true
+style = "github"
+
+{{< /highlight >}}
+
+(This can only be enabled globally for all presentations.)
+
+---
+
+- Highlight.js is automatically disabled in code blocks highlighted by Hugo.
+- The two highlighters can be even mixed.
+
+{{< highlight go >}}
+package main
+
+import "fmt"
+
+func main() {
+ fmt.Println("Hello world!")
+}
+{{< / highlight >}}
+
+```go
+package main
+
+import "fmt"
+
+func main() {
+ fmt.Println("Hello world!")
+}
+```
+
+---
+
+If you don't need highlight.js at all, you can prevent it from loading.
+
+{{< highlight toml "style=github" >}}
+
+# This works both in config.toml and a presentation's front
+# matter. Default plugins include highlight.js, so disable them
+# and load those that we want manually.
+
+[params.reveal_hugo]
+load_default_plugins = false
+plugins = [
+ "reveal-js/plugin/zoom-js/zoom.js",
+ "reveal-js/plugin/notes/notes.js",
+]