forked from gettalong/kramdown
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[bugfix] Fix edge case in Kramdown converter
weird combination of LI and P tags can cause the converter to crash fixes gettalong#809
- Loading branch information
1 parent
bd678ec
commit 407ea50
Showing
2 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# -*- coding: utf-8; frozen_string_literal: true -*- | ||
# | ||
#-- | ||
# Copyright (C) 2009-2019 Thomas Leitner <[email protected]> | ||
# | ||
# This file is part of kramdown which is licensed under the MIT. | ||
#++ | ||
# | ||
|
||
require 'minitest/autorun' | ||
require 'kramdown/converter/kramdown' | ||
|
||
describe Kramdown::Converter::Kramdown do | ||
it "converts weird html to kramdown" do | ||
html = <<~HTML | ||
<ul> | ||
<li></li> | ||
<li> | ||
<p>one</p> | ||
</li> | ||
<li> | ||
<p>two</p> | ||
</li> | ||
</ul> | ||
HTML | ||
doc, = Kramdown::Parser::Html.parse(html) | ||
md, = Kramdown::Converter::Kramdown.convert(doc) | ||
expected = <<~MD | ||
* | ||
* one | ||
* two | ||
MD | ||
assert_equal expected, md | ||
end | ||
end |