Skip to content

Commit d79c6ba

Browse files
committed
enable necessary replacements in HTML encoder
1 parent e8c56ab commit d79c6ba

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/coderay/encoders/html.rb

+5-5
Original file line numberDiff line numberDiff line change
@@ -206,11 +206,11 @@ def text_token text, kind
206206
style = @span_for_kinds[@last_opened ? [kind, *@opened] : kind]
207207

208208
text = EscapeUtils.escape_html(text)
209-
# if text.index(/[\0-\t\xB-\x1F]/)
210-
# # Escape ASCII control codes except \x9 == \t and \xA == \n.
211-
# text.tr!("\0-\x8\xB-\x1F", ' ') if text.index(/[\0-\x8\xB-\x1F]/)
212-
# text.gsub!("\t", @expand_tab) if text.index("\t")
213-
# end
209+
if text.index(/[\0-\t\xB-\x1F]/)
210+
# Escape ASCII control codes except \x9 == \t and \xA == \n.
211+
text.tr!("\0-\x8\xB-\x1F", ' ') if text.index(/[\0-\x8\xB-\x1F]/)
212+
text.gsub!("\t", @expand_tab) if text.index("\t")
213+
end
214214

215215
text = break_lines(text, style) if @break_lines && (style || @opened.size > 0) && text.index("\n")
216216

0 commit comments

Comments
 (0)