AnkiWeb
- Rating
- 2 (π 2 Β· π 0)
- Updated
- 2020-03-19
- Anki versions
- 2.1.22~
- Description language
- en
AnkiWeb addon 112201952
Allows non-strict JSON with newlines in strings and makes the config editor display them readably, replacing newlines with \n before loading.
Open on AnkiWeb GitHub Ask about alternatives
abandoned
| Min Anki | Max Anki | Updated |
|---|---|---|
| 2.1.0 | 2.1.21 | 2019-04-12 |
| 2.1.22 | + | 2020-03-19 |
Loadingβ¦
Runs custom JavaScript/Python scripts and inserts symbols/strings in the Anki editor via keyboard shortcuts or popup menus, configured through JSON menus and CodeMirror.
Customizes Anki editor keymap to insert configured text/HTML or run JavaScript for key-plus-modifier shortcuts, though superseded by other add-ons.
Adds editor autocomplete suggesting existing values from the same note type and field, selectable by click or Tab, with toggling and strict/loose search modes.
Converts single and triple backticks in Anki's editor into HTML code tags, supporting language classes for blocks and syntax-highlighter integration.
Inserts syntax-highlighted code snippets into Anki notes, with language selection, configurable line numbers, centering, CSS classes, and per-deck language memory.
Enables adding and editing Anki notes in extended CommonMark Markdown via editor fields or a separate window, with CodeMirror editing, extensions, and configurable conversion.
In standard json, string should not contain newlines. They should contain "\n" instead, the standard symbols to represents a newline. Which clearly create a readability problem. In particular when an add-on configuration contains code (python, latex, whatever).
Thus, I wanted to have the right to have newlines in strings in json. And when I use the configuration editor, I want to see new lines insteads of \n.
This add-on allow you to write new line in your string. The add-on will replace them by "\n" before json load the configuration. This works both for configuration in the file meta.json, and for the the add-on manager's configuration editor.
Note that it will not put newlines in the configuration written in meta.conf. Indeed, this would create at least two problems:
This add-on has an effect on ALL json strings read by the program. New lines in strings will always be removed and replaced by \n. Thus this add-on may affect more than configurations. However, this add-on call the standard json.loads() function, thus even another add-on affecting json.loads() should still be compatible with the current addon. Futhermore, this add-on has no effect on valid json. Thus the potential change would only be that some invalid json would be accepted, it seems harmless.
Furthermore, this add-on change ConfigEditor.updateText in module aqt.addons. It does not call the previous function, thus the current add-on will be incompatible with another add-on changing this method.
| Key | Value |
|---|---|
| Copyright | Arthur Milchior arthur@milchior.fr |
| Based on | Anki code by Damien Elmes anki@ichi2.net |
| License | GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html |
| Source in | https://github.com/Arthur-Milchior/anki-json-new-line |
| Addon number | 112201952 |