From 0d66a97284a462599f77c24646dcb4d7e7130d0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Tue, 24 Aug 2021 00:25:15 +0200 Subject: [PATCH] code highlighter: avoid unstyled blocks for indention in docs #32 --- exampleSite/content/cont/menushortcuts.en.md | 137 +++++++++--------- exampleSite/content/cont/pages/_index.en.md | 48 +++--- .../content/shortcodes/attachments.en.md | 21 ++- .../content/shortcodes/children/_index.en.md | 26 ++-- exampleSite/content/shortcodes/tabs.en.md | 80 +++++----- 5 files changed, 168 insertions(+), 144 deletions(-) diff --git a/exampleSite/content/cont/menushortcuts.en.md b/exampleSite/content/cont/menushortcuts.en.md index 4fcaa9deef..47090ded84 100644 --- a/exampleSite/content/cont/menushortcuts.en.md +++ b/exampleSite/content/cont/menushortcuts.en.md @@ -12,35 +12,39 @@ Edit the website configuration `config.toml` and add a `[[menu.shortcuts]]` entr Example from the current website: - [[menu.shortcuts]] - name = " Github repo" - identifier = "ds" - url = "https://github.com/McShelby/hugo-theme-relearn" - weight = 10 +````toml +[[menu.shortcuts]] +name = " Github repo" +identifier = "ds" +url = "https://github.com/McShelby/hugo-theme-relearn" +weight = 10 - [[menu.shortcuts]] - name = " Showcases" - url = "/showcase" - weight = 11 +[[menu.shortcuts]] +name = " Showcases" +url = "/showcase" +weight = 11 - [[menu.shortcuts]] - name = " Hugo Documentation" - identifier = "hugodoc" - url = "https://gohugo.io/" - weight = 20 +[[menu.shortcuts]] +name = " Hugo Documentation" +identifier = "hugodoc" +url = "https://gohugo.io/" +weight = 20 - [[menu.shortcuts]] - name = " Credits" - url = "/credits" - weight = 30 +[[menu.shortcuts]] +name = " Credits" +url = "/credits" +weight = 30 +```` By default, shortcuts are preceded by a title. This title can be disabled by setting `disableShortcutsTitle=true`. However, if you want to keep the title but change its value, it can be overriden by changing your local i18n translation string configuration. For example, in your local `i18n/en.toml` file, add the following content - [Shortcuts-Title] - other = "" +````toml +[Shortcuts-Title] +other = "" +```` Read more about [hugo menu](https://gohugo.io/extras/menus/) and [hugo i18n translation strings](https://gohugo.io/content-management/multilingual/#translation-of-strings) @@ -48,62 +52,63 @@ Read more about [hugo menu](https://gohugo.io/extras/menus/) and [hugo i18n tran When using a multilingual website, you can set different menus for each language. In the `config.toml` file, prefix your menu configuration by `Languages.`. - Example from the current website: - [Languages] - [Languages.en] - title = "Documentation for Hugo Relearn Theme" - weight = 1 - languageName = "English" +````toml +[Languages] +[Languages.en] +title = "Documentation for Hugo Relearn Theme" +weight = 1 +languageName = "English" - [[Languages.en.menu.shortcuts]] - name = " Github repo" - identifier = "ds" - url = "https://github.com/McShelby/hugo-theme-relearn" - weight = 10 +[[Languages.en.menu.shortcuts]] +name = " Github repo" +identifier = "ds" +url = "https://github.com/McShelby/hugo-theme-relearn" +weight = 10 - [[Languages.en.menu.shortcuts]] - name = " Showcases" - url = "/showcase" - weight = 11 +[[Languages.en.menu.shortcuts]] +name = " Showcases" +url = "/showcase" +weight = 11 - [[Languages.en.menu.shortcuts]] - name = " Hugo Documentation" - identifier = "hugodoc" - url = "https://gohugo.io/" - weight = 20 +[[Languages.en.menu.shortcuts]] +name = " Hugo Documentation" +identifier = "hugodoc" +url = "https://gohugo.io/" +weight = 20 - [[Languages.en.menu.shortcuts]] - name = " Credits" - url = "/credits" - weight = 30 +[[Languages.en.menu.shortcuts]] +name = " Credits" +url = "/credits" +weight = 30 - [Languages.fr] - title = "Documentation du thème Hugo Relearn" - weight = 2 - languageName = "Français" +[Languages.fr] +title = "Documentation du thème Hugo Relearn" +weight = 2 +languageName = "Français" - [[Languages.fr.menu.shortcuts]] - name = " Repo Github" - identifier = "ds" - url = "https://github.com/McShelby/hugo-theme-relearn" - weight = 10 +[[Languages.fr.menu.shortcuts]] +name = " Repo Github" +identifier = "ds" +url = "https://github.com/McShelby/hugo-theme-relearn" +weight = 10 - [[Languages.fr.menu.shortcuts]] - name = " Vitrine" - url = "/showcase" - weight = 11 +[[Languages.fr.menu.shortcuts]] +name = " Vitrine" +url = "/showcase" +weight = 11 - [[Languages.fr.menu.shortcuts]] - name = " Documentation Hugo" - identifier = "hugodoc" - url = "https://gohugo.io/" - weight = 20 +[[Languages.fr.menu.shortcuts]] +name = " Documentation Hugo" +identifier = "hugodoc" +url = "https://gohugo.io/" +weight = 20 - [[Languages.fr.menu.shortcuts]] - name = " Crédits" - url = "/credits" - weight = 30 +[[Languages.fr.menu.shortcuts]] +name = " Crédits" +url = "/credits" +weight = 30 +```` Read more about [hugo menu](https://gohugo.io/extras/menus/) and [hugo multilingual menus](https://gohugo.io/content-management/multilingual/#menus) \ No newline at end of file diff --git a/exampleSite/content/cont/pages/_index.en.md b/exampleSite/content/cont/pages/_index.en.md index ab6d55db66..b77fbe33c7 100644 --- a/exampleSite/content/cont/pages/_index.en.md +++ b/exampleSite/content/cont/pages/_index.en.md @@ -10,29 +10,31 @@ In **Hugo**, pages are the core of your site. Once it is configured, pages are d Organize your site like [any other Hugo project](https://gohugo.io/content/organization/). Typically, you will have a *content* folder with all your pages. - content - ├── level-one - │ ├── level-two - │ │ ├── level-three - │ │ │ ├── level-four - │ │ │ │ ├── _index.md <-- /level-one/level-two/level-three/level-four - │ │ │ │ ├── page-4-a.md <-- /level-one/level-two/level-three/level-four/page-4-a - │ │ │ │ ├── page-4-b.md <-- /level-one/level-two/level-three/level-four/page-4-b - │ │ │ │ └── page-4-c.md <-- /level-one/level-two/level-three/level-four/page-4-c - │ │ │ ├── _index.md <-- /level-one/level-two/level-three - │ │ │ ├── page-3-a.md <-- /level-one/level-two/level-three/page-3-a - │ │ │ ├── page-3-b.md <-- /level-one/level-two/level-three/page-3-b - │ │ │ └── page-3-c.md <-- /level-one/level-two/level-three/page-3-c - │ │ ├── _index.md <-- /level-one/level-two - │ │ ├── page-2-a.md <-- /level-one/level-two/page-2-a - │ │ ├── page-2-b.md <-- /level-one/level-two/page-2-b - │ │ └── page-2-c.md <-- /level-one/level-two/page-2-c - │ ├── _index.md <-- /level-one - │ ├── page-1-a.md <-- /level-one/page-1-a - │ ├── page-1-b.md <-- /level-one/page-1-b - │ └── page-1-c.md <-- /level-one/page-1-c - ├── _index.md <-- / - └── page-top.md <-- /page-top +````plaintext +content +├── level-one +│ ├── level-two +│ │ ├── level-three +│ │ │ ├── level-four +│ │ │ │ ├── _index.md <-- /level-one/level-two/level-three/level-four +│ │ │ │ ├── page-4-a.md <-- /level-one/level-two/level-three/level-four/page-4-a +│ │ │ │ ├── page-4-b.md <-- /level-one/level-two/level-three/level-four/page-4-b +│ │ │ │ └── page-4-c.md <-- /level-one/level-two/level-three/level-four/page-4-c +│ │ │ ├── _index.md <-- /level-one/level-two/level-three +│ │ │ ├── page-3-a.md <-- /level-one/level-two/level-three/page-3-a +│ │ │ ├── page-3-b.md <-- /level-one/level-two/level-three/page-3-b +│ │ │ └── page-3-c.md <-- /level-one/level-two/level-three/page-3-c +│ │ ├── _index.md <-- /level-one/level-two +│ │ ├── page-2-a.md <-- /level-one/level-two/page-2-a +│ │ ├── page-2-b.md <-- /level-one/level-two/page-2-b +│ │ └── page-2-c.md <-- /level-one/level-two/page-2-c +│ ├── _index.md <-- /level-one +│ ├── page-1-a.md <-- /level-one/page-1-a +│ ├── page-1-b.md <-- /level-one/page-1-b +│ └── page-1-c.md <-- /level-one/page-1-c +├── _index.md <-- / +└── page-top.md <-- /page-top +```` {{% notice note %}} `_index.md` is required in each folder, it’s your “folder home page” diff --git a/exampleSite/content/shortcodes/attachments.en.md b/exampleSite/content/shortcodes/attachments.en.md index 3bae776885..f27608e083 100644 --- a/exampleSite/content/shortcodes/attachments.en.md +++ b/exampleSite/content/shortcodes/attachments.en.md @@ -51,7 +51,9 @@ For example: #### List of attachments ending in pdf or mp4 - {{%/*attachments title="Related files" pattern=".*(pdf|mp4)"/*/%}} +````go +{{%/*attachments title="Related files" pattern=".*(pdf|mp4)"/*/%}} +```` renders as @@ -59,26 +61,33 @@ renders as #### Colored styled box - {{%/*attachments style="orange" /*/%}} +````go +{{%/*attachments style="orange" /*/%}} +```` renders as {{% attachments style="orange" /%}} - - {{%/*attachments style="grey" /*/%}} +````go +{{%/*attachments style="grey" /*/%}} +```` renders as {{% attachments style="grey" /%}} - {{%/*attachments style="blue" /*/%}} +````go +{{%/*attachments style="blue" /*/%}} +```` renders as {{% attachments style="blue" /%}} - {{%/*attachments style="green" /*/%}} +````go +{{%/*attachments style="green" /*/%}} +```` renders as diff --git a/exampleSite/content/shortcodes/children/_index.en.md b/exampleSite/content/shortcodes/children/_index.en.md index 17bdcfb1d1..38e832d991 100644 --- a/exampleSite/content/shortcodes/children/_index.en.md +++ b/exampleSite/content/shortcodes/children/_index.en.md @@ -18,28 +18,32 @@ Use the children shortcode to list the child pages of a page and the further des ## Demo - {{%/* children */%}} +````go +{{%/* children */%}} +```` {{% children %}} - {{%/* children description="true" */%}} +````go +{{%/* children description="true" */%}} +```` {{%children description="true" %}} - {{%/* children depth="3" showhidden="true" */%}} +````go +{{%/* children depth="3" showhidden="true" */%}} +```` {{% children depth="3" showhidden="true" %}} - {{%/* children style="h2" depth="3" description="true" */%}} +````go +{{%/* children style="h2" depth="3" description="true" */%}} +```` {{% children style="h2" depth="3" description="true" %}} - {{%/* children style="div" depth="999" */%}} +````go +{{%/* children style="div" depth="999" */%}} +```` {{% children style="div" depth="999" %}} - - - - - - diff --git a/exampleSite/content/shortcodes/tabs.en.md b/exampleSite/content/shortcodes/tabs.en.md index d50c697dc4..d71fc275b9 100644 --- a/exampleSite/content/shortcodes/tabs.en.md +++ b/exampleSite/content/shortcodes/tabs.en.md @@ -8,23 +8,25 @@ snippets for multiple languages or providing configuration in different formats. ## Code example - {{}} - {{%/* tab name="python" */%}} - ```python - print("Hello World!") - ``` - {{%/* /tab */%}} - {{%/* tab name="R" */%}} - ```R - > print("Hello World!") - ``` - {{%/* /tab */%}} - {{%/* tab name="Bash" */%}} - ```Bash - echo "Hello World!" - ``` - {{%/* /tab */%}} - {{}} +````go +{{}} +{{%/* tab name="python" */%}} +```python +print("Hello World!") +``` +{{%/* /tab */%}} +{{%/* tab name="R" */%}} +```R +> print("Hello World!") +``` +{{%/* /tab */%}} +{{%/* tab name="Bash" */%}} +```Bash +echo "Hello World!" +``` +{{%/* /tab */%}} +{{}} +```` Renders as: @@ -68,25 +70,27 @@ echo "Hello World!" ## Config example - {{}} - {{%/* tab name="json" */%}} - ```json - { - "Hello": "World" - } - ``` - {{%/* /tab */%}} - {{%/* tab name="XML" */%}} - ```xml - World - ``` - {{%/* /tab */%}} - {{%/* tab name="properties" */%}} - ```properties - Hello = World - ``` - {{%/* /tab */%}} - {{}} +````go +{{}} +{{%/* tab name="json" */%}} +```json +{ + "Hello": "World" +} +``` +{{%/* /tab */%}} +{{%/* tab name="XML" */%}} +```xml +World +``` +{{%/* /tab */%}} +{{%/* tab name="properties" */%}} +```properties +Hello = World +``` +{{%/* /tab */%}} +{{}} +```` Renders as: @@ -104,7 +108,7 @@ Renders as: ``` {{% /tab %}} {{% tab name="properties" %}} -```properties +```ini Hello = World ``` {{% /tab %}} @@ -115,5 +119,5 @@ When using tab views with different content sets, make sure to use a common `gro `groupId` for different sets. The `groupId` defaults to `'default'`. **Take this into account across the whole site!** The tab selection is restored automatically based on the `groupId` and if it cannot find a tab item because it came - from the `'default'` group on a different page then all tabs will be empty at first. +from the `'default'` group on a different page then all tabs will be empty at first. {{% /notice %}}