-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Markdown parser doesn't ignore leading whitespace in list items #13789
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
Comments
(I noticed this in #13780.) |
Part of the issue is that html ignores multiple whitespaces. IMO we should do the same when rendering markdown in the repl. Note: You can compare markdown implementations with babelmark2. Indentation immediately after a list never becomes code in commonmark., so potentially that's a Jupyter bug. |
@hayd, I agree that when rendering non-code cells, we should ignore multiple whitespace. That would fix this issue. |
I think this can be patched by regex replacing multiple whitespace here:
This feels a little hacky, so let's ping @one-more-minute :) |
Pushed a PR to fix as above. One weird thing (unrelated to my PR, but similar to the example above) is that quote has different behaviour:
i.e. the next line doesn't count as part of the quote (it should). |
I was looking at the quote part the other day, it seems that quote parse needs to know which characters should start a fresh block... I can't see a way around hardcoding what line starts can escape quote. Related: I think we ought not allow • instead of - to construct a list, it's not markdown. |
As I understand it, indentation matching the initial list item should be ignored, rather than converted into multiple spaces. e.g. here is how Github renders the same list:
split over
three lines
In fact, Github seems to ignore any amount of leading whitespace in the list items. On the other hand, Jupyter renders a code block if you indent by an extra four spaces beyond the W+1 spaces for a list marker of width W plus one space:
is rendered as:

As I understand the commonmark spec, Jupyter's behavior seems the more correct one:
The text was updated successfully, but these errors were encountered: