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

escaping &_acute and &_tilde #79

Closed ghost closed 7 years ago

ghost commented 8 years ago

Even with "default_lowercase_only_ascii": truethe only way to exclude Spanish "tildes" (Camión, último) and España was by adding one by one id_replacements for each letter. My user-settings look like this:

{
  "default_autolink": true,
  "default_bracket": "round",
  "default_depth": 2,
  "default_autoanchor": true,
  "default_lowercase_only_ascii": true,
  "default_style": "unordered",
  "id_replacements": {
    "-": " ",
    "a": ["&aacute", "á"],
    "e": ["&eacute", "é"],
    "i": ["&iacute", "í"],
    "o": ["&oacute", "ó"],
    "u": ["&uacute", "ú"],
    "A": ["&Aacute", "Á"],
    "E": ["&Eacute", "É"],
    "I": ["&Iacute", "Í"],
    "O": ["&Oacute", "Ó"],
    "U": ["&Uacute", "Ú"],
    "n": ["&ntilde", "ñ"],
    "N": ["&ntilde", "Ñ"],

    "" : ["&lt;","&gt;","&amp;","&apos;","&quot;","&#60;","&#62;","&#38;","&#39;","&#34;","!","#","$","&","'","(",")","*","+",",","/",":",";","=","?","@","[","]","`","\"", ".","<",">","{","}","™","®","©"]
    }

}

Any idea to make this more efficiently? There are still a bunch of "weird" characters that won't work as anchors in a html file.

jonasbn commented 7 years ago

hmmmm @naokazuterada is it possible to detect the encoding of the text/file in SL? - based on that a conversion could be made to a simpler format. I work with DNS and punycode springs to mind as a solution to a somewhat similar problem.

jonasbn commented 7 years ago

See also: issue #56

naokazuterada commented 7 years ago

@ghost

I'm sooo sorry for late reply. 🤕

Today I added a new feature URI encoding. And I saw all links are working correctly on Gitlab(sample) and Github(sample).

I hope this fix your problem. 🦊 I'm looking forward to your response if you don't mind.

jonasbn commented 7 years ago

Hi @naokazuterada,

I recommend we close this issue, lets reopen if the issue persists. An expected fix has been implemented and shipped.

naokazuterada commented 7 years ago

@jonasbn OK, thanks. I close this.