bullet points - indentation and spacing #67

Closed
clach04 opened this Issue Jul 13, 2011 · 7 comments

Projects

None yet

2 participants

@clach04

I've a demo piece of text that demonstrates 2 problems (and differences) to the original Perl version. It also demos a problem that the perl version also has so that is probably a non-issue.

tested with headrevs as of 2011-07-13.


Demo a few different issues with bullet points

NOTE demo 1 is proabably a markdown "feature". The perl (online dingus)
version has the same behavior, i.e. copy.paste this into
http://daringfireball.net/projects/markdown/dingus

1 odd spacing (possibly caused by p tag?)

Workarounds:

  1. this is bullet one, note spacing between this and bullet 2
  2. this is bulet two see spacing above and below, they are different this is line 2 of bullet two, not sure if this is significant
  3. Note there is more spaced between this bullet and the line above
    this is the send line of bullet 3 not sure if it is needed or not.

    /* ---- and now some indented code ---- */
    a = a + 1;
    /* ---- cut here ---- */
    

This demos one, maybe two issues - renumbered bullets

intro sentence before bullets

  1. Number one bullet

  2. This is number two bullet, it is multi line and has some non-numbered
    bullets. It is possible the bullets below should be indent more but
    I do not think so (note they show up at the wrong indentation level
    in the output)

    • unnumbered bullet 1
    • unnumbered bullet 2

    Another paragraph for number 2 bullet.

  3. This should be the third bullet point, I think it got confused with the
    non numbered bullets.

    A second paragraph for bullet 3

The end of the text.

@clach04

Interestingly github's MD parser demos the numbering issue BUT not the other issues. See "This should be the third bullet point"

@trentm
Owner

@clach04: are you able to put up files somewhere (e.g. in a gist) with the exactly whitespace? Trying to pull them out of the text above won't be reliable.

@clach04

Here is the gist https://gist.github.com/1087666

Here is a 2nd attempt, indenting as code just in case that works too. Shame the raw text in github issues isn't available :-(

Demo a few different issues with bullet points

NOTE demo 1 is proabably a markdown "feature". The perl (online dingus)
version has the same behavior, i.e. copy.paste this into 
<http://daringfireball.net/projects/markdown/dingus>

## 1 odd spacing (possibly caused by p tag?)

Workarounds:

 1. this is bullet one, note spacing between this and bullet 2
 2. this is bulet two see spacing above and below, they are different
    this is line 2 of bullet two, not sure if this is significant
 3. Note there is more spaced between this bullet and the line above
    this is the send line of bullet 3 not sure if it is needed or not.

        /* ---- and now some indented code ---- */
        a = a + 1;
        /* ---- cut here ---- */

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

## This demos one, maybe two issues - renumbered bullets

intro sentence before bullets

1. Number one bullet

2. This is number two bullet, it is multi line and has some non-numbered 
   bullets. It is possible the bullets below should be indent more but
   I do not think so (note they show up at the wrong indentation level
   in the output)

   - unnumbered bullet 1
   - unnumbered bullet 2

   Another paragraph for number 2 bullet.

3. This should be the third bullet point, I think it got confused with the 
   non numbered bullets.

   A second paragraph for bullet 3


The end of the text.
@clach04

Just tested new release, rev cd057dc with gist demo and get same behavior.

@trentm
Owner

(Sorry for taking so long to respond here.)

So, two things here. First:

$ cat bar.txt
1. one
2. two
3. three

   trois
$ markdown2 bar.txt
<ol>
<li>one</li>
<li>two</li>
<li><p>three</p>

<p>trois</p></li>
</ol>

Those extra <p> tags are technically a feature, and yes you are correct that the "extra vertical" space is from the default browser styles for p tags. For example, with the following style you don't get the "extra space":

<style>
p {
  margin: 0;
}
</style>

<ol>
<li>one</li>
<li>two</li>
<li><p>three</p>

<p>trois</p></li>
</ol>

A more reasonable style tweak for this might be:

<style>
li p:first-child {    /* no margin-top for *first* p inside an li */
  margin: 0;
}
</style>

<ol>
<li>one</li>
<li>two</li>
<li><p>three</p>

<p>trois</p></li>
</ol>
@trentm
Owner

Second issue:

$ cat bar.txt
1. one
2. two

   - sub one
   - sub two

3. three
$ markdown2 bar.txt
<ol>
<li>one</li>
<li>two</li>
</ol>

<ul>
<li>sub one</li>
<li>sub two</li>
</ul>

<ol>
<li>three</li>
</ol>

The "sub" bullet list is meant to be a sub-list but doesn't end up that way. Perl Markdown.pl gets this right. This is a bug in markdown2.py.

@trentm trentm was assigned Apr 26, 2012
@trentm trentm added a commit that referenced this issue Apr 26, 2012
@trentm [issue #67] Fix an sub-`ul` inside a `ol` not working with an indent …
…less than 4 spaces.
2635478
@trentm
Owner

Fixed. Will be in markdown2 1.4.1. Thanks!

@trentm trentm closed this Apr 26, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment