Skip to content

Insufficient indentation for nested lists #211

Open
@pcraig3

Description

@pcraig3

Hello! I've been using the markdownify library in my app for a long time and it's been working great, but recently I updated and I noticed that the the interpretation for nested lists had changed and it messed up my workflow.

My workflow looks like this:

  • import content as HTML
  • converting the HTML to markdown for editing (using markdownify)
  • editors can edit the content
  • once editing is finished, convert markdown back to HTML for publishing (using Markdown)

I noticed that since this commit, markdownify changed from using tabs for list indentation (/t) to using spaces, which looks like 2 spaces for unordered lists and 3 spaces for ordered lists.

Since Markdown expects nested lists to be indented by 4 spaces, the nested lists output by markdownify aren't currently interpreted by Markdown.

Here's an example of what I mean:

Nested unordered list

original HTML markdownify output final HTML (using Markdown)
original list has 4 levels of indentation only 2 spaces used for nested list indentation final list has 2 levels of indentation
Image Image Image

Nested ordered list

original HTML markdownify output final HTML (using Markdown)
original list has 4 levels of indentation only 3 spaces used for nested list indentation final list has 3 levels of indentation
Image Image Image

I recently created a PR in my app to resolve this by overriding convert_li. If you are interested, I could do a PR on this repo as well.

On the other hand, if there's some configuration option that I am missing that resolves this or Markdown is too-strictly interpreting the spec and you don't believe this is a real issue, that's fine too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions