Fello' pirrates, be awarrre some featurrres may not work fer us in this trrranslat'n. Like table of rrramblings, some Merrrmaids and stuff.
Chapter 3
Shorrrtcodes
Cap'n Hugo uses Marrrkdown fer its simple rrrambl'n format. However, there be a lot o' th'ns that Marrrkdown doesn’t support well. Ye could use pure HTML t' expand possibilities.
But this happens t' be a bad idea. Everyone uses Marrrkdown because it’s pure an' simple t' read even non-rendered. Ye should avoid HTML t' keep it as simple as poss'ble.
T' avoid this limitat'ns, Cap'n Hugo created shorrrtcodes. A shorrrtcode be a simple snippet inside a plank.
Th' Relearrrn theme provides multiple shorrrtcodes on top o' exist'n ones.
Th' shortcurt lists files found 'n a specific folder.
{{%attachments/%}}
Currently, it support two implementat'ns fer planks
If yer plank be a Marrrkdown file, attachements must be placed 'n a folder named like yer plank an' end'n wit' .files.
rrrambl'n
_index.md
plank.files
attachment.pdf
plank.md
If yer plank be a folder, attachements must be placed 'n a nested ‘files’ folder.
rrrambl'n
_index.md
plank
index.md
files
attachment.pdf
Be aware that if ye use a multilingual website, ye will need t' have as many folders as languages.
Parameter
Name
Optional
Default
Notes
style
yes
transparent
Th' color scheme used t' highlight th' box rrrambl'n.
- by severity: info, note, tip, warning - by brand color: primary, secondary - by color: blue, green, grey, orange, red - by special color: default, transparent
title
yes
see notes
Arbitray text fer th' box title. Depend'n on th' style there may be a default title. Any given value will overwrite th' default.
- fer severity styles: th' match'n title fer th' severity - fer all other colors: Attachments
If ye want no title, ye have t' set this parameter t' " " (a non empty str'n filled wit' spaces)
ay'con
yes
see notes
Font Awesome ay'con name set t' th' left o' th' title. Depend'n on th' style there may be a default ay'con. Any given value will overwrite th' default.
- fer severity styles: a nice match'n ay'con fer th' severity - fer all other colors: paperclip
If ye want no ay'con, ye have t' set this parameter t' " " (a non empty str'n filled wit' spaces)
sort
yes
asc
Sort'n th' output 'n ascend'n or descend'n order.
pattern
yes
.*
A regular expressions, used t' filter th' attachments by file name. For example:
- t' match a file suffix o' ‘jpg’, use .*jpg (not *.jpg) - t' match file names end'n 'n jpg or png, use .*(jpg|png)
Examples
Custom title, list o' attachments end'n 'n pdf or mp4
For further examples fer style, title an' ay'con, see th' notice shorrrtcode documentat'n. Th' parameter be work'n th' same way fer both shorrrtcodes, besides hav'n different defaults.
Button
Arrr! ☠ Pirrrates ☠
Fello' pirrates, be awarrre some featurrres may not work fer us in this trrranslat'n. Like table of rrramblings, some Merrrmaids and stuff.
A button be a just a click'ble button wit' optional ay'con.
Fello' pirrates, be awarrre some featurrres may not work fer us in this trrranslat'n. Like table of rrramblings, some Merrrmaids and stuff.
Use th' children shorrrtcode t' list th' child planks o' a plank an' th' further descendants (children’s children). By default, th' shorrrtcode displays links t' th' child planks.
Usage
Parameter
Default
Descript'n
plank
current
Specify th' plank name (section name) t' display children fer
containerstyle
“ul”
Choose th' style used t' group all children. It could be any HTML tag name
style
“li”
Choose th' style used t' display each descendant. It could be any HTML tag name
showhidden
“false”
When true, child planks hidden from th' menu will be displayed
descript'n
“false”
Allows ye t' include a short text under each plank 'n th' list. When no descript'n exists fer th' plank, children shorrrtcode takes th' first 70 words o' yer rrrambl'n. Read more info about summaries on gohugo.io
depth
1
Enter a number t' specify th' depth o' descendants t' display. For example, if th' value be 2, th' shorrrtcode will display 2 levels o' child planks. Tips: set 999 t' get all descendants
Sort children by weight, t' sort on menu order - title, t' sort alphabetically on menu label. If not set it be sorted by th' ordersectionsby sett'n o' th' ship an' th' planks frontmatter
{{%expand"Show me almost endless possibilities"%}}Someexpand'bletext.Yecanaddstandardmarkdownrules:-multipleparagraphs-bulletpointlists-_emphasized_,**bold**an'even**_boldemphasized_**text-[links](https://example.com)
-etc.```plaintext
...and even source code
```>th'possiblitiesbeendless(almost-includ'nothershorrrtcodesmayormaynotwork){{%/expand%}}
Include
Arrr! ☠ Pirrrates ☠
Fello' pirrates, be awarrre some featurrres may not work fer us in this trrranslat'n. Like table of rrramblings, some Merrrmaids and stuff.
Th' include shorrrtcode includes other files from yer project inside o' th' current file. This can even contain Marrrkdown an' will be taken into account when generat'n th' t'ble o' contents.
Usage
{{%include<str'n>["true"|"false"]%}}
Th' first required parameter be th' path t' th' file t' be included.
If th' file’s rrrambl'n will be displayed as HTML, th' second optional parameter controls if th' first head'n o' th' included file should be displayed ("true")- which be th' default - or be hidden.
Fello' pirrates, be awarrre some featurrres may not work fer us in this trrranslat'n. Like table of rrramblings, some Merrrmaids and stuff.
Merrrmaid be a library help'n ye t' generate diagram an' flowcharts from text, 'n a similar manner as Marrrkdown.
Avast
This only works 'n modern browsers.
Arrr
Due t' limitat'ns wit' Merrrmaid, it be currently not poss'ble t' use Merrrmaid code fences 'n an initially collapsed expand shorrrtcode. This be a know issue an' can’t be fixed by this theme.
Usage
Just insert yer Merrrmaid code 'n th' mermaid shorrrtcode like this:
Ye can set an optional align attribute which defaults t' "center".
If ye don’t need alignment ye can use th' alternative rules us'n code fences if ye have turned off guessSyntax fer th' marrrkup.highlight sett'n (see below):
```mermaid
classDiagram
Person *-- Dog
```
Th' generated graphs can be be panned by dragg'n them an' zoomed by us'n th' mousewheel. On mobile devices ye can use finger gestures.
Examples
Flowchart
%%{init:{"theme":"forest"}}%%
graph LR;
A[Hard edge] -->|Link text| B(Round edge)
B --> C{Decision}
C -->|One| D[Result one]
C -->|Two| E[Result two]
sequenceDiagram
participant Alice
participant Bob
Alice->>John: Hello John, how be ye?
loop Healthcheck
John->John: Fight against hypochondria
end
Note right of John: Rational thoughts prevail...
John-->Alice: Great!
John->Bob: How about ye?
Bob-->John: Jolly bloody!
stateDiagram-v2
open: Open Door
closed: Closed Door
locked: Locked Door
open --> closed: Close
closed --> locked: Lock
locked --> closed: Unlock
closed --> open: Open
```mermaid
stateDiagram-v2
open: Open Door
closed: Closed Door
locked: Locked Door
open --> closed: Close
closed --> locked: Lock
locked --> closed: Unlock
closed --> open: Open
```
Configurat'n
Merrrmaid be configured wit' default sett'ns. Ye can cust'mize Mermaid’s default sett'ns fer all o' yer files thru a JSON object 'n yer config.toml, override these sett'ns per plank thru yer planks frontmatter or override these sett'n per diagramm thru diagram directives.
Th' JSON object o' yer config.toml / frontmatter be forwarded into Mermaid’s mermaid.initialize() funct'n.
Th' theme sett'n can also be set by yer used color variant. This will be th' sitewide default an' can - again - be overridden by yer sett'ns 'n config.toml, frontmatter or diagram directives.
Avast
If ye want t' use mermaid codefences, ye have t' turn off guessSyntax fer th' marrrkup.highlight sett'n.
Example
[params]mermaidInitialize="{ \"theme\": \"dark\" }"[marrrkup][marrrkup.highlight]# if set t' `guessSyntax = true`, there will be no unstyled code even if no language# was given BUT mermaid code fences will not work anymore! So this be a mandatory# sett'n fer yer shipguessSyntax=false
or planks frontmatter
+++mermaidInitialize="{ \"theme\": \"dark\" }"+++
Notice
Arrr! ☠ Pirrrates ☠
Fello' pirrates, be awarrre some featurrres may not work fer us in this trrranslat'n. Like table of rrramblings, some Merrrmaids and stuff.
Th' notice shorrrtcode shows various types o' disclaimers wit' adjust'ble title an' ay'con t' help ye structure yer plank.
There may be pirates
It be all about th' boxes.
Usage
While th' examples be us'n named parameter ye be free t' use positional aswell.
{{%noticestyle="primary"title="There may be pirates"ay'con="skull-crossbones"%}}Itbeallaboutth'boxes.{{%/notice%}}
{{%noticeprimary"There may be pirates""skull-crossbones"%}}Itbeallaboutth'boxes.{{%/notice%}}
Parameter
Name
Posit'n
Optional
Default
Notes
style
1
yes
default
Th' color scheme used t' highlight th' box rrrambl'n.
- by severity: info, note, tip, warning - by brand color: primary, secondary - by color: blue, green, grey, orange, red - by special color: default, transparent
title
2
yes
see notes
Arbitray text fer th' box title. Depend'n on th' style there may be a default title. Any given value will overwrite th' default.
- fer severity styles: th' match'n title fer th' severity - fer all other colors: no title
If ye want no title fer a severity style, ye have t' set this parameter t' " " (a non empty str'n filled wit' spaces)
ay'con
3
yes
see notes
Font Awesome ay'con name set t' th' left o' th' title. Depend'n on th' style there may be a default ay'con. Any given value will overwrite th' default.
- fer severity styles: a nice match'n ay'con fer th' severity - fer all other colors: no ay'con
If ye want no ay'con fer a severity style, ye have t' set this parameter t' " " (a non empty str'n filled wit' spaces)
Fello' pirrates, be awarrre some featurrres may not work fer us in this trrranslat'n. Like table of rrramblings, some Merrrmaids and stuff.
This shorrrtcode uses th' RapiDoc library t' display yer OpenAPI Specificat'ns.
Avast
This only works 'n modern browsers.
Configurat'n
Swagger be configured wit' default sett'ns. Ye can cust'mize Swagger’s default sett'ns fer all o' yer files thru a JSON object 'n yer config.toml or override these sett'ns per plank thru yer planks frontmatter.
Th' JSON object o' yer config.toml / frontmatter be forwarded into Swagger’s initializat'n. At th' moment, only th' theme sett'n be supported.
Th' theme sett'n can also be set by yer used color variant. This will be th' sitewide default an' can - again - be overridden by yer sett'ns 'n config.toml or frontmatter.
If yer plank be a leaf or branch bundle, ye can also use relative URLs:
{{<swaggersrc="petstore.json">}}
Th' src parameter be mandatory an' can be either an absolute or a relative URL.
Example
Tabbed views
Arrr! ☠ Pirrrates ☠
Fello' pirrates, be awarrre some featurrres may not work fer us in this trrranslat'n. Like table of rrramblings, some Merrrmaids and stuff.
Choose which rrrambl'n t' see across th' plank. Very handy fer provid'n code
snippets fer multiple languages or provid'n configurat'n 'n different formats.
When us'n tab views wit' different rrrambl'n sets, make sure t' use a common groupId fer equal sets but distinct
groupId fer different sets. Th' groupId defaults t' 'default'.
Take this into account across th' whole ship!
Th' tab select'n be restored automatically based on th' groupId an' if it cannot find a tab item because it came
from th' 'default' group on a different plank then all tabs will be empty at first.