1

In markdown you can create a list as follows:

Some Text

* Item 1
* Item 2

Which will render as follows:

Rendered

Is there a way to remove the line return in between the text and the bulleted items like this:

WithoutIndent

These SO questions here and here show how to do it in html / css, but won't work for markdown.

  • 3
    I do not think this is supported in markdown. CSS is far more powerful, mostly for special effects. Why do you need this in the typical Stack Overflow answer? – Cody Gray Aug 6 '13 at 14:29
  • Same reason we want lists: clarity. It would just be nice to have if possible. I think it's good to keep blocks of text together which are logically related. In the first example, Some Text is much more logically related to its child items than it is to Which will render as follows, but they are spaced equally far apart. Maybe its just personal preference, but I think it enhances readability. – KyleMit Aug 6 '13 at 14:34
  • 1
    If you want to keep blocks of markdown separated, you could always use a horizontal line (---) – Lix Aug 6 '13 at 14:57
  • (See my comment to minitech's hack...) – Arjan Aug 6 '13 at 18:41
2

You can do this using a <div>; although it doesn’t appear in the rendered HTML, it does stop your text from being turned into a paragraph.

<div>
Hello

<ul>
<li>world</li>
</ul>
</div>
Hello
  • world

(Don’t bother.)

  • Indeed, please don't bother, but let's stick to the formatting that the team has implemented. Hacks like these might very well break in the future. (Also, the Markdown source is horrible.) – Arjan Aug 6 '13 at 17:54
  • 1
    @Arjan: This is pretty well-defined behaviour, no? If SE more or less adheres to Markdown, this will continue to work. It’s not a hack, just not very convenient. – Ry- Aug 6 '13 at 18:55
  • 1
    I disagree. "For any markup that is not covered by Markdown’s syntax, you simply use HTML itself" -- the above is not about that: lists are very much covered by Markdown, and to me the above is just a hack to get some specific formatting. Bad, in my book, if only as the CSS on the regular site, the mobile theme, and the new apps is different, and might some day change the looks of lists. Also, you're relying on stripping of non-whitelisted tags to still somehow preserve the HTML mode during further parsing. Not sure if that's defined behaviour? – Arjan Aug 6 '13 at 19:51
  • @Arjan: It’s not relying on stripping anything; this would work fine if the <div> was still in there. Anyways, I’d argue that this would actually be useful in the cases where you don’t want a paragraph, which seems to be most of these… and in that case, it’s semantically correct, too. – Ry- Aug 6 '13 at 19:55
  • I meant: if the <div> would be stripped first, before the parser decided it was handling an embedded HTML fragment, then the Hello would still be Markdown (and only the <ul> would be embedded HTML), and gone is the hack? But that's just theory; I above all find hacks just for formatting bad practice, but then I'm repeating myself. – Arjan Aug 6 '13 at 20:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .