Change alignment of embedded TOC

jim.g's Avatar


30 Jul, 2017 06:31 PM

I did a search for this, but didn't find anything. I'm sorry if I missed something and this is a duplicate request.

I've embedded my TOC in my note using the <!--TOC--> syntax. Is there a way to shift the alignment of the TOC headings closer to the left margin? I often start with H2 or H3 headings as the H1 and H2 render text that I find too large.

I use Bear and just discovered your app. It's really a fine piece of work, and pairs wonderfully with Bear.

Thank you.

  1. Support Staff 1 Posted by Brett on 31 Jul, 2017 05:47 PM

    Brett's Avatar

    So the main issue here is that with notes that start at h2 or h3, the
    TOC has empty list items for the preceding headline levels. These will
    be padded in even though they're blank. I've added a routine just now
    for the next update that will clean these and move lists that start
    indented up to the top level. In the meantime, the following snippet
    could be placed in Preferences->Style->Additional CSS (Edit CSS button)
    to handle TOCs generated from notes starting at level 2:

    #wrapper #mkreplaced-toc { margin:0; padding:0;}
    #wrapper #mkreplaced-toc>li>ul {margin-left: 0;}

    The first line will fix the overall spacing issue, the second will move
    the first indented level out to the left.

    Let me know if that helps.


  2. 2 Posted by jim.g on 12 Aug, 2017 08:44 PM

    jim.g's Avatar

    Thanks Brett, that works well for starting with H2. If I start with H1, it's at the left margin same as H2. Is there a way to code it so that H2 indents if you start with H1 but otherwise align H2 at the left margin?

  3. Support Staff 3 Posted by Brett on 12 Aug, 2017 09:15 PM

    Brett's Avatar

    If my testing is correct, that's the way it will work after the next
    update. Not something that can be accomplished easily with CSS alone.

    Brett Terpstra

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac