mirror of
https://github.com/gohugoio/hugo.git
synced 2025-09-02 22:52:51 +02:00
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
This commit is contained in:
@@ -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 {
|
||||
|
Reference in New Issue
Block a user