@ -73,7 +73,24 @@ unorderedListTests =
check_equal " Paragraph in list " " <ul><li>Item 1</li><li><p>Item 2</p><p>More stuff</p></li><li>Item 3</li></ul> " ( convert " - Item 1 \ n - Item 2 \ n \ n More stuff \ n \ n - Item 3 " ) ,
check_equal " Paragraph before list " " <p>This is a list</p><ul><li>Item 1</li><li>Item 2</li></ul> " ( convert " This is a list \ n \ n * Item 1 \ n * Item 2 " ) ,
check_equal " Paragraph before list " " <h3>This is a list</h3><ul><li>Item 1</li><li>Item 2</li></ul> " ( convert " ### This is a list \ n \ n * Item 1 \ n * Item 2 " ) ,
check_equal " Nested list then back " " <ul><li>Item 1</li><li>Item 2<ul><li>Item 3</li><li>Item 4</li></ul></li><li>Item 5</li></ul> " ( convert " - Item 1 \ n - Item 2 \ n - Item 3 \ n - Item 4 \ n - Item 5 " )
check_equal " Nested list then back " " <ul><li>Item 1</li><li>Item 2<ul><li>Item 3</li><li>Item 4</li></ul></li><li>Item 5</li></ul> " ( convert " - Item 1 \ n - Item 2 \ n - Item 3 \ n - Item 4 \ n - Item 5 " ) ,
check_equal " Blockquote in list " " <ul><li>Item 1</li><li><p>Item 2</p><blockquote><p>Quote</p></blockquote></li><li>Item 3</li></ul> " ( convert " - Item 1 \ n - Item 2 \ n \ n > Quote \ n \ n - Item 3 " ) ,
check_equal " Ordered list in unordered list " " <ul><li>Item 1</li><li>Item 2<ol><li>Item 1</li><li>Item 2</li></ol></li><li>Item 3</li></ul> " ( convert " - Item 1 \ n - Item 2 \ n 1. Item 1 \ n 2. Item 2 \ n - Item 3 " )
]
orderedListTests =
TestList
[ check_equal " Basic ordered list " " <ol><li>Item 1</li><li>Item 2</li><li>Item 3</li></ol> " ( convert " 1. Item 1 \ n 2. Item 2 \ n 3. Item 3 " ) ,
check_equal " Mixing list numbering " " <ol><li>Item 1</li><li>Item 2</li><li>Item 3</li></ol> " ( convert " 1. Item 1 \ n 3. Item 2 \ n 2. Item 3 " ) ,
check_equal " Should not convert list without number 1 " " <p>2. Item 1 1. Item 2</p> " ( convert " 2. Item 1 \ n 1. Item 2 " ) ,
check_equal " Formatted lists " " <ol><li><b>Item 1</b></li><li><i>Item 2</i></li><li><b><i>Item 3</i></b></li></ol> " ( convert " 1. __Item 1__ \ n 2. _Item 2_ \ n 3. ***Item 3*** " ) ,
check_equal " Nested list " " <ol><li>Item 1</li><li>Item 2</li><li>Item 3<ol><li>Subitem 1</li><li>Subitem 2</li></ol></li></ol> " ( convert " 1. Item 1 \ n 2. Item 2 \ n 3. Item 3 \ n 1. Subitem 1 \ n 2. Subitem 2 " ) ,
check_equal " Paragraph in list " " <ol><li>Item 1</li><li><p>Item 2</p><p>More stuff</p></li><li>Item 3</li></ol> " ( convert " 1. Item 1 \ n 2. Item 2 \ n \ n More stuff \ n \ n 1. Item 3 " ) ,
check_equal " Paragraph before list " " <p>This is a list</p><ol><li>Item 1</li><li>Item 2</li></ol> " ( convert " This is a list \ n \ n 1. Item 1 \ n 1. Item 2 " ) ,
check_equal " Paragraph before list " " <h3>This is a list</h3><ol><li>Item 1</li><li>Item 2</li></ol> " ( convert " ### This is a list \ n \ n 1. Item 1 \ n 200. Item 2 " ) ,
check_equal " Nested list then back " " <ol><li>Item 1</li><li>Item 2<ol><li>Item 3</li><li>Item 4</li></ol></li><li>Item 5</li></ol> " ( convert " 1. Item 1 \ n 2. Item 2 \ n 1. Item 3 \ n 3. Item 4 \ n 5. Item 5 " ) ,
check_equal " Blockquote in list " " <ol><li>Item 1</li><li><p>Item 2</p><blockquote><p>Quote</p></blockquote></li><li>Item 3</li></ol> " ( convert " 1. Item 1 \ n 2. Item 2 \ n \ n > Quote \ n \ n 3. Item 3 " ) ,
check_equal " Unordered list in ordered list " " <ol><li>Item 1</li><li>Item 2<ul><li>Item 1</li><li>Item 2</li></ul></li><li>Item 3</li></ol> " ( convert " 1. Item 1 \ n 2. Item 2 \ n - Item 1 \ n * Item 2 \ n 4. Item 3 " )
]
integrationTests =
@ -87,14 +104,14 @@ integrationTests =
check_equal
" Integration 7 "
" <h1>Sample Markdown</h1><p>This is some basic, sample markdown.</p><h2>Second \
\ Heading </ h2 >< ul >< li > Unordered lists , and :< u l>< li > One </ li >< li > Two </ li >< li >\
\ Three </ li ></ u l></ li >< li > More </ li ></ ul >< blockquote >< p > Blockquote </ p >\
\ Heading </ h2 >< ul >< li > Unordered lists , and :< o l>< li > One </ li >< li > Two </ li >< li >\
\ Three </ li ></ o l></ li >< li > More </ li ></ ul >< blockquote >< p > Blockquote </ p >\
\</ blockquote >< p > And < b > bold </ b > , < i > italics </ i > , and even < i > italics \
\ and later < b > bold </ b ></ i >. Even < s > strikethrough </ s >. \
\< a href =\ " https://markdowntohtml.com \ " >A link</a> to somewhere.</p> "
( convert
" # Sample Markdown \ n \ n This is some basic, sample markdown. \ n \ n ## Second \
\ Heading \ n \ n - Unordered lists , and :\ n - One \ n - Two \ n - Three \ n \
\ Heading \ n \ n - Unordered lists , and :\ n 1 . One \ n 2 . Two \ n 3 . Three \ n \
\- More \ n \ n > Blockquote \ n \ nAnd ** bold ** , * italics * , and even * italics and \
\ later ** bold ***. Even ~~ strikethrough ~~. [ A link ] ( https :// markdowntohtml . com ) to somewhere . "
)
@ -109,6 +126,7 @@ tests =
escapedCharTests ,
blockquoteTests ,
unorderedListTests ,
orderedListTests ,
integrationTests
]