rouge
rouge copied to clipboard
HTML Formatter Always Escapes
Describe the bug When I try to format the code, the output is always HTML escaped, although I set the escape flag to false
To Reproduce Steps to reproduce the behavior:
require 'rouge'
text = " sleep 5; rm -rf /meowww\n cat /dev/andom > /dev/zzda\n"
lexer = Rouge::Lexer.find_fancy('bash')
Rouge::Formatters::HTML.disable_escape!
Rouge::Formatters::HTML.escape_enabled?
formatter = Rouge::Formatters::HTML.new
highlighted = formatter.format(lexer.lex(text))
=> " <span class=\"nb\">sleep </span>5<span class=\"p\">;</span> <span class=\"nb\">rm</span> <span class=\"nt\">-rf</span> /meowww\n <span class=\"nb\">cat</span> /dev/urandom &gt<span class=\"p\">;</span> /dev/sda\n"
Expected behavior
Since escape_enabled? is false I expected > stay the same, but it is changed to &gt
System (please complete the following information):
- OS: Debian 13
- Ruby version: ruby 3.4.7
- Rouge version: 4.6.1, also current branch 3332a9cdf1641410faa8eac884210cdee284d91d