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

ValueError: list.remove(x): x not in list #145

Closed AntonioGHub closed 4 years ago

AntonioGHub commented 4 years ago

How can the issue be reproduced

Windows 10. The custom config file is in

Sublime Text 3\Data\Packages\User\MarkdownTOC.sublime-settings

and has the following content


{
  "defaults": {
    "autolink": true,
    "bracket": "square",
    "levels": [1,2,3],
    "indent": "    ",
    "remove_image": false,
    "bullets": "*",
    "style": "ordered",
    "lowercase": "only_ascii",
    "autoanchor":true,
    "link_prefix": "ant-markdowntoc-",
    "bullets": ["-"],
    "lowercase": "only_ascii",
    "style": "unordered",
    "uri_encoding": true,
    "markdown_preview": "github"
  },
  "id_replacements": [
    {
      "pattern": "\\s+",
      "replacement": "-"
    },
    {
      "pattern": "á|é|í|ó|ú|ñ|&lt;|&gt;|&amp;|&apos;|&quot;|&#60;|&#62;|&#38;|&#39;|&#34;|!|#|$|&|'|\\(|\\)|\\*|\\+|,|/|:|;|=|_|\\?|@|\\[|\\]|`|\"|\\.|<|>|{|}|™|®|©",
      "replacement": ""
    }
  ]
}

Try to save any markdown file with a TOC section

What was expected

It should update the TOC and the links alongside the headers

What actually occurred

Up to a few days ago it worked fine, however today I noticed that it doesn't update the TOC. The console shows:

Traceback (most recent call last):
  File "C:\R\ANT10_VERBATIM\Z_PROGRAMMI\Sublime Text 3\sublime_plugin.py", line 1088, in run_
    return self.run(edit)
  File "C:\R\ANT10_VERBATIM\Z_PROGRAMMI\Sublime Text 3\Data\Installed Packages\MarkdownTOC.sublime-package\markdowntoc/markdowntoc_update.py", line 6, in run
  File "C:\R\ANT10_VERBATIM\Z_PROGRAMMI\Sublime Text 3\Data\Installed Packages\MarkdownTOC.sublime-package\markdowntoc/markdowntoc_insert.py", line 85, in find_tag_and_insert
  File "C:\R\ANT10_VERBATIM\Z_PROGRAMMI\Sublime Text 3\Data\Installed Packages\MarkdownTOC.sublime-package\markdowntoc/markdowntoc_insert.py", line 62, in get_toc_open_tag
  File "C:\R\ANT10_VERBATIM\Z_PROGRAMMI\Sublime Text 3\Data\Installed Packages\MarkdownTOC.sublime-package\markdowntoc/base.py", line 23, in defaults
  File "C:\R\ANT10_VERBATIM\Z_PROGRAMMI\Sublime Text 3\Data\Installed Packages\MarkdownTOC.sublime-package\markdowntoc/base.py", line 13, in settings
ValueError: list.remove(x): x not in list

I know that the v 4. release notes suggest to delete the replacement_id, but in my case it did not change anything. I even deleted the whole content of my preferences.

What was the version of the involved component

I suppose it is version 4. I cannot be sure because the List Packages command is not working on my sublime now.

naokazuterada commented 4 years ago

Sorry for late reply...

I tried to reproduce but couldn't. Does the problem still occur? Of course you tried reinstalling, right?

AntonioGHub commented 4 years ago

Err..., ok, reinstalling worked. By the way it didn't allow me to uninstall the plugin using "package control", because it showed the same error as when I tried to run the plugin: list.remove(x):...

However, the action of manually deleting the package folder, immediately triggered an automatic reinstallation by pacakageControl, and it started working fine!

Thanks!

naokazuterada commented 4 years ago

HI, happy to hear that! It seems to be something wrong outside of plugins...