markup/goldmark: Make the autoID type config a string

To potentially make room for one more.

See #6707
This commit is contained in:
Bjørn Erik Pedersen
2020-01-05 11:29:22 +01:00
parent 469351d5b6
commit 8f071fc159
4 changed files with 22 additions and 11 deletions

View File

@@ -14,6 +14,11 @@
// Package goldmark_config holds Goldmark related configuration.
package goldmark_config
const (
AutoHeadingIDTypeGitHub = "github"
AutoHeadingIDTypeGitHubAscii = "github-ascii"
)
// DefaultConfig holds the default Goldmark configuration.
var Default = Config{
Extensions: Extensions{
@@ -29,8 +34,9 @@ var Default = Config{
Unsafe: false,
},
Parser: Parser{
AutoHeadingID: true,
Attribute: true,
AutoHeadingID: true,
AutoHeadingIDType: AutoHeadingIDTypeGitHub,
Attribute: true,
},
}
@@ -69,9 +75,10 @@ type Parser struct {
// auto generated heading ids.
AutoHeadingID bool
// When AutoHeadingID is enabled this will generate IDs with Ascii
// characters only.
AutoHeadingIDAsciiOnly bool
// The strategy to use when generating heading IDs.
// Available options are "github", "github-ascii".
// Default is "github", which will create GitHub-compatible anchor names.
AutoHeadingIDType string
// Enables custom attributes.
Attribute bool