How to leave gaps between some items in a list?

Things I have tried

Background: I’m moving to Obsidian from Bear, and also regularly type MD files in Vim. Obsidian is brilliant, but I’m having this one problem…

I make heavy use of nested lists, for example to take notes during meetings, or to plan various projects… Previously, I just left a blank line between list items when I moved from one area to another. For example:

- Meeting Topics:
    - Topic 1:
        - Item 1.
        - Item 2.

        - Item 3.
    - Topic 2.

This worked well when I was just viewing the Markdown files in Bear or Vim, but of course Obsidian treats these as “loose” lists and so the gap between “Item 2” and “item 3” is lost, like this:

- Meeting Topics:
    - Topic 1:

        - Item 1.

        - Item 2.

        - Item 3.

    - Topic 2.

Since the “separator” between items 2 and 3 is semantically important (I always want to leave a blank line when moving from one related set of notes to another within the outline), I want some way to show this gap when my MD is rendered in Obsidian.

I tried playing around with various options to see if there’s any way for Obsidian to render a gap between list items, and found one workaround: if you type “#” between two list items, the list is rendered correctly – for example, the following text:

- Topic 1.
    - Item 1.
    - Item 2.
    #
    - Item 3.
- Topic 2.

will be rendered as:

- Topic 1.
    - Item 1.
    - Item 2.
    
    - Item 3.
- Topic 2.

This is exactly what I want. But unfortunately the Obsidian editor makes it really difficult to type a “#” by itself, since that character is used for tags and the tag auto-complete logic means you have to fight the system to enter just a “#” on a line by itself.

What I’m trying to do

Has anyone got any suggestions for other ways to enter a list that gets rendered like this:

- Topic 1.
    - Item 1.
    - Item 2.
    
    - Item 3.
- Topic 2.

without having to work around the tag auto-completer to type a “#”?

Thanks!

  • Erik.

I do not have a need for the breaks and fully understand the hashtag being a pain with the auto complete.

I am not sure if this is right, but I believe you can put <br>. Unfortunately it is still extra work.

Hopefully someone else will chime in.

Sadly, this is due to the way Markdown is processed. Please see GitHub Flavored Markdown Spec.

Thanks for the suggestion, Harvison – <br> doesn’t work, but <p> does. Unfortunately, that’s a lot of typing and clutters up the text when in edit mode. It does work, though…

Oh, I completely realise that you can’t leave blank lines in a list in MD given the way the MD standard is defined – and I’m not asking the Obsidian devs to break with that standard.

I was just hoping there’d be some workaround that lets you insert a blank line without having to do anything weird like inserting <p>. Like if the renderer simply display a line with “.” by itself as a blank line, or somehow you could type a “#” without having to fight against the tag auto-completer…

The “cleanest” solution might be to look for or write CSS that gives you the appearance you want without needing to insert fake blank lines.

Alternatively you may want to try pasting in whitespace characters: Whitespace Characters — Copy and Paste Invisible Characters

Fourth, you could try creating a macro with something like Espanso to insert the # symbol
then a space or newline.

Finally, the comment syntax might help (though I don’t think it applies here): Format your notes

How about making a template like:

<blank line>
<tab># <a space, to avoid auto-completer>   

and assigning a hotkey using ‘Hotkeys for templates’ plugin?

or simply typing “##” ?( it may depend on your css)

Erik. I share your need.

I add %% %% (note the space) on a ‘new line’ (shift-enter). It works for me.

1. This works for me.
	- This is the first of the sub-items
%% %%
	- Second
	- Third.

Let me know if that was what you’re looking for.

1 Like

Thanks for the suggestion, Geffrey, but I couldn’t get that to work. I copied the text exactly as you suggested, and because the %% %% is at the start of a line it breaks the list formatting and everything appears on a single line, like this:

This works for me. - This is the first of the sub-items. - Second - Third.

I also tried doing shift-enter between the “Third is the first of the sub-items” and the && && but that didn’t help either.

If I indent the %% %% line to be in line with the hyphens, then the list formats correctly, but there’s still no gap shown between the first and second bullet points in preview mode. So it looks as though your comment is showing in edit mode but doesn’t affect what’s show in preview mode at all.

Thanks for the idea, though. I’m learning more about Obsidian every day – now I know about comments!

Thanks for all the suggestions, ryanjamurphy – you’ve given me some good ideas there, and more things to learn about. While I can’t see how CSS itself would help (it needs some way of identifying the points where a gap should be left), your idea of having a macro has given me a few ideas…

Thanks, Liz, for the great suggestions – I tried playing with templates but didn’t think to include a space or a double # to stop the auto-completer popping up. I think that might work…

Sorry to hear it didn’t work.

I think your best bet it to add <br>'s wherever you want the line to break. However, I experience it to be inconsistent and can’t seem to figure out the pattern.

Here is an example of the markup and the preview.

1 Like

Thanks everyone for the great suggestions. I’ve figured out a solution that works most of the time - firstly, I added the following CSS snippet so that the “#” leaders aren’t so insanely huge in edit mode:

.cm-formatting-header {
    color: #e0e0e0 !important;
    font-size: 12pt !important
}

This isn’t strictly necessary, but if I was going to use them as separators between list items I wanted them to be subtle – and I also didn’t like the way those characters are so huge in headings as they distract from the headings themselves.

I then installed the templates plugin, and created a template I called “Blank line in list” with the following contents:


 # 
 - 

The first line is blank, and both the “#” and the “-” have a space in front of them.

Finally, I installed the Hotkeys for Templates plugin and setup a hotkey to insert this template whenever I press Command-Shift-Enter.

So now I can start typing a list, like this:

Things to do tomorrow:
 - Fix back door latch.
 - Carry duck food up from car.

and at the end of that second list item, simply press Command-Shift-Enter to insert a blank line into the list, like this:

Things to do tomorrow:
 - Fix back door latch.
 - Carry duck food up from car.
 # 
 - 

So with one keystroke, I’ve inserted a # line into the list (which Obsidian renders as a gap between the two list items) and am ready to start typing the next list item.

The only thing that doesn’t work well with this is that it’s limited to top-level list items. If I have an indented list, I have to go and manually edit the lines to get them to indent correctly. For example:

Item 1
 - Item 1.1
 - Item 1.2
    - Item 1.2.1
    - Item 1.2.2

If I type Command-Shift-Enter at the end of the “Item 1.2.2” line, I get the following:

Item 1
 - Item 1.1
 - Item 1.2
    - Item 1.2.1
    - Item 1.2.2
 # 
 - 

Ideally the “#” line and the “-” would be indented to match the item above – but a simple template can’t do that, of course.

I’d like to see if something like SilentVoid’s Templater community plugin can do this – it lets you run arbitrary JavaScript code in a template, and gives access to the Obsidian API, so in theory I could find the indent of the current line and use that to insert the right number of leading spaces to indent the new lines to match…

Anyway, thanks again, everyone – I’m happy with this limited solution for now.

3 Likes

@ewestra and I thought I was the only one concerned with feeding ducks🦆

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.