This isn't an issue, but a feature request. The extension is fantastic, but the only thing missing for me is automatic numbering of headings, that can be updated on Save.
the following document:
# Introduction
## Background
will have numbers prefixed on save or activation
# 1 Introduction
## 1.1 Background
the following document will become:
# 1 Introduction
## 1.1 Background
## Open Issues
## 1.2 Team Composition
will have new numbers added and old numbers changed on save or activation
# 1 Introduction
## 1.1 Background
## 1.2 Open Issues
## 1.3 Team Composition
The numbers here should match those in the TOC
By @yzhang-gh:
This is a same feature as #457. I am going to leave this open as you provide some concrete examples.
Sorry, I did a quick search for duplicates and didn't see any. I'm hoping to find some time to try and help with this in the next few weeks, but don't have any vscode extension experience.
This feature could be like Markdown TOC extension does.
Please see https://github.com/yzhang-gh/vscode-markdown/issues/457#issuecomment-623103838.
This is indeed a very nice feature. However, it will number from 1.x and never reach 2.x, if one wants to follow markdown "rules" to only have a single top-level header. Perhaps, if the top-level header is omitted from toc, then the second level headers could be 1.x, 2.x, etc.
@dlidstrom Thanks for the feedback.
We have many ways to exclude a heading from the TOC (options toc.levels, toc.omittedFromToc and <!-- omit in toc --> comment). I am considering only add numbers to those valid TOC headings. I will take a look this weekend.
Found a bug, when a number gets to two digits, the Add / update section numbers command adds another number. repeatedly
## 1.9. test 4
## 1.10. 1.10. test 5
## 1.11. 1.11. test 6
this happens at any level
# 14. 14. test 1
# 15. 15. test 2
@Huntess please try out the dev build. (#701)

Please try out the dev build.
TOC is not updated while the headings are changed.
However, when I update TOC manually or save the file, it will be updated.
Just the inconsistency before saving makes me a bit nervous 馃ぃ
@dlidstrom Thanks for the feedback.
We have many ways to exclude a heading from the TOC (options
toc.levels,toc.omittedFromTocand<!-- omit in toc -->comment). I am considering only add numbers to those valid TOC headings. I will take a look this weekend.
Interesting workaround. However, decoupling the two functionality would be more preferable.
TOC is not updated while the headings are changed.
However, when I update TOC manually or save the file, it will be updated.
This is by design. They are independent commands. You can undo a single change if any one of them doesn't work as expected.
However, decoupling the two functionality would be more preferable.
Please provide concrete examples as in this original post. Otherwise it is not very convincing 馃.
TOC is not updated while the headings are changed.
However, when I update TOC manually or save the file, it will be updated.This is by design. They are independent commands. You can undo a single change if any one of them doesn't work as expected.
However, decoupling the two functionality would be more preferable.
Please provide concrete examples as in this original post. Otherwise it is not very convincing 馃.
For example, if I want a TOC with the first level title while hoping to have numbering headings from the second level and on.
Something as follows:
@guoquan Thanks. Although I am not very convinced by this example (as a user may want any strange TOC #403), let's see whether other users have a similar request.
A common template of using Markdown to write a blog is
# Title <!-- omit in toc -->
#### Table of Contents <!-- omit in toc -->
- 1. Real Section 1
- 1.1. Section 1.1
...
## 1. Real Section 1
### 1.1. Section 1.1
...
The current implementation is optimized for this case.
Is it possible to deactivate the last point in the numbers? So that the numbering is just like described in the first post.
(e.g. 1.1 instead of 1.1.)
@ozboss Please see #714.
Hi there, is it possible somehow to define or set a specific start numbering for auto-generated section numbers?
Instead of starting by 1., would it somehow be possible to set it to another number, or a prefix number?
For example, something like <!-- toc number prefix: 4 --> and generate then 4.1., 4.2....?
My use case is that I have several .md files, sorted by name, where each file starts with a number by itself, e.g. 1. Intro.md, 2. Body.md, 3. Conclusion.md. Then I would like that inside every file I could manually set the corresponding numbering schema.
@gerardbosch Thanks for the detailed description. I have created a new issue for that.
Most helpful comment
Please try out the dev build.