diff --git a/CHANGELOG.md b/CHANGELOG.md index d03a970..e183e55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## HEAD (unreleased) +- Codeblocks in output are now indented with 4 spaces and "code fences" are removed (https://github.com/zombocom/syntax_search/pull/11) - "Unmatched end" and "missing end" not generate different error text instructions (https://github.com/zombocom/syntax_search/pull/10) ## 0.1.1 diff --git a/lib/syntax_search/display_invalid_blocks.rb b/lib/syntax_search/display_invalid_blocks.rb index b380a80..8fa1310 100644 --- a/lib/syntax_search/display_invalid_blocks.rb +++ b/lib/syntax_search/display_invalid_blocks.rb @@ -64,16 +64,13 @@ def call EOM end - def indent(string, with: " ") + def indent(string, with: " ") string.each_line.map {|l| with + l }.join end def code_block string = String.new("") - string << "```\n" - # string << "#".rjust(@digit_count) + " filename: #{filename}\n\n" if filename string << code_with_lines - string << "```\n" string end diff --git a/spec/unit/code_search_spec.rb b/spec/unit/code_search_spec.rb index 9ce3e71..82ceece 100644 --- a/spec/unit/code_search_spec.rb +++ b/spec/unit/code_search_spec.rb @@ -17,7 +17,7 @@ def hai search.call expect(search.record_dir.entries.map(&:to_s)).to include("1-add-1.txt") - expect(search.record_dir.join("1-add-1.txt").read).to eq(<<~EOM.indent(2)) + expect(search.record_dir.join("1-add-1.txt").read).to eq(<<~EOM.indent(4)) 1 class OH 2 def hello ❯ 3 def hai diff --git a/spec/unit/display_invalid_blocks_spec.rb b/spec/unit/display_invalid_blocks_spec.rb index 6155ca9..c8f54fc 100644 --- a/spec/unit/display_invalid_blocks_spec.rb +++ b/spec/unit/display_invalid_blocks_spec.rb @@ -60,13 +60,11 @@ def hai terminal: false ) expect(display.code_block).to eq(<<~EOM) - ``` 1 class OH ❯ 2 def hello 3 def hai 4 end 5 end - ``` EOM end it "shows terminal characters" do