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

To have no empty line between a list and the text above it #8156

Closed
john-cj opened this issue Jun 27, 2022 · 4 comments
Closed

To have no empty line between a list and the text above it #8156

john-cj opened this issue Jun 27, 2022 · 4 comments

Comments

@john-cj
Copy link

john-cj commented Jun 27, 2022

Currently, there required to be an empty line between a list and the text above it.

// this will be converted into HTML as a list:

this is a list:

- list item 1
- list item 2

// sadly, this will be converted into HTML as a paragraph:

this is a list:
- list item 1
- list item 2

Because Markdown files are often read in raw form, having an option to get rid of that empty line would be great. It will be much easier to distinguish the text that is used as a title/label/introduction of a list from the "normal" text.

Here is a shopping list that is in turn consists of three unordred "labeled" lists:

Food
- Bananas
- Apples
- Bread

Drinks
- Orange juice
- Wine
- Whiskey
- Bloody Mary

Johnnie Walker or Jim Beam? And what about Bloody Mary? Maybe Mojito instead?

Johnnie and Jane's marriage
- Codex Seraphinianus
- That amazing flying and talking hadgehog
- Pistachio

"Johnnie Walker" and "Jim Beam" are whiskeys. "Bloody Mary" is a cocktail.

To make the shopping list above "converting-to-HTML-friendly", I will need to add an empty line above each list, and so this will take more vertical space and the shopping list itslef will be somewhat ambiguous:

Drinks

- Orange juice
- Wine
- Whiskey
- Bloody Mary

Johnnie Walker or Jim Beam? And what about Bloody Mary? Maybe Mojito instead?

Johnnie and Jane's marriage

- Codex Seraphinianus
- That amazing flying and talking hedgehog
- Pistachio

Of course, I don't really talk about a shopping list. I use Pandoc's Markdown for technical writing.

The same goes for other block elements, e.g. fenced code blocks.

@tarleb
Copy link
Collaborator

tarleb commented Jun 27, 2022

CommonMark already uses that logic. These days, pandoc's CommonMark implementation offers almost all the features of pandoc's Markdown. Please try if --from=commonmark_x is sufficient for your needs.

@john-cj
Copy link
Author

john-cj commented Jun 27, 2022

Thanks, tarleb. Unfortunately, I cannot test it right now because my computer is quite old (sure, I need to upgrade) and there is 32-bit Windows 7 installed on it. So the last Pandoc version available for me is 2.9.2.1, and it seems it cannot convert from commonmark_x. Using

pandoc test1.md -f commonmark_x -t html -s --toc -o test1.html

or

pandoc test1.md --from=commonmark_x -t html -s --toc -o test1.html

gives me an error Unknown input format commonmark_x.

@jgm jgm closed this as completed Jun 30, 2022
@john-cj
Copy link
Author

john-cj commented Aug 28, 2022

@jgm Is it on the roadmap to make those empty lines optinal for Pandoc's Markdown as well, so that it will work with --from markdown and not only with --from commonmark_x?

@jgm
Copy link
Owner

jgm commented Aug 28, 2022

No, I don't anticipate any changes to pandoc markdown.
Allowing no empty line actually causes a host of problems.
See #5 at https://johnmacfarlane.net/beyond-markdown.html

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

No branches or pull requests

3 participants