Skip to content

Commit

Permalink
docs: Add basic doc for wrapStandAloneImageWithinParagraph etc.
Browse files Browse the repository at this point in the history
See #10492
  • Loading branch information
bep committed Dec 5, 2022
1 parent ba07bd9 commit 12b59a4
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 42 deletions.
11 changes: 10 additions & 1 deletion content/en/templates/render-hooks.md
Expand Up @@ -84,7 +84,16 @@ PlainText
: The plain variant of the above.

Attributes (map)
: A map of attributes (e.g. `id`, `class`)
: A map of attributes (e.g. `id`, `class`). Note that this will currently always be empty for links.

The `render-image` templates will also receive:

IsBlock {{< new-in "0.108.0" >}}
: Returns true if this is a standalone image and the config option [markup.goldmark.parser.wrapStandAloneImageWithinParagraph](/getting-started/configuration-markup/#goldmark) is disabled.

Ordinal {{< new-in "0.108.0" >}}
: Zero-based ordinal for all the images in the current document.


### Link with title Markdown example

Expand Down
84 changes: 43 additions & 41 deletions data/docs.json
Expand Up @@ -1572,7 +1572,8 @@
"attribute": {
"title": true,
"block": false
}
},
"wrapStandAloneImageWithinParagraph": true
},
"extensions": {
"typographer": true,
Expand Down Expand Up @@ -1722,7 +1723,8 @@
},
"funcs": {
"getenv": [
"^HUGO_"
"^HUGO_",
"^CI$"
]
},
"http": {
Expand Down Expand Up @@ -3195,7 +3197,7 @@
],
"Examples": [
[
"{{ slice \"a\" \"b\" \"c\" \"d\" \"e\" \"f\" | complement (slice \"b\" \"c\") (slice \"d\" \"e\") }}",
"{{ slice \"a\" \"b\" \"c\" \"d\" \"e\" \"f\" | complement (slice \"b\" \"c\") (slice \"d\" \"e\") }}",
"[a f]"
]
]
Expand Down Expand Up @@ -3356,11 +3358,11 @@
"[Yes, Hugo Rocks! Hugo Rocks!]"
],
[
"{{ merge (dict \"title\" \"Default Title\" \"description\" \"Yes, Hugo Rocks!\") (dict \"title\" \"Hugo Rocks!\") | sort }}",
"{{ merge (dict \"title\" \"Default Title\" \"description\" \"Yes, Hugo Rocks!\") (dict \"title\" \"Hugo Rocks!\") | sort }}",
"[Yes, Hugo Rocks! Hugo Rocks!]"
],
[
"{{ merge (dict \"title\" \"Default Title\" \"description\" \"Yes, Hugo Rocks!\") (dict \"title\" \"Hugo Rocks!\") (dict \"extra\" \"For reals!\") | sort }}",
"{{ merge (dict \"title\" \"Default Title\" \"description\" \"Yes, Hugo Rocks!\") (dict \"title\" \"Hugo Rocks!\") (dict \"extra\" \"For reals!\") | sort }}",
"[Yes, Hugo Rocks! For reals! Hugo Rocks!]"
]
]
Expand Down Expand Up @@ -3632,7 +3634,7 @@
"Aliases": null,
"Examples": [
[
"{{- $m := newScratch -}}\n{{- $m.Set \"Hugo\" \"Rocks!\" -}}\n{{- $m.Values | debug.Dump | safeHTML -}}",
"{{ $m := newScratch }}\n{{ $m.Set \"Hugo\" \"Rocks!\" }}\n{{ $m.Values | debug.Dump | safeHTML }}",
"map[string]interface {}{\n \"Hugo\": \"Rocks!\",\n}"
]
]
Expand Down Expand Up @@ -4138,7 +4140,7 @@
],
"Examples": [
[
"{{add 1 2}}",
"{{ add 1 2 }}",
"3"
]
]
Expand All @@ -4151,7 +4153,7 @@
"Aliases": null,
"Examples": [
[
"{{math.Ceil 2.1}}",
"{{ math.Ceil 2.1 }}",
"3"
]
]
Expand All @@ -4173,7 +4175,7 @@
],
"Examples": [
[
"{{div 6 3}}",
"{{ div 6 3 }}",
"2"
]
]
Expand All @@ -4186,7 +4188,7 @@
"Aliases": null,
"Examples": [
[
"{{math.Floor 1.9}}",
"{{ math.Floor 1.9 }}",
"1"
]
]
Expand All @@ -4199,7 +4201,7 @@
"Aliases": null,
"Examples": [
[
"{{math.Log 1}}",
"{{ math.Log 1 }}",
"0"
]
]
Expand All @@ -4213,7 +4215,7 @@
"Aliases": null,
"Examples": [
[
"{{math.Max 1 2 }}",
"{{ math.Max 1 2 }}",
"2"
]
]
Expand All @@ -4227,7 +4229,7 @@
"Aliases": null,
"Examples": [
[
"{{math.Min 1 2 }}",
"{{ math.Min 1 2 }}",
"1"
]
]
Expand All @@ -4243,7 +4245,7 @@
],
"Examples": [
[
"{{mod 15 3}}",
"{{ mod 15 3 }}",
"0"
]
]
Expand All @@ -4259,7 +4261,7 @@
],
"Examples": [
[
"{{modBool 15 3}}",
"{{ modBool 15 3 }}",
"true"
]
]
Expand All @@ -4275,7 +4277,7 @@
],
"Examples": [
[
"{{mul 2 3}}",
"{{ mul 2 3 }}",
"6"
]
]
Expand All @@ -4291,7 +4293,7 @@
],
"Examples": [
[
"{{math.Pow 2 3}}",
"{{ math.Pow 2 3 }}",
"8"
]
]
Expand All @@ -4304,7 +4306,7 @@
"Aliases": null,
"Examples": [
[
"{{math.Round 1.5}}",
"{{ math.Round 1.5 }}",
"2"
]
]
Expand All @@ -4317,7 +4319,7 @@
"Aliases": null,
"Examples": [
[
"{{math.Sqrt 81}}",
"{{ math.Sqrt 81 }}",
"9"
]
]
Expand All @@ -4333,7 +4335,7 @@
],
"Examples": [
[
"{{sub 3 2}}",
"{{ sub 3 2 }}",
"1"
]
]
Expand Down Expand Up @@ -4481,23 +4483,23 @@
"Aliases": null,
"Examples": [
[
"{{ slice \"my/path\" \"filename.txt\" | path.Join }}",
"{{ slice \"my/path\" \"filename.txt\" | path.Join }}",
"my/path/filename.txt"
],
[
"{{ path.Join \"my\" \"path\" \"filename.txt\" }}",
"{{ path.Join \"my\" \"path\" \"filename.txt\" }}",
"my/path/filename.txt"
],
[
"{{ \"my/path/filename.txt\" | path.Ext }}",
"{{ \"my/path/filename.txt\" | path.Ext }}",
".txt"
],
[
"{{ \"my/path/filename.txt\" | path.Base }}",
"{{ \"my/path/filename.txt\" | path.Base }}",
"filename.txt"
],
[
"{{ \"my/path/filename.txt\" | path.Dir }}",
"{{ \"my/path/filename.txt\" | path.Dir }}",
"my/path"
]
]
Expand Down Expand Up @@ -4870,7 +4872,7 @@
],
"Examples": [
[
"{{chomp \"\u003cp\u003eBlockhead\u003c/p\u003e\\n\" | safeHTML }}",
"{{ chomp \"\u003cp\u003eBlockhead\u003c/p\u003e\\n\" | safeHTML }}",
"\u003cp\u003eBlockhead\u003c/p\u003e"
]
]
Expand Down Expand Up @@ -4920,7 +4922,7 @@
"Aliases": null,
"Examples": [
[
"{{\"aabab\" | strings.Count \"a\" }}",
"{{ \"aabab\" | strings.Count \"a\" }}",
"3"
]
]
Expand Down Expand Up @@ -5078,11 +5080,11 @@
],
"Examples": [
[
"{{slicestr \"BatMan\" 0 3}}",
"{{ slicestr \"BatMan\" 0 3 }}",
"Bat"
],
[
"{{slicestr \"BatMan\" 3}}",
"{{ slicestr \"BatMan\" 3 }}",
"Man"
]
]
Expand All @@ -5109,11 +5111,11 @@
],
"Examples": [
[
"{{substr \"BatMan\" 0 -3}}",
"{{ substr \"BatMan\" 0 -3 }}",
"Bat"
],
[
"{{substr \"BatMan\" 3 3}}",
"{{ substr \"BatMan\" 3 3 }}",
"Man"
]
]
Expand All @@ -5128,11 +5130,11 @@
],
"Examples": [
[
"{{title \"Bat man\"}}",
"{{ title \"Bat man\" }}",
"Bat Man"
],
[
"{{title \"somewhere over the rainbow\"}}",
"{{ title \"somewhere over the rainbow\" }}",
"Somewhere Over the Rainbow"
]
]
Expand All @@ -5147,7 +5149,7 @@
],
"Examples": [
[
"{{lower \"BatMan\"}}",
"{{ lower \"BatMan\" }}",
"batman"
]
]
Expand All @@ -5162,7 +5164,7 @@
],
"Examples": [
[
"{{upper \"BatMan\"}}",
"{{ upper \"BatMan\" }}",
"BATMAN"
]
]
Expand Down Expand Up @@ -5388,11 +5390,11 @@
],
"Examples": [
[
"{{ htmlEscape \"Cathal Garvey \u0026 The Sunshine Band \u003ccathal@foo.bar\u003e\" | safeHTML}}",
"{{ htmlEscape \"Cathal Garvey \u0026 The Sunshine Band \u003ccathal@foo.bar\u003e\" | safeHTML }}",
"Cathal Garvey \u0026amp; The Sunshine Band \u0026lt;cathal@foo.bar\u0026gt;"
],
[
"{{ htmlEscape \"Cathal Garvey \u0026 The Sunshine Band \u003ccathal@foo.bar\u003e\"}}",
"{{ htmlEscape \"Cathal Garvey \u0026 The Sunshine Band \u003ccathal@foo.bar\u003e\" }}",
"Cathal Garvey \u0026amp;amp; The Sunshine Band \u0026amp;lt;cathal@foo.bar\u0026amp;gt;"
],
[
Expand All @@ -5411,15 +5413,15 @@
],
"Examples": [
[
"{{ htmlUnescape \"Cathal Garvey \u0026amp; The Sunshine Band \u0026lt;cathal@foo.bar\u0026gt;\" | safeHTML}}",
"{{ htmlUnescape \"Cathal Garvey \u0026amp; The Sunshine Band \u0026lt;cathal@foo.bar\u0026gt;\" | safeHTML }}",
"Cathal Garvey \u0026 The Sunshine Band \u003ccathal@foo.bar\u003e"
],
[
"{{\"Cathal Garvey \u0026amp;amp; The Sunshine Band \u0026amp;lt;cathal@foo.bar\u0026amp;gt;\" | htmlUnescape | htmlUnescape | safeHTML}}",
"{{ \"Cathal Garvey \u0026amp;amp; The Sunshine Band \u0026amp;lt;cathal@foo.bar\u0026amp;gt;\" | htmlUnescape | htmlUnescape | safeHTML }}",
"Cathal Garvey \u0026 The Sunshine Band \u003ccathal@foo.bar\u003e"
],
[
"{{\"Cathal Garvey \u0026amp;amp; The Sunshine Band \u0026amp;lt;cathal@foo.bar\u0026amp;gt;\" | htmlUnescape | htmlUnescape }}",
"{{ \"Cathal Garvey \u0026amp;amp; The Sunshine Band \u0026amp;lt;cathal@foo.bar\u0026amp;gt;\" | htmlUnescape | htmlUnescape }}",
"Cathal Garvey \u0026amp; The Sunshine Band \u0026lt;cathal@foo.bar\u0026gt;"
],
[
Expand Down Expand Up @@ -5456,7 +5458,7 @@
],
"Examples": [
[
"{{ .Title | markdownify}}",
"{{ .Title | markdownify }}",
"\u003cstrong\u003eBatMan\u003c/strong\u003e"
]
]
Expand Down

0 comments on commit 12b59a4

Please sign in to comment.