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

Paragraphs in nested items are not formatted correctly #53

Closed
karelbilek opened this issue Feb 26, 2020 · 7 comments
Closed

Paragraphs in nested items are not formatted correctly #53

karelbilek opened this issue Feb 26, 2020 · 7 comments

Comments

@karelbilek
Copy link

karelbilek commented Feb 26, 2020

Input:

1. foo
    1.  A paragraph
        with two lines.

        Continues
    2.           Second
    3. Third

Expected:

1.      foo

        1.      A paragraph with two lines.

                Continues
        2.      Second
        3.      Third

Actual behaviour:

1.      foo

        1.      A paragraph with two lines.

        Continues

        1.      Second
        2.      Third
@karelbilek
Copy link
Author

This might be actually a parser (blackfriday) error, not sure.

I am taking CommonMark as the standard, with CommonMark, the input and expected are equivalent, the actual obviously not

@karelbilek
Copy link
Author

Oh, now I realized the "continues" is interpreted as a code block, NOT as paragraph. That's different from CommonMark, that interprets it as a paragraph.

...I think

@karelbilek
Copy link
Author

I really don't understand how is markdownfmt handling paragraphs inside lists. It makes no sense to me.

This does not format as a paragraph inside list

1. A paragraph

   is not

This does format as a paragraph inside list, even when the only difference is one more space.

1.   A paragraph

     is? Maybe?

@karelbilek
Copy link
Author

karelbilek commented Feb 26, 2020

The previous comment seems to be a blackfriday issue (blackfriday does not parse correctly)

The first issue seems to be markdownfmt issue (blackfriday parses the AST correctly, but markdownfmt does not print correctly)

@karelbilek
Copy link
Author

But maybe not. Hard to debug, either way it's confusing

@karelbilek
Copy link
Author

karelbilek commented Feb 26, 2020

I think it's the same issue as #54 - that is, it behaves correctly and predictably if I use tabs and not spaces. But it does weird things when I use spaces.

@karelbilek
Copy link
Author

karelbilek commented May 2, 2024

I have "solved" this by forking the repo here (I'm not in the committer list as I used work email or something back then) and rewriting it to a different markdown parser (blackfriday -> goldmark)

https://github.com/Kunde21/markdownfmt

which now died too. Closing this though; the real solution is to use a different markdown parser, as I did in the forked repo

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

No branches or pull requests

1 participant