Closed DoubleW2w closed 1 week ago
Hi
What is the contents of C:\Users\xxxxxx\AppData\Roaming\Anki2\addons21\354124843\meta.json
?
Hi
What is the contents of
C:\Users\xxxxxx\AppData\Roaming\Anki2\addons21\354124843\meta.json
?
这是我的meta.json文件的内容
{
"name": "Simple Markdown",
"mod": 1722443147,
"min_point_version": 230900,
"max_point_version": 231201,
"branch_index": 0,
"disabled": true,
"conflicts": [],
"update_enabled": true
}
You originally posted:
{
"automatic": true,
"wrap_with_p_tags": false,
"extensions": {
"abbr": false,
"attr_list": false,
"def_list": false,
"fenced_code": true,
"footnotes": false,
"md_in_html": false,
"tables": true,
"admonition": false,
"codehilite": true,
"legacy_attrs": false,
"legacy_em": false,
"meta": false,
"nl2br": false,
"sane_lists": false,
"smarty": false,
"toc": false,
"wikilinks": false
}
}
You then edited your reply to the above. So which is it? I recommend deleting and downloading the add-on again.
这是 config.json
{
"automatic": true,
"wrap_with_p_tags": false,
"extensions": {
"abbr": false,
"attr_list": false,
"def_list": false,
"fenced_code": true,
"footnotes": false,
"md_in_html": false,
"tables": true,
"admonition": false,
"codehilite": true,
"legacy_attrs": false,
"legacy_em": false,
"meta": false,
"nl2br": false,
"sane_lists": false,
"smarty": false,
"toc": false,
"wikilinks": false
}
}
这是 meta.json
{
"name": "Simple Markdown",
"mod": 1722443147,
"min_point_version": 230900,
"max_point_version": 231201,
"branch_index": 0,
"disabled": true,
"conflicts": [],
"update_enabled": true
}
我第一次下载后,启动也会出现同样的问题,于是就将这个插件进行删除了,重新安装。
第二次还是出现了弹窗警告。
So config.json
is just the default values. If you update any add-on settings, those updates are stored in meta.json
. This is why I had to put the config inside meta.json
. My point is that the config.json
file barely matters.
Here is what my meta.json
file looks like (yours should be similar):
{
"name": "Simple Markdown",
"mod": 1722443147,
"min_point_version": 230900,
"max_point_version": 231201,
"branch_index": 0,
"disabled": false,
"config": {
"automatic": true,
"extensions": {
"abbr": false,
"admonition": false,
"attr_list": false,
"codehilite": false,
"def_list": true,
"fenced_code": true,
"footnotes": false,
"legacy_attrs": false,
"legacy_em": false,
"md_in_html": false,
"meta": false,
"nl2br": false,
"sane_lists": false,
"smarty": false,
"tables": true,
"toc": false,
"wikilinks": false
},
"wrap_with_p_tags": false
},
"conflicts": [],
"update_enabled": true
}
I am on a Mac, and can confirm that meta.json
is correct. Unfortunately, I do not have a Windows machine to test on. You could try to manually insert your config into meta.json
. Or you could copy my meta.json
.
复制你的meta.json文件后,启动不失败了。 但好像不起作用,是不是要使用特定的卡片?
但我这里并没有产生。可能是我之前删除过。
我看到你的 build.sh 中,并未将 meta.json 放入。这有可能是出错的原因嘛?
Ah, good catch! Since I was developing the add-on on my computer, I already had the correctmeta.json
installed. I updated build.sh
to include meta.json
, rebuilt the add-on, and uploaded it to AnkiWeb. I deleted SimpleMarkdown from my add-ons and reinstalled the new version. But it appears that AnkiWeb is somehow erasing the data in the meta.json
that I uploaded...
You can see in the zip file that I uploaded, everything is correct:
$ unzip -l build.ankiaddon
Archive: build.ankiaddon
Length Date Time Name
--------- ---------- ----- ----
2514 07-09-2024 01:59 README.md
2627 07-31-2024 10:20 markdown_converter.py
32 07-09-2024 00:40 __init__.py
6992 08-04-2024 00:27 test.py
462 07-09-2024 01:59 config.json
4151 07-26-2024 20:31 config.md
282 07-09-2024 00:40 markdown-logo.svg
578 07-09-2024 11:09 meta.json
--------- -------
17638 8 files
unzip -p build.ankiaddon meta.json
{"name": "Simple Markdown", "mod": 1720511633, "min_point_version": 230900, "max_point_version": 231201, "branch_index": 0, "disabled": false, "config": {"automatic": true, "extensions": {"abbr": false, "admonition": false, "attr_list": false, "codehilite": false, "def_list": false, "fenced_code": true, "footnotes": false, "legacy_attrs": false, "legacy_em": false, "md_in_html": false, "meta": false, "nl2br": false, "sane_lists": false, "smarty": false, "tables": false, "toc": false, "wikilinks": false}, "wrap_with_p_tags": false}, "conflicts": [], "update_enabled": true}⏎
But when I re-download my add-on I see:
cat 354124843/meta.json | jq
{
"name": "Simple Markdown",
"mod": 1725550729,
"min_point_version": 230900,
"max_point_version": 231201,
"branch_index": 0,
"disabled": false
}
At least now I can replicate your issue. I will be investigating this further. Thank you.
OK, I believe I have fixed the issue. Apparently, developers are not supposed to use meta.json
at all. Instead we use config.json
, but have to load it a special way via QT (config = mw.addonManager.getConfig(__name__)
).
I have updated my add-on on AnkiWeb and confirmed that the issue is now resolved on my end. Closing the issue. Feel free to re-open if you experience the issue again. Thanks for your patience!
@DoubleW2w
复制你的meta.json文件后,启动不失败了。 但好像不起作用,是不是要使用特定的卡片?
但我这里并没有产生。可能是我之前删除过。
The add-on works for all cards and all fields. By default it is set to work automatically, so that you don't have to select the text you want to convert. But changes will not appear as you are editing. You have to finish editing your card for the changes to be applied.
Anki 24.04.1 (ccd9ca1a) (ao) Python 3.9.18 Qt 6.6.2 PyQt 6.6.1 Platform: Windows-10-10.0.22621
When loading Simple Markdown: Traceback (most recent call last): File "aqt.addons", line 247, in loadAddons File "C:\Users\xxxxxx\AppData\Roaming\Anki2\addons21\354124843__init__.py", line 1, in
from . import markdown_converter
File "C:\Users\xxxxxx\AppData\Roaming\Anki2\addons21\354124843\markdown_converter.py", line 82, in
if load_meta()['config']['automatic']:
KeyError: 'config'