Nested list syntax highlighting for Markdown, MultiMarkdown, Draftsdown

I’m a new Drafts user and I’m finding it to be a really powerful tool.

I like the various Markdown syntaxes (I’m currently using both Draftsdown from @nahumck), however I frequently use nested list and often don’t succeed in putting the requisite four space of indentation to tell the parser that the list item should be nested. Do any of the Markdown syntaxes provide some kind text highlighting or other visual queue to indicate when a list item has been properly indented for nesting?

There was a previous discussion on the forums around this topic in May. @agiletortoise suggested a custom syntax could be created for this. Before I attempted to do such a thing, I thought I’d ask around to see if there was a reason it doesn’t exist already (difficulty of implementation, lack of interest, etc.)

best,
-Adam

2 Likes

Typically the best way to indent is to use the tab key. Markdown supports a single tab character as an indent string for nested lists.

But default, tab key inserts a tab. Is is an option to use spaces if preferred (in editor settings), and if you want spaces, just have Drafts set to insert 4 spaces instead of a tab.

You can also use the Indent/Outdent actions that ship with Drafts in the Editing action group. These will indent the selected lines, regardless of where the cursor is currently located on the line (by default these are bound to the keyboard shortcuts cmd-] and cmd-[)

2 Likes

I’ll reflect I’m often caught out by this.

1 Like

Thanks @agiletortoise. I’m happy to use tabs rather than 4 spaces, but I’d still be keen to get some kind of visual cue that the list item will be rendered as nested.

I tried using the tab key with Draftsdown, but didn’t get the behavior I was looking for. Hitting enter and tab leaves the list bullet at the same level and puts the tab after the bullet. You can, of course, move the cursor manually in front of the bullet and hit tab or select the line and hit cmd-]. This feels a little clunky, but if it’s the only option, I’m happy to do it.

You could change the keyboard shortcut to trigger the Indent action to be the tab character.

This would override the insertion of the tab character at the current position when pressing the tab key, and instead trigger the action.

1 Like

where can this be done on drafts macbook? I don’t see any option to set keyboard shortcuts in settings

Edit the action and you will see the options shown in the screenshot above.

Sorry I’m completely new to drafts. Can you tell me how to reach the action from drafts main window?

Have a read through the following pages in the documentation.

Note the first also includes a link to a video that might help too.