naokazuterada / MarkdownTOC

SublimeText3 plugin which generate a table of contents (TOC) in a markdown document.
https://packagecontrol.io/packages/MarkdownTOC
MIT License
301 stars 48 forks source link

feature_request(option): ids of parent headers in repeated ids #144

Open Kristinita opened 4 years ago

Kristinita commented 4 years ago

1. Summary

It would be nice, if would be implemented an option: adding ids of parent headers for repeated ids instead of numbers (1, 2 and so on).

2. MCVE

2.1. Data

# Astronomy

## NotRecommended

# Geography

## NotRecommended

2.2. Steps to reproduce

I move carriage to the beginning of KiraExampleTOC.mdCtrl+Shift+P (⌘⇧p for Mac) → MarkdownTOC: InsertTOC.

2.3. Current behavior

<!-- MarkdownTOC -->

1. [Astronomy](#Astronomy)
    1. [NotRecommended](#NotRecommended)
1. [Geography](#Geography)
    1. [NotRecommended](#NotRecommended-1)

<!-- /MarkdownTOC -->

<a id="Astronomy"></a>
# Astronomy

<a id="NotRecommended"></a>
## NotRecommended

<a id="Geography"></a>
# Geography

<a id="NotRecommended-1"></a>
## NotRecommended

2.4. Expected behavior

<!-- MarkdownTOC -->

1. [Astronomy](#Astronomy)
    1. [NotRecommended](#NotRecommended-Astronomy)
1. [Geography](#Geography)
    1. [NotRecommended](#NotRecommended-Geography)

<!-- /MarkdownTOC -->

<a id="Astronomy"></a>
# Astronomy

<a id="NotRecommended-Astronomy"></a>
## NotRecommended

<a id="Geography"></a>
# Geography

<a id="NotRecommended-Geography"></a>
## NotRecommended

3. Argumentation

This option would be useful for constantly updated files with numerous duplicate headers. My books list (for intellectual gaming practice) — example of such a file.

3.1. Informativity

#NotRecommended-Geography is more informative, sensible id name, than #NotRecommended-1.

3.2. Permalinks

  1. Currently: I share permalink with #NotRecommended-1 → I add another NotRecommended headers to KiraExampleTOC.md#NotRecommended-1 now be #NotRecommended-2 or #NotRecommended-3 → the shared permalink will link to another header.
  2. Expected: #NotRecommended-Geography will not change, if I add another NotRecommended headers to file. Permalink with #NotRecommended-Geography will be permanent.

Thanks.