ralsina/tartrazine

Crystal highlight heredoc issue

Closed this issue · 5 comments

Sample code with heredoc:

lexer = Tartrazine.lexer(name: "crystal")
theme = Tartrazine.theme("github-dark")

source = %Q[
xml = <<-XML
  <person id="1">
    <firstName preferredName="Jane">Jehanne</firstname>
    <lastName>Doe</lastname>
  </person>
XML
]

formatter = Tartrazine::Html.new(theme)
formatter.standalone = true

puts formatter.format(source, lexer)

GitHub format it correctly as is:

xml = <<-XML
  <person id="1">
    <firstName preferredName="Jane">Jehanne</firstname>
    <lastName>Doe</lastname>
  </person>
XML
crystal test.cr > index.html

Result from Tatranize:

image

I just pushed a PR to try using the native crystal highlighter. It's not a great match for the model tartrazine uses but it seems to work :-)

After some testing #3 looks pretty good (or at least no worse than the chroma-based lexer) so I am merging that and closing this issue. Feel free to reopen if you find this new lexer buggy.