summaryrefslogtreecommitdiff
path: root/docs/templates.md
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-07-02 22:46:38 -0400
committerGitHub <noreply@github.com>2021-07-02 22:46:38 -0400
commitca97e38bd22875e23cfe6f70d1803ea31d6f0e89 (patch)
treedeb2d4c63f8ffd463031f907687c8a416a26553c /docs/templates.md
parenta4715935cb4d910f5b13b398ca4742cf30c8f784 (diff)
Anki support for structured-content (#1786)
* Update how glossary text is formatted * Update structured content and image generation * Pass root data to _createStructuredContentGenerator * Implement media URLs * Update documentation * Update options util * Apply styles to content * Improve HTML normalization * Update DatabaseVM.fetch function * Update test * Update test data
Diffstat (limited to 'docs/templates.md')
-rw-r--r--docs/templates.md29
1 files changed, 29 insertions, 0 deletions
diff --git a/docs/templates.md b/docs/templates.md
index 81259a3f..95155bea 100644
--- a/docs/templates.md
+++ b/docs/templates.md
@@ -645,6 +645,35 @@ Returns an array representing the different pitch categories for a specific term
</details>
+### `formatGlossary`
+
+Formats a glossary entry to a HTML content string. This helper handles image and
+structured-content generation.
+
+<details>
+ <summary>Syntax:</summary>
+
+ <code>{{#formatGlossary <i>dictionary</i>}}{{{definitionEntry}}}{{/pitchCategories}}</code><br>
+
+ * _`@dictionary`_ <br>
+ The dictionary that the glossary entry belongs to.
+ * _`@definitionEntry`_ <br>
+ The definition entry object in raw form.
+</details>
+<details>
+ <summary>Example:</summary>
+
+ ```handlebars
+ {{#each glossary}}{{#formatGlossary ../dictionary}}{{{.}}}{{/formatGlossary}}{{/each}}
+ ```
+
+ Output:
+ ```html
+ Here is the content of a gloss, which may include formatted HTML.
+ ```
+</details>
+
+
## Legacy Helpers
Yomichan has historically used Handlebars templates to generate the HTML used on the search page and results popup.