diff --git a/README.md b/README.md index 653b9d2..3320728 100644 --- a/README.md +++ b/README.md @@ -36,9 +36,7 @@ It has 332 themes (64 from Chroma, the rest are base16 themes via ## Installation -This will have a CLI tool that can be installed, but it's not -there yet. - +This has a CLI but it's not generally usable. ## Usage diff --git a/src/formatters/html.cr b/src/formatters/html.cr index 83b9b1b..a3063be 100644 --- a/src/formatters/html.cr +++ b/src/formatters/html.cr @@ -10,7 +10,7 @@ module Tartrazine # property with_classes : Bool = true property tab_width = 8 - # property surrounding_pre : Bool = true + property? surrounding_pre : Bool = true # property wrap_long_lines : Bool = false property? line_numbers : Bool = false property line_number_start : Int32 = 1 @@ -43,7 +43,10 @@ module Tartrazine def format_text(text : String, lexer : Lexer, theme : Theme) : String lines = group_tokens_in_lines(lexer.tokenize(text)) output = String.build do |outp| - outp << "
"
+        if surrounding_pre?
+          outp << "
"
+        end
+        ""
         lines.each_with_index(offset: line_number_start - 1) do |line, i|
           line_label = line_numbers? ? "#{i + 1}".rjust(4).ljust(5) : ""
           line_class = highlighted?(i + 1) ? "class=\"#{get_css_class("LineHighlight", theme)}\"" : ""