getnikola / nikola

A static website and blog generator
https://getnikola.com/
MIT License
2.62k stars 449 forks source link

bad spacing on markdown bullet lists #3621

Open alusiani opened 2 years ago

alusiani commented 2 years ago

Hi,

I see that bullet lists in Markdown have a bad extra vertical spacing between one bullet and a following second level bullet, like in this Markdown example

-   first bullet
    -   second indented bullet
    -   3rd ...

An example can be found at https://precision-sm.github.io/posts/precision-sm-hepdata-subm/

This vertical spacing is absent when exactly the same above text is instead in a RST file.

As far as I understand, when Markdown is converted to HTML one gets <ul> for lists, when RST is converted the same list begins with <ul class="simple">. The "simple" class triggers the CSS

.simple li, .simple ul, .simple ol, .compact li, .compact ul, .compact ol, .simple > li p, dl.simple > dd, .compact > li p, dl.compact > dd {
    margin-top: 0;
    margin-bottom: 0;
}

which is not triggered for <ul>. In this latter case the following CSS holds

p {
    margin-top: 0;
    margin-bottom: 1rem;
}

In my opinion it would be best if Markdown could produce the same formatting as RST.

I checked asciidoc: it behaves like Markdown.

Cheers,

Alberto

ralsina commented 2 years ago

We don't really control what markup is produced, but you can add a CSS tweak in assets/css/custom.css to make it look the way you want.

On Fri, May 6, 2022, 8:30 PM Alberto Lusiani @.***> wrote:

Hi,

I see that bullet lists in Markdown have a bad extra vertical spacing spacing between one bullet and a following second level bullet, like in this Markdown example

  • first bullet
    • second indented bullet
    • 3rd ...

An example can be found at https://precision-sm.github.io/posts/precision-sm-hepdata-subm/

This vertical spacing is absent when exactly the same above text is instead in a RST file.

As far as I understand, when Markdown is converted to HTML one gets

    for lists, when RST is converted the same list begins with <ul class="simple">. The "simple" class triggers the CSS

    .simple li, .simple ul, .simple ol, .compact li, .compact ul, .compact ol, .simple > li p, dl.simple > dd, .compact > li p, dl.compact > dd { margin-top: 0; margin-bottom: 0; }

    which is not triggered for