# Change alignment of embedded TOC

#### jim.g

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 Posted by Brett on 31 Jul, 2017 05:47 PM

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.

-Brett

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

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 Posted by Brett on 12 Aug, 2017 09:15 PM

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

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

### »

#### 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

### Generic

? Show this help Blurs the current field

### Comment Form

r Focus the comment reply box Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

## Recent Discussions

 21 Feb, 2020 11:32 PM Option to use MathJax 3? 20 Feb, 2020 03:12 PM Regular crashes 13 Feb, 2020 09:22 PM Markdown Formatting 11 Feb, 2020 11:53 AM Custom themes not working 10 Feb, 2020 06:48 PM KaTex Preview Update

## Recent Articles

 Using JavaScript in Marked Custom CSS: Writing custom CSS for Marked License code has already been utilized Highlight sentences longer than a certain number of words How do I retrieve a lost license (direct version)