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

Nested HTML <ul> outputs an empty line after each markdown bullet #9161

Closed
step- opened this issue Oct 28, 2023 · 4 comments
Closed

Nested HTML <ul> outputs an empty line after each markdown bullet #9161

step- opened this issue Oct 28, 2023 · 4 comments
Labels

Comments

@step-
Copy link

step- commented Oct 28, 2023

pandoc 3.1.9, Linux - thank you for today's new release.

Below, the first <ul> list is good when converted to markdown but the second one has issues: to my surprise, an empty line is appended after each markdown list item.

If this isn't a bug as I think, what is the reason for appending an empty line after each bullet item of the second markdown list?

I would expect that a single html list produced a single markdown list instead of three. In turn, markdown viewers display an empty line after each bullet, which is a problem.

stdin (html):

<ul>
  <li>1</li>
  <li>2</li>
</ul>

<hr>

<ul>
  <li>1</li>
  <li>2</li>
    <ul>
      <li>a</li>
    </ul>
</ul>

stdout (markdown):

-   1
-   2

------------------------------------------------------------------------

-   1

-   2

-   -   a

native:

[ BulletList
    [ [ Plain [ Str "1" ] ] , [ Plain [ Str "2" ] ] ]
, HorizontalRule
, BulletList
    [ [ Plain [ Str "1" ] ]
    , [ Plain [ Str "2" ] ]
    , [ BulletList [ [ Plain [ Str "a" ] ] ] ]
    ]
]
@step- step- added the bug label Oct 28, 2023
@jgm
Copy link
Owner

jgm commented Oct 28, 2023

Shouldn't the ul there be embedded in a li if you want a nested list?
See https://stackoverflow.com/questions/5899337/proper-way-to-make-html-nested-list

@jgm
Copy link
Owner

jgm commented Oct 28, 2023

Anyway, the real question is why this is being treated as a "loose" list (with spaces between lines) rather than a "tight" one.

@jgm
Copy link
Owner

jgm commented Oct 28, 2023

Turns out the command test for #8150 has almost the same test case.

@jgm jgm closed this as completed in 0f3211c Oct 28, 2023
@step-
Copy link
Author

step- commented Oct 28, 2023

Shouldn't the ul there be embedded in a li if you want a nested list?

Good point but I didn't write the HTML from scratch. I copied/pasted it from SeaMonkey HTML composer, which is a GUI app. So yes, it is invalid HTML but it is also used in practice. SeaMonkey outputs an HTML 4.01 transitional doctype.

Thank you for the speedy fix! and for #8150; together they enable SeaMonkey composer output.

Anyway, the real question is why this is being treated as a "loose" list (with spaces between lines) rather than a "tight" one.

I don't know about "spaces between lines". Honestly all I can recall is the commonmark definition of a loose list, quote: "... The difference in HTML output is that paragraphs in a loose list are wrapped in <p> tags, while paragraphs in a tight list are not." and I can't say if the quoted sentence implies there should be spaces between lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants