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

HTML tokens in headers should be ignored #73

Closed lahmatiy closed 8 years ago

lahmatiy commented 8 years ago

In headers (in markdown in general) HTML tokens can be used to escape special symbols. In this case tokens are converting to symbols and stripping from anchor. But currently letters and digits from token inserting into anchor.

Current (actual):

<!-- MarkdownTOC -->

- [&lt;element>](#ltelement)  <!-- wrongly `lt` is added -->
- [&#60;element>](#60element)  <!-- wrongly `60` is added -->

<!-- /MarkdownTOC -->

## &lt;element>
## &#60;element>

Expected:

<!-- MarkdownTOC -->

- [&lt;element>](#element)
- [&#60;element>](#element)

<!-- /MarkdownTOC -->

## &lt;element>
## &#60;element>
naokazuterada commented 8 years ago

You can set strings in id_replacement in version 2.1.1.

So, now you will get result you expected with new id_replacement setting like this.

"id_replacements": {
  "" : ["&lt;","&#60;","!","#","$","&","'","(",")","*","+",",","/",":",";","=","?","@","[","]","`","\"", ".","<",">","{","}","™","®","©"]
}

Only you have to do is update your plugin, because setting above is included new defaults. Please try it.

lahmatiy commented 8 years ago

@naokazuterada Yes, it's ok now. Thank you!