Skip to content

Commit

Permalink
Enhance output of compact nested lists when converting to kramdown
Browse files Browse the repository at this point in the history
Nested lists don't realise they are nested, and hence newlines are added after the end of a nested
list (within the main list) when this is of course unnecessary and can cause rendering issues.
  • Loading branch information
Convincible authored and gettalong committed Nov 16, 2024
1 parent 8c2e435 commit 2ae293c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/kramdown/converter/kramdown.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ def convert(el, opts = {indent: 0})
elsif el.block? &&
![:li, :dd, :dt, :td, :th, :tr, :thead, :tbody, :tfoot, :blank].include?(el.type) &&
(el.type != :html_element || @stack.last.type != :html_element) &&
(el.type != :p || !el.options[:transparent])
(el.type != :p || !el.options[:transparent]) &&
!([:ul, :dl, :ol].include?(el.type) && @stack.last.type == :li)
res << "\n"
end
res
Expand Down

0 comments on commit 2ae293c

Please sign in to comment.