Pandoc Markdown to HTML: how to increase margin of list items?

Viewed 64

I am currently using the following setting to convert Markdown to HTML:

-s -t html5

This renders list items too narrow for me and I would like to increase the margin between the list items.

Is there any way to do so?

2 Answers

The simplest way to achieve this is to add additional CSS to the output HTML.

  1. Create style.html file with the following content.

    <style>
      li:not(:last-child) { margin-bottom: 50px; }
    </style>
    
  2. Add -H style.html to include the file in the HTML header part. For example:

    $ pandoc main.md -t html5 -o main.html -H style.html
    

Note that there are many other ways to include additional CSS to the output HTML file (for example you may simply put the <style> tag inside your markdown file). Check out this question for more info: Inline CSS with Pandoc

Pandoc distinguishes between "tight" and "loose" lists in Markdown:

This list is "tight":

- one
- two

This list is "loose" (note the extra blank line):

- one

- two

See here for a method to switch from loose to tight lists; replace Plain with Para (and vice versa) in the given code to go from tight to loose.

Related