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

Adding a TOC ignore above the TOC removes unique settings #41

Open
TrevorSayre opened this issue Oct 13, 2020 · 1 comment
Open

Adding a TOC ignore above the TOC removes unique settings #41

TrevorSayre opened this issue Oct 13, 2020 · 1 comment
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@TrevorSayre
Copy link

TrevorSayre commented Oct 13, 2020

If I have a setup like this:

<!-- prettier-ignore-start -->
<!-- TOC ignore:true -->
## Table of Contents
<!-- prettier-ignore-end -->

<!-- TOC depthFrom:2 depthTo:3 updateOnSave:false -->

- [Resources](#resources)
- [Develop](#develop)
  - [Run Locally](#run-locally)
  - [Add Command](#add-command)
  - [Add Client Event](#add-client-event)
- [Deploy](#deploy)
  - [Deploy Issues](#deploy-issues)
- [ToDo](#todo)
  - [Cleanup Tasks](#cleanup-tasks)
  - [Future Work](#future-work)

<!-- /TOC -->

When I trigger the command to Insert/Update, the unique settings are lost.

That is:

<!-- TOC depthFrom:2 depthTo:3 updateOnSave:false -->

is changed to:

<!-- TOC -->

Removing the TOC ignore line <!-- TOC ignore:true --> prevents this from happening.

However, in my specific setup I would like to prevent the ## Table of Contents section from being added while retaining the unique settings on the TOC.

This can be addressed by adding the unique settings to a VSCode workspace preferences file, but this is not ideal. Other markdown files in the workspace might need different unique settings.

I have confirmed the prettier-ignore lines are not causing the issue, only the <!-- TOC ignore:true --> line. The prettier-ignore is needed to prevent my code formatter from adding a blank line between the <!-- TOC ignore:true --> and the heading I want to ignore (## Table of Contents).

VSCode:

Version: 1.49.3
Commit: 2af051012b66169dde0c4dfae3f5ef48f787ff69
Date: 2020-10-02T17:54:06.165Z (1 wk ago)
Electron: 9.2.1
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0
OS: Darwin x64 19.6.0

markdown-toc

Version: v3.0.12

OS:

Version: macOS Catalina 10.15.7
@TrevorSayre
Copy link
Author

TrevorSayre commented Oct 13, 2020

I noticed there is a similar comment here: #40 (comment)

It states that:

the extension cannot differentiate the first <!--TOC orderedlist:true--> with <!-- TOC ignore:true -->

Perhaps a solution could be to change how ignore comments are structured? Instead of <!-- TOC ignore:true --> consider <!-- TOC-ignore --> so that the extension can differentiate these comments.

@huntertran huntertran added the enhancement New feature or request label Oct 14, 2020
@huntertran huntertran added this to the v3.1.0 milestone Oct 14, 2020
@huntertran huntertran self-assigned this Oct 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants