]> git.maquefel.me Git - brevno-suite/hugo/commitdiff
docs: Add basic doc for wrapStandAloneImageWithinParagraph etc.
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Mon, 5 Dec 2022 15:50:47 +0000 (16:50 +0100)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Mon, 5 Dec 2022 15:50:47 +0000 (16:50 +0100)
See #10492

docs/content/en/templates/render-hooks.md
docs/data/docs.json

index 6fae36ad93d03dc78dd9d87507ed1318a97600d5..69b34cc9b97e45e93bb1103bdd96a486a306c002 100644 (file)
@@ -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
 
index 1ec6ea29e1fc67e79409385d2c8bd119d5e6f359..5a6b1722d3943dfd61742aa00b6b5ff26233f640 100644 (file)
           "attribute": {
             "title": true,
             "block": false
-          }
+          },
+          "wrapStandAloneImageWithinParagraph": true
         },
         "extensions": {
           "typographer": true,
       },
       "funcs": {
         "getenv": [
-          "^HUGO_"
+          "^HUGO_",
+          "^CI$"
         ]
       },
       "http": {
           ],
           "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]"
             ]
           ]
               "[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!]"
             ]
           ]
           "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}"
             ]
           ]
           ],
           "Examples": [
             [
-              "{{add 1 2}}",
+              "{{ add 1 2 }}",
               "3"
             ]
           ]
           "Aliases": null,
           "Examples": [
             [
-              "{{math.Ceil 2.1}}",
+              "{{ math.Ceil 2.1 }}",
               "3"
             ]
           ]
           ],
           "Examples": [
             [
-              "{{div 6 3}}",
+              "{{ div 6 3 }}",
               "2"
             ]
           ]
           "Aliases": null,
           "Examples": [
             [
-              "{{math.Floor 1.9}}",
+              "{{ math.Floor 1.9 }}",
               "1"
             ]
           ]
           "Aliases": null,
           "Examples": [
             [
-              "{{math.Log 1}}",
+              "{{ math.Log 1 }}",
               "0"
             ]
           ]
           "Aliases": null,
           "Examples": [
             [
-              "{{math.Max 1 2 }}",
+              "{{ math.Max 1 2 }}",
               "2"
             ]
           ]
           "Aliases": null,
           "Examples": [
             [
-              "{{math.Min 1 2 }}",
+              "{{ math.Min 1 2 }}",
               "1"
             ]
           ]
           ],
           "Examples": [
             [
-              "{{mod 15 3}}",
+              "{{ mod 15 3 }}",
               "0"
             ]
           ]
           ],
           "Examples": [
             [
-              "{{modBool 15 3}}",
+              "{{ modBool 15 3 }}",
               "true"
             ]
           ]
           ],
           "Examples": [
             [
-              "{{mul 2 3}}",
+              "{{ mul 2 3 }}",
               "6"
             ]
           ]
           ],
           "Examples": [
             [
-              "{{math.Pow 2 3}}",
+              "{{ math.Pow 2 3 }}",
               "8"
             ]
           ]
           "Aliases": null,
           "Examples": [
             [
-              "{{math.Round 1.5}}",
+              "{{ math.Round 1.5 }}",
               "2"
             ]
           ]
           "Aliases": null,
           "Examples": [
             [
-              "{{math.Sqrt 81}}",
+              "{{ math.Sqrt 81 }}",
               "9"
             ]
           ]
           ],
           "Examples": [
             [
-              "{{sub 3 2}}",
+              "{{ sub 3 2 }}",
               "1"
             ]
           ]
           "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"
             ]
           ]
           ],
           "Examples": [
             [
-              "{{chomp \"\u003cp\u003eBlockhead\u003c/p\u003e\\n\" | safeHTML }}",
+              "{{ chomp \"\u003cp\u003eBlockhead\u003c/p\u003e\\n\" | safeHTML }}",
               "\u003cp\u003eBlockhead\u003c/p\u003e"
             ]
           ]
           "Aliases": null,
           "Examples": [
             [
-              "{{\"aabab\" | strings.Count \"a\" }}",
+              "{{ \"aabab\" | strings.Count \"a\" }}",
               "3"
             ]
           ]
           ],
           "Examples": [
             [
-              "{{slicestr \"BatMan\" 0 3}}",
+              "{{ slicestr \"BatMan\" 0 3 }}",
               "Bat"
             ],
             [
-              "{{slicestr \"BatMan\" 3}}",
+              "{{ slicestr \"BatMan\" 3 }}",
               "Man"
             ]
           ]
           ],
           "Examples": [
             [
-              "{{substr \"BatMan\" 0 -3}}",
+              "{{ substr \"BatMan\" 0 -3 }}",
               "Bat"
             ],
             [
-              "{{substr \"BatMan\" 3 3}}",
+              "{{ substr \"BatMan\" 3 3 }}",
               "Man"
             ]
           ]
           ],
           "Examples": [
             [
-              "{{title \"Bat man\"}}",
+              "{{ title \"Bat man\" }}",
               "Bat Man"
             ],
             [
-              "{{title \"somewhere over the rainbow\"}}",
+              "{{ title \"somewhere over the rainbow\" }}",
               "Somewhere Over the Rainbow"
             ]
           ]
           ],
           "Examples": [
             [
-              "{{lower \"BatMan\"}}",
+              "{{ lower \"BatMan\" }}",
               "batman"
             ]
           ]
           ],
           "Examples": [
             [
-              "{{upper \"BatMan\"}}",
+              "{{ upper \"BatMan\" }}",
               "BATMAN"
             ]
           ]
           ],
           "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;"
             ],
             [
           ],
           "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;"
             ],
             [
           ],
           "Examples": [
             [
-              "{{ .Title | markdownify}}",
+              "{{ .Title | markdownify }}",
               "\u003cstrong\u003eBatMan\u003c/strong\u003e"
             ]
           ]