Closed adoussot closed 6 years ago
I think that MarkdownTOC just stopped working with the latest ST update (ST3157
).
I've used MarkdownTOC without any problems until today, when it just stopped working, and I didn't change anything in the settings. It's simply not working with files that used it for TOC maintainance up to today.
I get very similar errors from the console:
Traceback (most recent call last):
File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 999, in run_
return self.run(edit)
File "markdowntoc.markdowntoc_update in C:\Users\P.K.Dick\AppData\Roaming\Sublime Text 3\Installed Packages\MarkdownTOC.sublime-package", line 6, in run
File "markdowntoc.markdowntoc_insert in C:\Users\P.K.Dick\AppData\Roaming\Sublime Text 3\Installed Packages\MarkdownTOC.sublime-package", line 85, in find_tag_and_insert
File "markdowntoc.markdowntoc_insert in C:\Users\P.K.Dick\AppData\Roaming\Sublime Text 3\Installed Packages\MarkdownTOC.sublime-package", line 66, in get_toc_open_tag
File "markdowntoc.markdowntoc_insert in C:\Users\P.K.Dick\AppData\Roaming\Sublime Text 3\Installed Packages\MarkdownTOC.sublime-package", line 383, in get_attributes_from
KeyError: 'lowercase_only_ascii'
The KeyError
seems to show up just with any settings.
I didn't set any custom settings in my User file, but I use inline settings in the comment tags:
<!-- MarkdownTOC autolink="true" bracket="round" autoanchor="false" lowercase="true" lowercase_only_ascii="true" uri_encoding="true" depth="3" -->
<!-- /MarkdownTOC -->
And this produces the error pasted above.
But if I use the plain tags, without options, it works.
Something seems to have changed in the way ST runs the MarkdownTOC code that parses tags settings.
So it seems that the issue reported by @adoussot and the one I'm facing are both linked to a more general problem due to ST update.
depth
and lowercase_only_ascii
are deprecated since the today release. We have either to use the level
(and lowercase
) attribute or remove it. Everything is explained here: https://github.com/naokazuterada/MarkdownTOC/releases,
default_depth is deprecated, use defaults.levels instead lowercase_only_ascii is deprecated, use lowercase instead with new value format
Thanks for the link @adoussot , after correcting the inline options everything works again.
I didn't get any Package-Update message for this MAJOR version update of MarkdownTOC, so it went by unnoticed.
Out of scope of this ISSUE: this is strange... my sublime didn't also show any upgrade message even if it should according to this Messaging documentation and the MarkdownTOC's messages.json file.
@adoussot
Thanks for reporting, and sorry...
It looks like that sublime.load_settings
doesn't merge recursively. I will check ASAP.
TEMPORALLY WORK AROUND Copying and pasting whole Default Settings into your User Settings will works. Also you should restart Sublime Text.
Don't apalogies. That's what reporting is made for :octocat:. Thanks for your work!
@adoussot I think the problem may fixed with 8cff52d79e43b2d5a976bf5ee4b6f0cd7775e526. 3.0.1 will release soon.
I will close this issue but please inform me (maybe another issue) if 3.0.1 message didn't appear again in your environment. Of course, I will also watch carefully on my env. 👀
After the 3.0.1 update it stopped working again. As mentioned before, I don't use custom settings, just inline settings in the comments.
I had already adjusted them to work with 3.0.0, and they were working fine, but now the TOC is not updated/created. I've checked all the settings key and values and they seem to conform with the doc specs:
<!-- MarkdownTOC autolink="true" bracket="round" autoanchor="false" lowercase="only_ascii" uri_encoding="true" levels="1,2,3" -->
Very strange: if I create a User settings files with any setting, it works again.
It won't work unless a user settings file exists with at lease a valid setting. I've added:
{
"logging": false
}
to my setting file.
Note: if the file is empty it won't work, nor if if the file contains just a comment line — it must contain some valid MarkdownTOC setting.
I've closed and reopned ST many times, just to make sure it wasn't a refresh problem of sorts, but not, the problem has to do with the presence of a custom settings file for MarkdownTOC.
@tajmone Thanks for reporting.
I made a mistake again. Sorry...
I hope 3.0.2 fix your problem. (actually the version will be 2018.03.22.13.09.14
or something like that)
How can the issue be reproduced
MarkdownTOC.sublime-settings
MarkdownTOC.sublime-settings
<!-- MarkdownTOC -->
headerWhat was expected
What actually occurred
in the console: the below exception occurs
"levels": [1,2,3,4,5,6],
configuration field toMarkdownTOC.sublime-settings
and resave the file. I have the below exceptionWhat was the version of the involved component