Skip to content

Commit be44e38

Browse files
committed
Fix incorrect help anchors with special characters
The collector regex removed all non alphanumerical characters which worked fine if there was also a space next to them, as in the next step it converted one or more spaces to dash. If however this extra character such as a : was directly embedded in the word this produced a different result compared to how markdown works. Now we replace all special characters with space, and space gets replaced with dash
1 parent 5516708 commit be44e38

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/controllers/help_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def extract_outline(text)
3939
if line =~ /^(\#{2,3})\s+(.+)$/
4040
level = $1.length
4141
title = $2.strip
42-
id = title.downcase.gsub(/[^a-z0-9\s-]/, "").gsub(/\s+/, "-")
42+
id = title.downcase.gsub(/[^a-z0-9\s-]/, " ").gsub(/\s+/, "-")
4343
headings << { level: level, title: title, id: id }
4444
end
4545
end

0 commit comments

Comments
 (0)