mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2025-02-17 09:10:08 +00:00
code highlighter: avoid unstyled blocks for indention in docs #32
This commit is contained in:
parent
b29f1ce055
commit
0d66a97284
5 changed files with 168 additions and 144 deletions
|
@ -12,35 +12,39 @@ Edit the website configuration `config.toml` and add a `[[menu.shortcuts]]` entr
|
||||||
|
|
||||||
Example from the current website:
|
Example from the current website:
|
||||||
|
|
||||||
[[menu.shortcuts]]
|
````toml
|
||||||
name = "<i class='fab fa-github'></i> Github repo"
|
[[menu.shortcuts]]
|
||||||
identifier = "ds"
|
name = "<i class='fab fa-github'></i> Github repo"
|
||||||
url = "https://github.com/McShelby/hugo-theme-relearn"
|
identifier = "ds"
|
||||||
weight = 10
|
url = "https://github.com/McShelby/hugo-theme-relearn"
|
||||||
|
weight = 10
|
||||||
|
|
||||||
[[menu.shortcuts]]
|
[[menu.shortcuts]]
|
||||||
name = "<i class='fas fa-camera'></i> Showcases"
|
name = "<i class='fas fa-camera'></i> Showcases"
|
||||||
url = "/showcase"
|
url = "/showcase"
|
||||||
weight = 11
|
weight = 11
|
||||||
|
|
||||||
[[menu.shortcuts]]
|
[[menu.shortcuts]]
|
||||||
name = "<i class='fas fa-bookmark'></i> Hugo Documentation"
|
name = "<i class='fas fa-bookmark'></i> Hugo Documentation"
|
||||||
identifier = "hugodoc"
|
identifier = "hugodoc"
|
||||||
url = "https://gohugo.io/"
|
url = "https://gohugo.io/"
|
||||||
weight = 20
|
weight = 20
|
||||||
|
|
||||||
[[menu.shortcuts]]
|
[[menu.shortcuts]]
|
||||||
name = "<i class='fas fa-bullhorn'></i> Credits"
|
name = "<i class='fas fa-bullhorn'></i> Credits"
|
||||||
url = "/credits"
|
url = "/credits"
|
||||||
weight = 30
|
weight = 30
|
||||||
|
````
|
||||||
|
|
||||||
By default, shortcuts are preceded by a title. This title can be disabled by setting `disableShortcutsTitle=true`.
|
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.
|
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
|
For example, in your local `i18n/en.toml` file, add the following content
|
||||||
|
|
||||||
[Shortcuts-Title]
|
````toml
|
||||||
other = "<Your value>"
|
[Shortcuts-Title]
|
||||||
|
other = "<Your value>"
|
||||||
|
````
|
||||||
|
|
||||||
Read more about [hugo menu](https://gohugo.io/extras/menus/) and [hugo i18n translation strings](https://gohugo.io/content-management/multilingual/#translation-of-strings)
|
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.<language-id>`.
|
When using a multilingual website, you can set different menus for each language. In the `config.toml` file, prefix your menu configuration by `Languages.<language-id>`.
|
||||||
|
|
||||||
|
|
||||||
Example from the current website:
|
Example from the current website:
|
||||||
|
|
||||||
[Languages]
|
````toml
|
||||||
[Languages.en]
|
[Languages]
|
||||||
title = "Documentation for Hugo Relearn Theme"
|
[Languages.en]
|
||||||
weight = 1
|
title = "Documentation for Hugo Relearn Theme"
|
||||||
languageName = "English"
|
weight = 1
|
||||||
|
languageName = "English"
|
||||||
|
|
||||||
[[Languages.en.menu.shortcuts]]
|
[[Languages.en.menu.shortcuts]]
|
||||||
name = "<i class='fab fa-github'></i> Github repo"
|
name = "<i class='fab fa-github'></i> Github repo"
|
||||||
identifier = "ds"
|
identifier = "ds"
|
||||||
url = "https://github.com/McShelby/hugo-theme-relearn"
|
url = "https://github.com/McShelby/hugo-theme-relearn"
|
||||||
weight = 10
|
weight = 10
|
||||||
|
|
||||||
[[Languages.en.menu.shortcuts]]
|
[[Languages.en.menu.shortcuts]]
|
||||||
name = "<i class='fas fa-camera'></i> Showcases"
|
name = "<i class='fas fa-camera'></i> Showcases"
|
||||||
url = "/showcase"
|
url = "/showcase"
|
||||||
weight = 11
|
weight = 11
|
||||||
|
|
||||||
[[Languages.en.menu.shortcuts]]
|
[[Languages.en.menu.shortcuts]]
|
||||||
name = "<i class='fas fa-bookmark'></i> Hugo Documentation"
|
name = "<i class='fas fa-bookmark'></i> Hugo Documentation"
|
||||||
identifier = "hugodoc"
|
identifier = "hugodoc"
|
||||||
url = "https://gohugo.io/"
|
url = "https://gohugo.io/"
|
||||||
weight = 20
|
weight = 20
|
||||||
|
|
||||||
[[Languages.en.menu.shortcuts]]
|
[[Languages.en.menu.shortcuts]]
|
||||||
name = "<i class='fas fa-bullhorn'></i> Credits"
|
name = "<i class='fas fa-bullhorn'></i> Credits"
|
||||||
url = "/credits"
|
url = "/credits"
|
||||||
weight = 30
|
weight = 30
|
||||||
|
|
||||||
[Languages.fr]
|
[Languages.fr]
|
||||||
title = "Documentation du thème Hugo Relearn"
|
title = "Documentation du thème Hugo Relearn"
|
||||||
weight = 2
|
weight = 2
|
||||||
languageName = "Français"
|
languageName = "Français"
|
||||||
|
|
||||||
[[Languages.fr.menu.shortcuts]]
|
[[Languages.fr.menu.shortcuts]]
|
||||||
name = "<i class='fab fa-github'></i> Repo Github"
|
name = "<i class='fab fa-github'></i> Repo Github"
|
||||||
identifier = "ds"
|
identifier = "ds"
|
||||||
url = "https://github.com/McShelby/hugo-theme-relearn"
|
url = "https://github.com/McShelby/hugo-theme-relearn"
|
||||||
weight = 10
|
weight = 10
|
||||||
|
|
||||||
[[Languages.fr.menu.shortcuts]]
|
[[Languages.fr.menu.shortcuts]]
|
||||||
name = "<i class='fas fa-camera'></i> Vitrine"
|
name = "<i class='fas fa-camera'></i> Vitrine"
|
||||||
url = "/showcase"
|
url = "/showcase"
|
||||||
weight = 11
|
weight = 11
|
||||||
|
|
||||||
[[Languages.fr.menu.shortcuts]]
|
[[Languages.fr.menu.shortcuts]]
|
||||||
name = "<i class='fas fa-bookmark'></i> Documentation Hugo"
|
name = "<i class='fas fa-bookmark'></i> Documentation Hugo"
|
||||||
identifier = "hugodoc"
|
identifier = "hugodoc"
|
||||||
url = "https://gohugo.io/"
|
url = "https://gohugo.io/"
|
||||||
weight = 20
|
weight = 20
|
||||||
|
|
||||||
[[Languages.fr.menu.shortcuts]]
|
[[Languages.fr.menu.shortcuts]]
|
||||||
name = "<i class='fas fa-bullhorn'></i> Crédits"
|
name = "<i class='fas fa-bullhorn'></i> Crédits"
|
||||||
url = "/credits"
|
url = "/credits"
|
||||||
weight = 30
|
weight = 30
|
||||||
|
````
|
||||||
|
|
||||||
Read more about [hugo menu](https://gohugo.io/extras/menus/) and [hugo multilingual menus](https://gohugo.io/content-management/multilingual/#menus)
|
Read more about [hugo menu](https://gohugo.io/extras/menus/) and [hugo multilingual menus](https://gohugo.io/content-management/multilingual/#menus)
|
|
@ -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.
|
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
|
````plaintext
|
||||||
├── level-one
|
content
|
||||||
│ ├── level-two
|
├── level-one
|
||||||
│ │ ├── level-three
|
│ ├── level-two
|
||||||
│ │ │ ├── level-four
|
│ │ ├── level-three
|
||||||
│ │ │ │ ├── _index.md <-- /level-one/level-two/level-three/level-four
|
│ │ │ ├── level-four
|
||||||
│ │ │ │ ├── page-4-a.md <-- /level-one/level-two/level-three/level-four/page-4-a
|
│ │ │ │ ├── _index.md <-- /level-one/level-two/level-three/level-four
|
||||||
│ │ │ │ ├── page-4-b.md <-- /level-one/level-two/level-three/level-four/page-4-b
|
│ │ │ │ ├── page-4-a.md <-- /level-one/level-two/level-three/level-four/page-4-a
|
||||||
│ │ │ │ └── page-4-c.md <-- /level-one/level-two/level-three/level-four/page-4-c
|
│ │ │ │ ├── page-4-b.md <-- /level-one/level-two/level-three/level-four/page-4-b
|
||||||
│ │ │ ├── _index.md <-- /level-one/level-two/level-three
|
│ │ │ │ └── page-4-c.md <-- /level-one/level-two/level-three/level-four/page-4-c
|
||||||
│ │ │ ├── page-3-a.md <-- /level-one/level-two/level-three/page-3-a
|
│ │ │ ├── _index.md <-- /level-one/level-two/level-three
|
||||||
│ │ │ ├── page-3-b.md <-- /level-one/level-two/level-three/page-3-b
|
│ │ │ ├── page-3-a.md <-- /level-one/level-two/level-three/page-3-a
|
||||||
│ │ │ └── page-3-c.md <-- /level-one/level-two/level-three/page-3-c
|
│ │ │ ├── page-3-b.md <-- /level-one/level-two/level-three/page-3-b
|
||||||
│ │ ├── _index.md <-- /level-one/level-two
|
│ │ │ └── page-3-c.md <-- /level-one/level-two/level-three/page-3-c
|
||||||
│ │ ├── page-2-a.md <-- /level-one/level-two/page-2-a
|
│ │ ├── _index.md <-- /level-one/level-two
|
||||||
│ │ ├── page-2-b.md <-- /level-one/level-two/page-2-b
|
│ │ ├── page-2-a.md <-- /level-one/level-two/page-2-a
|
||||||
│ │ └── page-2-c.md <-- /level-one/level-two/page-2-c
|
│ │ ├── page-2-b.md <-- /level-one/level-two/page-2-b
|
||||||
│ ├── _index.md <-- /level-one
|
│ │ └── page-2-c.md <-- /level-one/level-two/page-2-c
|
||||||
│ ├── page-1-a.md <-- /level-one/page-1-a
|
│ ├── _index.md <-- /level-one
|
||||||
│ ├── page-1-b.md <-- /level-one/page-1-b
|
│ ├── page-1-a.md <-- /level-one/page-1-a
|
||||||
│ └── page-1-c.md <-- /level-one/page-1-c
|
│ ├── page-1-b.md <-- /level-one/page-1-b
|
||||||
├── _index.md <-- /
|
│ └── page-1-c.md <-- /level-one/page-1-c
|
||||||
└── page-top.md <-- /page-top
|
├── _index.md <-- /
|
||||||
|
└── page-top.md <-- /page-top
|
||||||
|
````
|
||||||
|
|
||||||
{{% notice note %}}
|
{{% notice note %}}
|
||||||
`_index.md` is required in each folder, it’s your “folder home page”
|
`_index.md` is required in each folder, it’s your “folder home page”
|
||||||
|
|
|
@ -51,7 +51,9 @@ For example:
|
||||||
|
|
||||||
#### List of attachments ending in pdf or mp4
|
#### 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
|
renders as
|
||||||
|
|
||||||
|
@ -59,26 +61,33 @@ renders as
|
||||||
|
|
||||||
#### Colored styled box
|
#### Colored styled box
|
||||||
|
|
||||||
{{%/*attachments style="orange" /*/%}}
|
````go
|
||||||
|
{{%/*attachments style="orange" /*/%}}
|
||||||
|
````
|
||||||
|
|
||||||
renders as
|
renders as
|
||||||
|
|
||||||
{{% attachments style="orange" /%}}
|
{{% attachments style="orange" /%}}
|
||||||
|
|
||||||
|
````go
|
||||||
{{%/*attachments style="grey" /*/%}}
|
{{%/*attachments style="grey" /*/%}}
|
||||||
|
````
|
||||||
|
|
||||||
renders as
|
renders as
|
||||||
|
|
||||||
{{% attachments style="grey" /%}}
|
{{% attachments style="grey" /%}}
|
||||||
|
|
||||||
{{%/*attachments style="blue" /*/%}}
|
````go
|
||||||
|
{{%/*attachments style="blue" /*/%}}
|
||||||
|
````
|
||||||
|
|
||||||
renders as
|
renders as
|
||||||
|
|
||||||
{{% attachments style="blue" /%}}
|
{{% attachments style="blue" /%}}
|
||||||
|
|
||||||
{{%/*attachments style="green" /*/%}}
|
````go
|
||||||
|
{{%/*attachments style="green" /*/%}}
|
||||||
|
````
|
||||||
|
|
||||||
renders as
|
renders as
|
||||||
|
|
||||||
|
|
|
@ -18,28 +18,32 @@ Use the children shortcode to list the child pages of a page and the further des
|
||||||
|
|
||||||
## Demo
|
## Demo
|
||||||
|
|
||||||
{{%/* children */%}}
|
````go
|
||||||
|
{{%/* children */%}}
|
||||||
|
````
|
||||||
|
|
||||||
{{% children %}}
|
{{% children %}}
|
||||||
|
|
||||||
{{%/* children description="true" */%}}
|
````go
|
||||||
|
{{%/* children description="true" */%}}
|
||||||
|
````
|
||||||
|
|
||||||
{{%children description="true" %}}
|
{{%children description="true" %}}
|
||||||
|
|
||||||
{{%/* children depth="3" showhidden="true" */%}}
|
````go
|
||||||
|
{{%/* children depth="3" showhidden="true" */%}}
|
||||||
|
````
|
||||||
|
|
||||||
{{% 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="h2" depth="3" description="true" %}}
|
||||||
|
|
||||||
{{%/* children style="div" depth="999" */%}}
|
````go
|
||||||
|
{{%/* children style="div" depth="999" */%}}
|
||||||
|
````
|
||||||
|
|
||||||
{{% children style="div" depth="999" %}}
|
{{% children style="div" depth="999" %}}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,23 +8,25 @@ snippets for multiple languages or providing configuration in different formats.
|
||||||
|
|
||||||
## Code example
|
## Code example
|
||||||
|
|
||||||
{{</* tabs */>}}
|
````go
|
||||||
{{%/* tab name="python" */%}}
|
{{</* tabs */>}}
|
||||||
```python
|
{{%/* tab name="python" */%}}
|
||||||
print("Hello World!")
|
```python
|
||||||
```
|
print("Hello World!")
|
||||||
{{%/* /tab */%}}
|
```
|
||||||
{{%/* tab name="R" */%}}
|
{{%/* /tab */%}}
|
||||||
```R
|
{{%/* tab name="R" */%}}
|
||||||
> print("Hello World!")
|
```R
|
||||||
```
|
> print("Hello World!")
|
||||||
{{%/* /tab */%}}
|
```
|
||||||
{{%/* tab name="Bash" */%}}
|
{{%/* /tab */%}}
|
||||||
```Bash
|
{{%/* tab name="Bash" */%}}
|
||||||
echo "Hello World!"
|
```Bash
|
||||||
```
|
echo "Hello World!"
|
||||||
{{%/* /tab */%}}
|
```
|
||||||
{{</* /tabs */>}}
|
{{%/* /tab */%}}
|
||||||
|
{{</* /tabs */>}}
|
||||||
|
````
|
||||||
|
|
||||||
Renders as:
|
Renders as:
|
||||||
|
|
||||||
|
@ -68,25 +70,27 @@ echo "Hello World!"
|
||||||
|
|
||||||
## Config example
|
## Config example
|
||||||
|
|
||||||
{{</* tabs groupId="config" */>}}
|
````go
|
||||||
{{%/* tab name="json" */%}}
|
{{</* tabs groupId="config" */>}}
|
||||||
```json
|
{{%/* tab name="json" */%}}
|
||||||
{
|
```json
|
||||||
"Hello": "World"
|
{
|
||||||
}
|
"Hello": "World"
|
||||||
```
|
}
|
||||||
{{%/* /tab */%}}
|
```
|
||||||
{{%/* tab name="XML" */%}}
|
{{%/* /tab */%}}
|
||||||
```xml
|
{{%/* tab name="XML" */%}}
|
||||||
<Hello>World</Hello>
|
```xml
|
||||||
```
|
<Hello>World</Hello>
|
||||||
{{%/* /tab */%}}
|
```
|
||||||
{{%/* tab name="properties" */%}}
|
{{%/* /tab */%}}
|
||||||
```properties
|
{{%/* tab name="properties" */%}}
|
||||||
Hello = World
|
```properties
|
||||||
```
|
Hello = World
|
||||||
{{%/* /tab */%}}
|
```
|
||||||
{{</* /tabs */>}}
|
{{%/* /tab */%}}
|
||||||
|
{{</* /tabs */>}}
|
||||||
|
````
|
||||||
|
|
||||||
Renders as:
|
Renders as:
|
||||||
|
|
||||||
|
@ -104,7 +108,7 @@ Renders as:
|
||||||
```
|
```
|
||||||
{{% /tab %}}
|
{{% /tab %}}
|
||||||
{{% tab name="properties" %}}
|
{{% tab name="properties" %}}
|
||||||
```properties
|
```ini
|
||||||
Hello = World
|
Hello = World
|
||||||
```
|
```
|
||||||
{{% /tab %}}
|
{{% /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'`.
|
`groupId` for different sets. The `groupId` defaults to `'default'`.
|
||||||
**Take this into account across the whole site!**
|
**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
|
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 %}}
|
{{% /notice %}}
|
||||||
|
|
Loading…
Add table
Reference in a new issue