Skip to content

Commit dd99b99

Browse files
committed
Remove all punctuation from anchors in policies.md
1 parent fdfe524 commit dd99b99

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

internal/commands/document.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,14 @@ func getDocumentation(path string, outputDirectory string) (map[rego.Severity][]
186186
}
187187

188188
anchor := strings.ToLower(strings.ReplaceAll(documentTitle, " ", "-"))
189-
anchor = strings.ReplaceAll(anchor, ":", "")
189+
// Tab and all ASCII punctuation except - and _
190+
punctReplacer := strings.NewReplacer(
191+
"\t", "", "!", "", "\"", "", "#", "", "$", "", "%", "", "&", "", "'", "", "(", "", ")", "",
192+
"*", "", "+", "", ",", "", ".", "", "/", "", ":", "", ";", "", "<", "", "=", "", ">", "",
193+
"?", "", "@", "", "[", "", "\\", "", "]", "", "^", "", "`", "", "{", "", "|", "", "}", "",
194+
"~", "",
195+
)
196+
anchor = punctReplacer.Replace(anchor)
190197

191198
legacyMatchers, err := policy.Matchers()
192199
if err != nil {

0 commit comments

Comments
 (0)