Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Outline Numbering for headings #555

Closed
1 task done
Jerksen opened this issue Nov 21, 2019 · 18 comments
Closed
1 task done

[Feature Request] Outline Numbering for headings #555

Jerksen opened this issue Nov 21, 2019 · 18 comments
Labels
Area: Table of contents Pertaining to table of contents (TOC generation and detection, related heading operations). Issue: Feature Something brand new. Res: Fixed Fix is checked in, but it might be a few weeks until a release.

Comments

@Jerksen
Copy link

Jerksen commented Nov 21, 2019

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.

Use Case 1 - new doc with no numbers

the following document:

# Introduction
## Background

will have numbers prefixed on save or activation

# 1 Introduction
## 1.1 Background

Use Case 2 - update document with existing numbers

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:

TODO

@yzhang-gh
Copy link
Owner

This is a same feature as #457. I am going to leave this open as you provide some concrete examples.

@yzhang-gh yzhang-gh added Res: Duplicate This issue or pull request already exists. Issue: Feature Something brand new. Help wanted Looking for help. labels Nov 22, 2019
@Jerksen
Copy link
Author

Jerksen commented Nov 22, 2019

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.

@ajsjunior
Copy link

This feature could be like Markdown TOC extension does.

@yzhang-gh yzhang-gh added the Area: Table of contents Pertaining to table of contents (TOC generation and detection, related heading operations). label May 3, 2020
yzhang-gh pushed a commit that referenced this issue May 3, 2020
@yzhang-gh
Copy link
Owner

Please see #457 (comment).

@dlidstrom
Copy link

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.

@yzhang-gh
Copy link
Owner

@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.

@yzhang-gh yzhang-gh pinned this issue May 28, 2020
@Huntess

This comment has been minimized.

@yzhang-gh

This comment has been minimized.

@yzhang-gh
Copy link
Owner

numbering

Please try out the dev build.

@yzhang-gh yzhang-gh added the Res: Fixed Fix is checked in, but it might be a few weeks until a release. label May 30, 2020
@guoquan
Copy link

guoquan commented May 30, 2020

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 🤣

@guoquan
Copy link

guoquan commented May 30, 2020

@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.

Interesting workaround. However, decoupling the two functionality would be more preferable.

@yzhang-gh
Copy link
Owner

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 🤔.

@guoquan
Copy link

guoquan commented May 31, 2020

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:

@yzhang-gh
Copy link
Owner

@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.

@ozboss
Copy link

ozboss commented Jun 30, 2020

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.)

@yzhang-gh
Copy link
Owner

@ozboss Please see #714.

@gerardbosch
Copy link

gerardbosch commented Jan 25, 2021

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.

@yzhang-gh
Copy link
Owner

@gerardbosch Thanks for the detailed description. I have created a new issue for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Table of contents Pertaining to table of contents (TOC generation and detection, related heading operations). Issue: Feature Something brand new. Res: Fixed Fix is checked in, but it might be a few weeks until a release.
Projects
None yet
Development

No branches or pull requests

8 participants