diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2020-01-04 23:58:23 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2020-01-04 23:58:23 +0100 |
commit | 5ee1f0876f3ec8b79d6305298185dc821ead2d28 (patch) | |
tree | de8689d4f84dbca7a82aeeffab0ad9640fe2336c | |
parent | a82d2700fcc772aada15d65b8f76913ca23f7404 (diff) |
markup/goldmark: Simplify code
-rw-r--r-- | markup/goldmark/autoid.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/markup/goldmark/autoid.go b/markup/goldmark/autoid.go index 6599f08d9..c064a76b3 100644 --- a/markup/goldmark/autoid.go +++ b/markup/goldmark/autoid.go @@ -48,9 +48,9 @@ func sanitizeAnchorNameWithHook(b []byte, asciiOnly bool, hook func(buf *bytes.B r, size := utf8.DecodeRune(b) switch { case asciiOnly && size != 1: - case isSpace(r): - buf.WriteString("-") - case r == '-' || isAlphaNumeric(r): + case r == '-' || isSpace(r): + buf.WriteRune('-') + case isAlphaNumeric(r): buf.WriteRune(unicode.ToLower(r)) default: } |