Git Product home page Git Product logo

Comments (5)

notslang avatar notslang commented on June 30, 2024

When I compile the code samples you give (with marked) I get these:

<ul>
  <li>foo</li>
  <li>
    <p>bar</p>
    <ul>
      <li>baz</li>
      <li>fizz</li>
    </ul>
  </li>
  <li>
    <p>buzz</p>
    <ul>
      <li>qux</li>
    </ul>
  </li>
</ul>
<ul>
  <li>foo</li>
  <li>bar
    <ul>
      <li>baz</li>
      <li>fizz</li>
    </ul>
  </li>
  <li>buzz
    <ul>
      <li>qux</li>
    </ul>
  </li>
</ul>

...so I can't reproduce the "will have two separate lists instead of one" part. Though the removal of the <p> tags around buzz & bar is a little strange, and I'd love to know why that happens.

As for the line following the end of the list: that's a rule from https://github.com/carrot/markdown-styleguide#lists ... If you have a use-case for changing it, then I'd be happy to look into it.

from tidy-markdown.

RangerMauve avatar RangerMauve commented on June 30, 2024

Well, if it's part of the styleguide, then I guess it doesn't really matter what I think. But I was thinking of stuff like the table of contents in a document.

If stuff gets split up a lot, like having some items being in a row, and others being parts of a separate list, then it might not be nice to parse out into a tree, or might just look strange.

The specific use case I had that brought this up is having a list of steps to take, and I had sublists representing branches in what to do (if this then do these).

from tidy-markdown.

 avatar commented on June 30, 2024

I think the issue is that some stylesheets give the <p> a margin-bottom and so the two examples don't end up looking the same in the end.

from tidy-markdown.

mb-dev avatar mb-dev commented on June 30, 2024

This was bothering me as well.

from tidy-markdown.

jlevy avatar jlevy commented on June 30, 2024

Here is the similar issue I've encountered:

$ cat > test1.md
- Foo1
- Foo2
  - Bar1
  - Bar2
- Foo3
$ tidy-markdown < test1.md 
- Foo1
- Foo2

  - Bar1
  - Bar2

- Foo3
$ tidy-markdown --version
2.0.3
$ markdownfmt < test1.md 
-   Foo1
-   Foo2
    -   Bar1
    -   Bar2
-   Foo3
$

It seems this does agree with the style guide, but I guess I don't agree with the style guide in that case, since (1) for long nested lists, it looks rather arbitrary to have the extra newlines; and more critically (2) many formatters behave differently after the newlines are added. See below for GitHub's behavior before and after tidying.

I'm currently using markdownfmt instead, which does not insert the extra newlines (though one certainly might argue about the tabs — but that's yet a different issue 😉 ). Thanks!


  • Foo1
  • Foo2
    • Bar1
    • Bar2
  • Foo

  • Foo1
  • Foo2
    • Bar1
    • Bar2
  • Foo3

from tidy-markdown.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.