Skip to content

Commit

Permalink
Change hr formatting to always be full width (closes #21)
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrmurach committed Aug 15, 2020
1 parent 732dd83 commit 605c3ff
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions lib/tty/markdown/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -404,13 +404,11 @@ def convert_br(el, opts)
end

def convert_hr(el, opts)
indent = ' ' * @current_indent
symbols = @symbols
width = @width - (indent.length + 1) * 2
width = @width - symbols[:diamond].length * 2
styles = Array(@theme[:hr])
line = symbols[:diamond] + symbols[:line] * width + symbols[:diamond]

opts[:result] << indent
opts[:result] << @pastel.decorate(line, *styles)
opts[:result] << "\n"
end
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/parse/hr_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
parsed = TTY::Markdown.parse(markdown, width: 20)
expect(parsed).to eq([
" \e[36;1mheader\e[0m\n",
" \e[33m#{symbols[:diamond]}#{symbols[:line]*10}#{symbols[:diamond]}\e[0m\n"
"\e[33m#{symbols[:diamond]}#{symbols[:line]*18}#{symbols[:diamond]}\e[0m\n"
].join)
end
end

0 comments on commit 605c3ff

Please sign in to comment.