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

Attribute "levels" prevents generation #166

Open
PpChailley opened this issue Mar 16, 2023 · 0 comments
Open

Attribute "levels" prevents generation #166

PpChailley opened this issue Mar 16, 2023 · 0 comments

Comments

@PpChailley
Copy link

  1. parameter setting seems to not work
  2. documentation should be updated -> https://packagecontrol.io/packages/MarkdownTOC#control-of-levels-listed-in-toc

How can the issue be reproduced

  • Set configuration item levels="1,2" either in Packages/User/MarkdownTOC.sublime-settings or as a XML comment (<!-- MarkdownTOC style="ordered" levels="1,2" -->)
    • Also tried with syntax levels="[1,2]"
    • Strangely enough, global config file (default values) includes "levels": [1,2,3,4,5,6], which doesn't prevent normal generation
  • Generate or regenerate TOC through Sublime menus

**Using the syntax default.levels="1,2" in XML comment, it works as expected. **
Using similar redundant syntax in config files does not work

"defaults": 
  {
    "default.levels": "1",
    ...
  }

Context

Packages/MarkdownTOC/MarkdownTOC.sublime-settings

{
  "defaults": {
    "autoanchor": false,
    "autolink": false,
    "bracket": "round",
    "levels": [1,2,3,4,5,6],
    "indent": "\t",
    "remove_image": true,
    "link_prefix": "",
    "bullets": ["-"],
    "lowercase": "only_ascii",
    "style": "unordered",
    "uri_encoding": true,
    "markdown_preview": ""
  },
  "id_replacements": [
    {
      "pattern": "\\s+",
      "replacement": "-"
    },
    {
      "pattern": "&lt;|&gt;|&amp;|&apos;|&quot;|&#60;|&#62;|&#38;|&#39;|&#34;|!|#|$|&|'|\\(|\\)|\\*|\\+|,|/|:|;|=|\\?|@|\\[|\\]|`|\"|\\.|\\\\|<|>|{|}|™|®|©|%",
      "replacement": ""
    }
  ],
  "logging": false
}

Packages/User/MarkdownTOC.sublime-settings

{
  "defaults": 
  {
    "autolink": true,
    "autoanchor": true,
    // "bracket": "square",
    // "levels": "1,2",
    "indent": "    ",
    // "remove_image": false,
    // "bullets": "*",
    "style": "unordered",


  },
  "id_replacements": 
  [
    {
      "pattern": "\\s+",
      "replacement": "-"
    },
    {
      "pattern": "&lt;|&gt;|&amp;|&apos;|&quot;|&#60;|&#62;|&#38;|&#39;|&#34;|!|#|$|&|'|\\(|\\)|\\*|\\+|,|/|:|;|=|_|\\?|@|\\[|\\]|`|\"|\\.|<|>|{|}|™|®|©",
      "replacement": ""
    },
    {
      "pattern": "&eacute;|é|&egrave;|è|&ecirc;|ê",
      "replacement": "e"
    },
    {
      "pattern": "&aacute;|&agrave;|à|&acirc;|â",
      "replacement": "a"
    }


  ],

}


What was expected

TOC should be (re)generated with appropriate levels included

What actually occurred

As soon as this config item is specified (either un user config file or XML comment), generating the TOC doesn't work (no change in file)
Strangely, the parameter exists in global config file and it stil works

What was the version of the involved component

Markdown TOC v4.1.2
Sublime text build 4143
win10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant