lune-stone / anki-addon-limit-new-by-young

An add-on for Anki that can aid in maintaining a stable and efficient daily workload.
GNU Affero General Public License v3.0
7 stars 4 forks source link

ways to add comments to the configurations #23

Closed aleksejrs closed 6 months ago

aleksejrs commented 6 months ago

I've found these ways:

For a configuration for a specific sub-deck, add the comment as a deck name:

{
    deckNames: ["lorem ipsum 1::part 1::chapter 2",
                "my comment"]
}

For a regexp match, add "(|my comment)" to the regexp where it won't match anything or add the comment as an alternative to something already there:

{
    deckNames: "lorem ipsum 1::part 1::chapter 2(|my comment)"
}

{
    deckNames: "lorem ipsum 1::part 1::chapter (12|13|my comment)"
}

Or as a separate configuration, for a separator:

{
    'decknames': '----------------------------------------------------'
}
lune-stone commented 6 months ago

Another way would be to add your own key to the json object. Like so:

{
            "_comment": "Remember to change this limit back to 0 after Friday",
            "deckNames": ["lorem ipsum 1"],
            ...
}

Basically as long as it's valid json, then Anki's built-in mw.addonManager.getConfig() doesn't care, and as long as it doesn't conflict with the config this add-on uses it's fine.

The only other annoying thing is Anki will format the json which includes sorting the json object keys so that can make placing "comments" tricky.

Possibly upstream would be willing to support json5 which has the ability to do native comments.

Is there anything more you looking for in this case, or is it okay to close as answered?

aleksejrs commented 6 months ago

Thanks.