v0.108.0
With Hugo v0.108.0
you can render standalone Markdown images without a surrounding paragraph. Both the HTML- and CommonMark-specification defines image as an inline element. For Markdown, this has meant that if you put an image on its own (not inlined in another paragraph), it would be wrapped in <p></p>
tags, even if you provide your own Render Hook Template.
Now you can get by this annoyance by setting markup.goldmark.parser.wrapStandAloneImageWithinParagraph = false
[markup]
[markup.goldmark]
[markup.goldmark.parser]
wrapStandAloneImageWithinParagraph = false
[markup.goldmark.parser.attribute]
block = true
In the above we have also enabled attribute support for Markdown blocks to illustrate another nice side effect of this; it's now possible to use Markdown attributes (e.g. CSS classes) on standalone images:
This is an inline image: ![Inline Image](/inline.jpg). Some more text.
![Block Image](/block.jpg)
{.blue}
The images in the above Markdown example would, given the hook template below, be rendered wrapped in a figure
element with the blue
CSS class applied in the latter example.
Two new fields are added to the render context passed to image render hooks:
IsBlock
: Returns true if this is a standalone image and the config option markup.goldmark.parser.wrapStandAloneImageWithinParagraph is disabled.Ordinal
: Zero-based ordinal for all the images in the current document.
Bug fixes
- common/hugio: Fix multiWriteCloser.Close 5067775 @bep #10505
- tpl/collections: Fix some index cases where the indices given is a slice and be more lenient with nil inputs d373774 @bep #10489
Improvements
- Make the hugo env non verbose output slightly more verbose f97544a @bep
- Add dart-sass-embedded version info to hugo env -v d8efe08 @bep
- tpl/embedded: Make Open Graph's series optional b82b547 @razonyang
- dartsass: Add sourceMapIncludeSources option e93138d @bep
- github: Update Dart Sass Embedded to 1.56.1 7d16c3c @bep
- markup/goldmark: Add removeSurroundingParagraph for Markdown images 63126c6 @bep #8362 #10492 #10494 #10501
- tpl/tplimpl: Allow alternate comment syntax 0b976d2 @jmooring #10495
- resources: Increase timeout for http.Client a49e51f @dirtymew #10478
- config/security: Add CI env var to whitelist dc44bca @septs
- tpl: Use consistent delimiter spacing in examples b8d5c37 @jmooring
Dependency Updates
- deps: Upgrade github.com/bep/godartsass v0.15.0 => v0.16.0 f5b5b71 @bep
- build(deps): bump github.com/getkin/kin-openapi from 0.109.0 to 0.110.0 50549c8 @dependabot[bot]
- build(deps): bump github.com/evanw/esbuild from 0.15.16 to 0.15.18 535ea8c @dependabot[bot]
- build(deps): bump golang.org/x/text from 0.4.0 to 0.5.0 8bbec42 @dependabot[bot]
- build(deps): bump github.com/evanw/esbuild from 0.15.15 to 0.15.16 0bfa293 @dependabot[bot]
- deps: Upgrade github.com/bep/godartsass v0.14.0 => v0.15.0 83080df @bep