mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
Remove trailing hyphen from auto heading ID
Applicable when autoHeadingIDType is either `github` or `github-ascii`. When autoHeadingIDType is `blackfriday`, the existing code removes trailing whitespace while iterating through the characters, using a boolean "futureDash" mechanism. Fixes #6798
This commit is contained in:
parent
a1c3e3c1f3
commit
58c0f5e617
2 changed files with 5 additions and 0 deletions
|
@ -54,6 +54,8 @@ func sanitizeAnchorNameWithHook(b []byte, idType string, hook func(buf *bytes.Bu
|
|||
b = text.RemoveAccents(b)
|
||||
}
|
||||
|
||||
b = bytes.TrimSpace(b)
|
||||
|
||||
for len(b) > 0 {
|
||||
r, size := utf8.DecodeRune(b)
|
||||
switch {
|
||||
|
|
|
@ -66,6 +66,9 @@ tabspace
|
|||
|
||||
testlines, expectlines := strings.Split(tests, "\n"), strings.Split(expect, "\n")
|
||||
|
||||
testlines = append(testlines, "Trailing Space ")
|
||||
expectlines = append(expectlines, "trailing-space")
|
||||
|
||||
if len(testlines) != len(expectlines) {
|
||||
panic("test setup failed")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue