summaryrefslogtreecommitdiffstats
path: root/markup/goldmark/goldmark_config/config.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-12-03 12:33:48 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-12-05 15:00:47 +0100
commit63126c6359a693345a3a81b22e0f95660b248044 (patch)
tree7f2fdf6af58735564cf3be57efbdad594150fa05 /markup/goldmark/goldmark_config/config.go
parent535ea8cc9bf20b1ba6f656f9f3eee3818c6dc537 (diff)
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
Diffstat (limited to 'markup/goldmark/goldmark_config/config.go')
-rw-r--r--markup/goldmark/goldmark_config/config.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/markup/goldmark/goldmark_config/config.go b/markup/goldmark/goldmark_config/config.go
index a3238091b..ff0b6bbef 100644
--- a/markup/goldmark/goldmark_config/config.go
+++ b/markup/goldmark/goldmark_config/config.go
@@ -36,8 +36,9 @@ var Default = Config{
Unsafe: false,
},
Parser: Parser{
- AutoHeadingID: true,
- AutoHeadingIDType: AutoHeadingIDTypeGitHub,
+ AutoHeadingID: true,
+ AutoHeadingIDType: AutoHeadingIDTypeGitHub,
+ WrapStandAloneImageWithinParagraph: true,
Attribute: ParserAttribute{
Title: true,
Block: false,
@@ -88,6 +89,9 @@ type Parser struct {
// Enables custom attributes.
Attribute ParserAttribute
+
+ // Whether to wrap stand-alone images within a paragraph or not.
+ WrapStandAloneImageWithinParagraph bool
}
type ParserAttribute struct {