Aidurber / obsidian-plugin-dynamic-toc

An Obsidian plugin for creating Tables of Contents that stay updated with your document
MIT License
269 stars 41 forks source link

FR: Wikipedia style lists. #59

Open spoon-m4a opened 2 years ago

spoon-m4a commented 2 years ago

I really like the Number list style, but I wonder if it would be possible to have it in the Wikipedia style, where you have 1. for your main entry, and children would be prefixed with 1.1, 1.2, etc. I've attached an image for reference

Number(Wiki style)

Aidurber commented 2 years ago

Markdown doesn't help us out by default here. I'd need to build a custom heading renderer. I'll add it to the backlog and have a play around when I can find the time.

Thanks for the suggestion!

Sandwich1699975 commented 2 years ago

For anyone who really likes this feature, you can directly apply this to your whole document with some custom css:

https://help.obsidian.md/How+to/Add+custom+styles

h2:before {
    counter-increment: h2counter;
    content: counter(h2counter) "\0000a0\0000a0";
}

h3:before {
    counter-increment: h3counter;
    content: counter(h2counter) "." counter(h3counter) "\0000a0\0000a0";
}

h4:before {
    counter-increment: h4counter;
    content: counter(h2counter) "." counter(h3counter) "." counter(h4counter) "\0000a0\0000a0";
}

h5:before {
    counter-increment: h5counter;
    content: counter(h2counter) "." counter(h3counter) "." counter(h4counter) "." counter(h5counter) "\0000a0\0000a0";
}

h6:before {
    counter-increment: h6counter;
    content: counter(h2counter) "." counter(h3counter) "." counter(h4counter) "." counter(h5counter) "." counter(h6counter) "\0000a0\0000a0";
}

Which looks like

image