You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This fixes problems with the markdownify logic for indentation inside
list items.
This PR uses a branch building on that for matthewwithanm#120, matthewwithanm#150 and matthewwithanm#151, so
those three PRs should be merged first before merging this one.
There is limited logic in markdownify for handling indentation in the
case of nested lists. There are two major problems with this logic:
* As it's in `convert_list`, causing a list to be indented when inside
another list, it does not add indentation for any other elements
such as paragraphs that may be found inside list items (or `<pre>`,
`<blockquote>`, etc.), so such elements are wrongly not indented and
terminate the list in the output.
* It uses fixed indentation of one tab. Following CommonMark, a tab
in Markdown is considered equivalent to four spaces, which is not
sufficient indentation in ordered list items with a number of three
or more digits.
Fix both of these issues by making `convert_li` handle indentation for
the contents of `<li>`, based on the length of the list item marker,
rather than doing it in `convert_list` at all.
assertmd('<ol start="1234"><li><p>first para</p><p>second para</p></li><li><p>third para</p><p>fourth para</p></li></ol>') =='\n\n1234. first para\n\n second para\n1235. third para\n\n fourth para\n'
assertmd('<ul><li><p>first para</p><p>second para</p></li><li><p>third para</p><p>fourth para</p></li></ul>') =='\n\n* first para\n\n second para\n* third para\n\n fourth para\n'
0 commit comments