aboutsummaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorKuuuube <61125188+Kuuuube@users.noreply.github.com>2024-03-02 06:25:46 -0500
committerGitHub <noreply@github.com>2024-03-02 11:25:46 +0000
commit98b11f794cd0fe828cc06d386e0b7126d5a387bb (patch)
tree2e2c5a9f5244fd75859d4d2d3455b813fd8675ae /ext
parente47a0f488f3d9bbcb76ebcf4f5afe203c1ee06c0 (diff)
Mark string and text glossary content as safe to avoid broken <br> (#732)
Diffstat (limited to 'ext')
-rw-r--r--ext/js/templates/sandbox/anki-template-renderer.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/js/templates/sandbox/anki-template-renderer.js b/ext/js/templates/sandbox/anki-template-renderer.js
index 8fe248ac..022716c3 100644
--- a/ext/js/templates/sandbox/anki-template-renderer.js
+++ b/ext/js/templates/sandbox/anki-template-renderer.js
@@ -665,12 +665,12 @@ export class AnkiTemplateRenderer {
const [dictionary, content] = /** @type {[dictionary: string, content: import('dictionary-data').TermGlossaryContent]} */ (args);
/** @type {import('anki-templates').NoteData} */
const data = options.data.root;
- if (typeof content === 'string') { return this._stringToMultiLineHtml(content); }
+ if (typeof content === 'string') { return this._safeString(this._stringToMultiLineHtml(content)); }
if (!(typeof content === 'object' && content !== null)) { return ''; }
switch (content.type) {
case 'image': return this._formatGlossaryImage(content, dictionary, data);
case 'structured-content': return this._formatStructuredContent(content, dictionary, data);
- case 'text': return this._stringToMultiLineHtml(content.text);
+ case 'text': return this._safeString(this._stringToMultiLineHtml(content.text));
}
return '';
}