question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fix empty line before list

See original GitHub issue

It seems that the change in 0.3.15 introduced an empty line before a list, which seems semantically unintuitive.

For example:

/**
 * A description.
 *
 * @param {any} var An example list:
 * -   Item 1
 * -   Item 2
 * -   Item 3
 * @returns {Promise} A return value.
 */

turns into:

/**
 * A description.
 *
 * @param {any} var An example list:
 * 
 *   -   Item 1
 *   -   Item 2
 *   -   Item 3
 * @returns {Promise} A return value.
 */

This seems semantically unintuitive, because a list rarely stands on its own, unless it is an index or table of contents.

If a list should be more clearly separated from the rest, it should add an empty line before and after the list. But that would be even worse in my opinion, because it takes up even more space. And the list cannot really be optically attached to the previous or following line anymore. For example, here the list seems pretty lost:

/**
 * A description.
 *
 * @param {any} var An example text that is
 *   long and spans multiple lines
 *   followed by a list.
 * 
 *   -   Item 1
 *   -   Item 2
 *   -   Item 3
 *
 *  And more text to come.
 * @returns {Promise} A return value.
 */

My suggestion would be to:

  • not auto-add an empty line before or after the list
  • respect if the author added an empty line before or after a list and do not remove it
  • reduce the number of empty lines to 1 if the author added more than 1 empty line before or after the list

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:15 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
hosseinmdcommented, Apr 4, 2021

I will do it as soon as possible. Thank you for contributing.

1reaction
mtrezzacommented, Apr 4, 2021

Yes, now I see it too, let’s go with a) then. I think the only issue to correct is that there is no empty line after the list if the next line starts with a tag.

/**
 * @param {any} var An example list:
 *
 *   - Item 1
 *   - Item 2
 * @returns {Promise} A return value.
 */

should become

/**
 * @param {any} var An example list:
 *
 *   - Item 1
 *   - Item 2
 *
 * @returns {Promise} A return value.
 */
Read more comments on GitHub >

github_iconTop Results From Across the Web

Blank lines before lists, revisited - CommonMark Discussion
One solution that can work is for block quote to be logically extended until a blank line. This way any lines not separated...
Read more >
Explain that lists and bullets require empty line before #46
When using markdown in the real world, one common and frustrating issue when using bullets and lists is that a blank line is...
Read more >
rule-empty-line-before - Stylelint
This rule ignores rules that are the very first node in a source. The fix option can automatically fix all of the problems...
Read more >
R Markdown: Empty line between list items - Stack Overflow
When using ordered lists, I sometimes run into a case where no empty line is added between the list item. That happens after...
Read more >
List Markdown doesn't work unless preceded by a blank line
It would take one line in the Markdown reference to fix. I realize that there is a limit on how much detail you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found