Add line breaks to nested lists in Markdown
Asked Answered
M

1

16

I am new to Markdown and stuck. As of now, I am learning to be honest with Markdown itself using the Jekryllrb platform - I use the same for my blog via Octopress; however, I am finding it difficult to add a line break after a nested sublist (unordered) to it's superlist (ordered). Here is the sample:

1. [Lucideus Tech](http://www.lucideus.com) - 2011 - 2012 (1 Year)
    - Security Analyst
    - R&D @Lucideus Labs
    - Web Application Penetration Tester  
2. [CTG Security Solutions](http://www.ctgsecuritysolutions.com) - 2012 (8 Months)
    - Trainer Scheduler
    - Web Application Security Trainer  
3. Defencely Cloud Security Pvt. Ltd. - 2013 to Present (2015)
    - Red Team Lead
    - Web Application Security Specialist
    - Technical Specialist and SPOC @Application Security  

How do I add a line break after each of the ending sublists to keep them all neat, since if not, it all looks out of context and ridicules the styling?

Maimonides answered 25/6, 2015 at 0:8 Comment(2)
Can you add a screenshot to explain your question? Do you want vertical whitespace between, for example, "Web Application Penetration Tester" and "CTG Security Solutions"?Halfcocked
Yes, a vertical one on those you have mentioned ( a new paragraph). Here's the current setting of how it looks like. <img src="s23.postimg.org/uz6ujmqtn/badmarkup.png" width="100" height="100"> I would also like a solution for a new line feed, which is a new line and not an entire new paragraph (<br/>Maimonides
H
25

Adding <br> tags in Markdown is somewhat unintuitive because of the way it handles paragraphs. From Paragraphs and Line Breaks on the syntax page:

When you do want to insert a <br /> break tag using Markdown, you end a line with two or more spaces, then type return.

This answers your second question.

The first is a bit trickier, and it relates back to Markdown's design goals, as explained in the Inline HTML section of that same document:

Markdown’s syntax is intended for one purpose: to be used as a format for writing for the web.

Markdown is not a replacement for HTML, or even close to it … The idea for Markdown is to make it easy to read, write, and edit prose. HTML is a publishing format; Markdown is a writing format.

Adding space between those list items is a styling question, not a semantic one. Markdown doesn't say anything about styling; it is entirely focused on writing, and therefore on semantics.

I believe that the best way to add your vertical space is to do it by applying CSS on the HTML output from Markdown, for example by styling <ul> tags contained in <li> tags, e.g.

li > ul {
  padding-bottom: 0.5em;
}
Halfcocked answered 25/6, 2015 at 11:58 Comment(3)
This answers the question which means by default, there is no way I could add a space between the needed new line <li> elements after having finished with <ul> elements which are part of the sublists of it's superlist (the superlist itself being the <li>). I was wondering to style the padding, I should change the octopress sass folder and the folders thereneath?Maimonides
@ShritamBhowmick, I don't believe that there's a way to add space between these list items in Markdown. CSS is an appropriate tool (probably the best one) to use when styling HTML. Does this answer your question?Halfcocked
yes, it does. I was curious if I could alter some files at /sass/ directories on octopress installations to make this one work out.Maimonides

© 2022 - 2024 — McMap. All rights reserved.