diff --git a/exampleSite/content/en/shortcodes/hints.md b/exampleSite/content/en/shortcodes/hints.md index 8f21060..d437232 100644 --- a/exampleSite/content/en/shortcodes/hints.md +++ b/exampleSite/content/en/shortcodes/hints.md @@ -6,7 +6,7 @@ Hint shortcode can be used as hint/alerts/notification block. Attributes: -| Name | Usage | default | +| Name | Usage | Default | | ---------------- | --------------------------------------------------------------------------------- | --------------------- | | type | color types to choose from | note | | icon (optional) | custom icon to use | undefined (type name) | diff --git a/exampleSite/content/en/shortcodes/images/_index.md b/exampleSite/content/en/shortcodes/images/_index.md index 0ad7b6f..b8a58d9 100644 --- a/exampleSite/content/en/shortcodes/images/_index.md +++ b/exampleSite/content/en/shortcodes/images/_index.md @@ -43,7 +43,7 @@ If you need more flexibility for your embedded images, you could use the `img` s **Attributes:** -| Name | Usage | default | +| Name | Usage | Default | | ------------- | ------------------------------------------------------------------------------------------------------------- | ----------------- | | name (string) | Name of the image resource defined in your front matter. | empty | | alt (string) | Description for displayed image. | resource `.Title` | diff --git a/exampleSite/content/en/shortcodes/includes.md b/exampleSite/content/en/shortcodes/includes.md index 7a0453b..01d6ad9 100644 --- a/exampleSite/content/en/shortcodes/includes.md +++ b/exampleSite/content/en/shortcodes/includes.md @@ -14,7 +14,7 @@ Include shortcode can include files of different types. By specifying a language Attributes: -| Name | Usage | default | +| Name | Usage | Default | | -------- | ----------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- | | file | path to the included file relative to the Hugo root | undefined | | language | language for [syntax highlighting](https://gohugo.io/content-management/syntax-highlighting/#list-of-chroma-highlighting-languages) | undefined | diff --git a/exampleSite/content/en/shortcodes/toc.md b/exampleSite/content/en/shortcodes/toc.md index fcb9751..77259c7 100644 --- a/exampleSite/content/en/shortcodes/toc.md +++ b/exampleSite/content/en/shortcodes/toc.md @@ -4,12 +4,22 @@ title: ToC Simple wrapper to generate a page Table of Content from a shortcode. +**Attributes:** + +| Name | Usage | Default | +| ------ | -------------------------- | ------------------------------------------------------------- | +| format | format of the returned ToC | html | + +**Syntax:** + ```tpl -{{}} +{{}} ``` +**Example:** + {{< toc >}} ## Level 1 diff --git a/layouts/shortcodes/expand.html b/layouts/shortcodes/expand.html index 0ab3d2a..da82c49 100644 --- a/layouts/shortcodes/expand.html +++ b/layouts/shortcodes/expand.html @@ -6,6 +6,6 @@
- {{ .Inner | $.Page.RenderString }} + {{ .Inner | $.Page.RenderString | htmlUnescape | safeHTML }}
diff --git a/layouts/shortcodes/toc-tree.html b/layouts/shortcodes/toc-tree.html index 15319b8..74492fd 100644 --- a/layouts/shortcodes/toc-tree.html +++ b/layouts/shortcodes/toc-tree.html @@ -1,41 +1,39 @@ -{{ $tocLevels := default (default 6 .Site.Params.GeekdocToC) .Page.Params.GeekdocToC }} +{{- $tocLevels := default (default 6 .Site.Params.GeekdocToC) .Page.Params.GeekdocToC }} -{{ if $tocLevels }} +{{- if $tocLevels }}
{{ template "toc-tree" dict "sect" .Page.Pages }}
-{{ end }} +{{- end }} -{{ define "toc-tree" }} +{{- define "toc-tree" }} -{{ end }} +{{- end }} diff --git a/layouts/shortcodes/toc.html b/layouts/shortcodes/toc.html index 0669b71..aba251c 100644 --- a/layouts/shortcodes/toc.html +++ b/layouts/shortcodes/toc.html @@ -1,8 +1,13 @@ -{{ $tocLevels := default (default 6 .Site.Params.GeekdocToC) .Page.Params.GeekdocToC }} +{{- $format := default "html" (.Get "format") }} +{{- $tocLevels := default (default 6 .Site.Params.GeekdocToC) .Page.Params.GeekdocToC }} -{{ if and $tocLevels .Page.TableOfContents }} -
+{{- if and $tocLevels .Page.TableOfContents -}} + {{- if not (eq ($format | lower) "raw") -}} +
+ {{ .Page.TableOfContents }} +
+
+ {{- else -}} {{ .Page.TableOfContents }} -
-
-{{ end }} + {{- end -}} +{{- end -}}