]> git.maquefel.me Git - brevno-suite/hugo/commit
markup/goldmark: Add removeSurroundingParagraph for Markdown images
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sat, 3 Dec 2022 11:33:48 +0000 (12:33 +0100)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Mon, 5 Dec 2022 14:00:47 +0000 (15:00 +0100)
commit63126c6359a693345a3a81b22e0f95660b248044
tree7f2fdf6af58735564cf3be57efbdad594150fa05
parent535ea8cc9bf20b1ba6f656f9f3eee3818c6dc537
markup/goldmark: Add removeSurroundingParagraph for Markdown images

* Removes any surrounding paragraph nodes
* And transfers any attributes from the surrounding paragraph down to the image node
* Adds IsBlock and Ordinal (zero based) field to the image context passed to the image render hooks

IsBlock is set to true if `wrapStandAloneImageWithinParagraph = false` and  the image's parent node has only one child.

Closes #8362
Fixes #10492
Fixes #10494
Fixes #10501
markup/converter/hooks/hooks.go
markup/goldmark/convert.go
markup/goldmark/goldmark_config/config.go
markup/goldmark/images/integration_test.go [new file with mode: 0644]
markup/goldmark/images/transform.go [new file with mode: 0644]
markup/goldmark/links/integration_test.go [new file with mode: 0644]
markup/goldmark/links/transform.go [new file with mode: 0644]
markup/goldmark/render_hooks.go
markup/internal/attributes/attributes.go