Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<ul> nested inside <ol> needs three space indent, not two #344

Closed
snarfed opened this issue Dec 6, 2020 · 0 comments · Fixed by #345
Closed

<ul> nested inside <ol> needs three space indent, not two #344

snarfed opened this issue Dec 6, 2020 · 0 comments · Fixed by #345

Comments

@snarfed
Copy link
Contributor

snarfed commented Dec 6, 2020

First off, thank you for maintaining html2text, it's great!

Right now, list items are always indented two spaces per enclosing list. This is generally right, but doesn't work for <ul>s nested inside <ol>s. Those need three spaces (at least) instead. Details here in the Common Mark spec.

I have a PR ready for this, I'll submit it in a minute.

For example, this HTML:

<ol>
  <li>ordered</li>
  <ul>
    <li>unordered</li>
  </ul>
</ol>

needs to convert to this, with five spaces before * unordered instead of four:

  1. ordered
     * unordered
  3. end

Tested against HEAD with multiple Python 3 versions.

snarfed added a commit to snarfed/html2text that referenced this issue Dec 6, 2020
...to comply with CommonMark, GFM, etc. Fixes Alir3z4#344.
snarfed added a commit to snarfed/html2text that referenced this issue Dec 7, 2020
...to comply with CommonMark, GFM, etc. Fixes Alir3z4#344.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant