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

Attribute 'compatible' #141

Open naokazuterada opened 5 years ago

naokazuterada commented 5 years ago

Purpose

Provide end users with easy configuration of configuration for various sites(GitHub, Gitlab, Bitbucket).

How important it is

Current configurations are complex.

Ref: https://github.com/naokazuterada/MarkdownTOC/issues/139#issuecomment-486988479

Ideal implementation

<!-- MarkdownTOC compatibility="github" -->

is shorthand for

<!-- MarkdownTOC autolink="true" bracket="round" lowercase="only_ascii" -->

Notes

<!-- MarkdownTOC compatibility="github" levels="1,2,3" -->
tajmone commented 5 years ago

GitHub Settings

@naokazuterada, today I've encounted some more edge-case headings that required customizing my MarkdownTOC settings:

    {
      // remove trailing hyphens:
      "pattern": "\\-+$",
      "replacement": ""
    },
    {
      // reduce consecutive hyphens:
      "pattern": "\\-{2,}",
      "replacement": "-"
    },

Examples of headings that require this patterns:

heading GitHub anchor
# Lang ( Go ) #lang-go

without the above substitutions, the generated link would be #lang--go--.

Possibly there might still be some edge-cases lurking in the dark — which only confirms that managing manual settings for all Git services is quite cumbersome, whereas having server configurations is going to make life much easier, especially with package updates fixing any new uncovered incompatiblity edge case.

naokazuterada commented 5 years ago

@tajmone Thank you for the reference case. It was very valuable. I do not know that it will be possible with my effort to support all services, but I understood the importance of this feature. It would be able to obtain the required function by making the algorithm of ID conversion extensible and updating it little by little in the future. I agree. I take this into my TODO list. 👍