Pop-up dictionary browser extension for language learning. Successor to Yomichan. (PERSONAL FORK)
at lambda-fork/main 926 lines 21 kB view raw view rendered
1# Templates 2 3## Helpers 4 5Yomitan supports several custom Handlebars helpers for rendering templates. 6The source code for these templates can be found [here](../ext/js/templates/anki-template-renderer.js). 7 8### `dumpObject` 9 10Converts an object to a pretty-printed JSON string. 11This function can be helpful for debugging values when creating templates. 12 13<details> 14 <summary>Syntax:</summary> 15 16<code>{{dumpObject <i>object</i>}}</code> 17 18- _`object`_ <br> 19The object to convert. 20</details> 21<details> 22 <summary>Example:</summary> 23 24<!-- prettier-ignore --> 25 ```handlebars 26 <pre>{{dumpObject .}}</pre> 27 ``` 28 29Output: 30 31<!-- prettier-ignore --> 32 ```html 33 <pre>{ 34 "key": "value" 35 }</pre> 36 ``` 37 38Preview: 39 40<!-- prettier-ignore --> 41 ```html 42 { 43 "key": "value" 44 } 45 ``` 46 47</details> 48 49### `furigana` 50 51Converts a definition or expression/reading pair to its furigana representation. 52 53<details> 54 <summary>Syntax:</summary> 55 56<code>{{furigana <i>definition</i>}}</code><br> 57<code>{{furigana <i>expression</i> <i>reading</i>}}</code><br> 58 59- _`definition`_ <br> 60 The definition to convert. 61- _`expression`_ <br> 62 The expression to convert. 63- _`reading`_ <br> 64The reading to convert. 65</details> 66<details> 67 <summary>Example:</summary> 68 69<!-- prettier-ignore --> 70 ```handlebars 71 {{furigana .}} 72 {{furigana "読む" "よむ"}} 73 ``` 74 75Output: 76 77<!-- prettier-ignore --> 78 ```html 79 <ruby>読<rt>よ</rt></ruby>む 80 ``` 81 82Preview 83 84 <pre><ruby>読<rt>よ</rt></ruby>む</pre> 85</details> 86 87### `furiganaPlain` 88 89Converts a definition or expression/reading pair to its simplified furigana representation. 90 91<details> 92 <summary>Syntax:</summary> 93 94<code>{{furiganaPlain <i>definition</i>}}</code> 95<code>{{furiganaPlain <i>expression</i> <i>reading</i>}}</code><br> 96 97- _`definition`_ <br> 98 The definition to convert. 99- _`expression`_ <br> 100 The expression to convert. 101- _`reading`_ <br> 102The reading to convert. 103</details> 104<details> 105 <summary>Example:</summary> 106 107<!-- prettier-ignore --> 108 ```handlebars 109 {{~furiganaPlain .~}} 110 {{furiganaPlain "読む" "よむ"}} 111 ``` 112 113Output: 114 115<!-- prettier-ignore --> 116 ```html 117 読[よ]む 118 ``` 119 120</details> 121 122### `multiLine` 123 124Replaces newline characters with a forced HTML line break `<br>`. 125 126<details> 127 <summary>Syntax:</summary> 128 129<code>{{#multiLine}}<i>text with multiple lines</i>{{/multiLine}}</code> 130 131</details> 132<details> 133 <summary>Example:</summary> 134 135<!-- prettier-ignore --> 136 ```handlebars 137 {{#multiLine~}} 138 some 139 multiline 140 text 141 {{~/multiLine}} 142 ``` 143 144Output: 145 146<!-- prettier-ignore --> 147 ```html 148 some<br>multiline<br>text 149 ``` 150 151Preview: 152 153 <pre>some<br>multiline<br>text</pre> 154</details> 155 156### `regexReplace` 157 158Uses a [regular expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) to replace a pattern with the specified text. 159 160<details> 161 <summary>Syntax:</summary> 162 163<code>{{#regexReplace <i>regex</i> <i>replacement</i> <i>[flags]</i>}}<i>text-to-modify</i>{{/regexReplace}}</code><br> 164<code>{{regexReplace <i>regex</i> <i>replacement</i> <i>[flags]</i> <i>[text-to-modify]...</i>}}</code><br> 165 166- _`regex`_ <br> 167 The raw string used to create the regular expression. This value is passed to the [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/RegExp) constructor. 168- _`replacement`_ <br> 169 The text used to replace pattern matches. This supports the standard [special capture group replacements](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#Specifying_a_string_as_a_parameter) as supported by the web browser. 170- _`flags`_ _(optional)_ <br> 171 Optional flags to pass to the [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/RegExp) constructor. 172- _`text-to-modify`_ <br> 173The text that the regular expression is applied to. 174If multiple arguments are present, they are all concatenated. 175</details> 176<details> 177 <summary>Example:</summary> 178 179<!-- prettier-ignore --> 180 ```handlebars 181 {{#regexReplace "\(([^)]*)\)" "$1" "g"~}}Here is (some) (text) (in) (parentheses){{~/regexReplace}} 182 ``` 183 184Output: 185 186<!-- prettier-ignore --> 187 ```html 188 Here is some text in parentheses 189 ``` 190 191</details> 192 193### `regexMatch` 194 195Uses a [regular expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) to return only the content that matches the pattern. 196 197<details> 198 <summary>Syntax:</summary> 199 200<code>{{#regexMatch <i>regex</i> <i>[flags]</i>}}<i>text-to-modify</i>{{/regexMatch}}</code><br> 201<code>{{regexMatch <i>regex</i> <i>[flags]</i> <i>[text-to-modify]...</i>}}</code><br> 202 203- _`regex`_ <br> 204 The raw string used to create the regular expression. This value is passed to the [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/RegExp) constructor. 205- _`flags`_ _(optional)_ <br> 206 Optional flags to pass to the [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/RegExp) constructor. 207- _`text-to-modify`_ <br> 208The text that the regular expression is applied to. 209If multiple arguments are present, they are all concatenated. 210</details> 211<details> 212 <summary>Example:</summary> 213 214<!-- prettier-ignore --> 215 ```handlebars 216 {{#regexMatch "\(([^)]*)\)" "g"~}}Here is (some) (text) (in) (parentheses){{~/regexMatch}} 217 ``` 218 219Output: 220 221<!-- prettier-ignore --> 222 ```html 223 (some)(text)(in)(parentheses) 224 ``` 225 226</details> 227 228### `mergeTags` 229 230Creates a set of all unique tags for the definition and returns a text representation of the tags separated by commas. 231 232<details> 233 <summary>Syntax:</summary> 234 235<code>{{mergeTags <i>definition</i> <i>isGroupMode</i> <i>isMergeMode</i>}}</code> 236 237- _`definition`_ <br> 238 The root definition object. 239- _`isGroupMode`_ _(optional)_ <br> 240 Whether or not the display mode is the 'group' mode. 241- _`isMergeMode`_ <br> 242Whether or not the display mode is the 'merge' mode. 243</details> 244<details> 245 <summary>Example:</summary> 246 247<!-- prettier-ignore --> 248 ```handlebars 249 {{~mergeTags definition group merge~}} 250 ``` 251 252Output: 253 254<!-- prettier-ignore --> 255 ```html 256 v5m, vt, JMdict (English) 257 ``` 258 259</details> 260 261### `#eachUpTo` 262 263Similar to the built-in `#each` function, but iterates up to a maximum count. 264If the iterable is falsy or empty, the `else` condition will be used. 265 266<details> 267 <summary>Syntax:</summary> 268 269<code>{{#eachUpTo <i>iterable</i> <i>maxCount</i>}}<i>(modification)</i>{{else}}<i>(else-modification)</i>{{/eachUpTo}}</code> 270 271- _`iterable`_ <br> 272 The object that should be looped over. A JavaScript [`for...of`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of) loop is used, so the object only needs to be iterable. 273- _`maxCount`_ _(optional)_ <br> 274 The maximum number of entries to loop over. 275- _`modification`_ <br> 276 The template used to modify the value. The context is changed to the current item of iteration. 277- _`else-modification`_ <br> 278The template used in case the iterable is falsy or empty. The context is unchanged. 279</details> 280<details> 281 <summary>Example:</summary> 282 283<!-- prettier-ignore --> 284 ```handlebars 285 {{~#eachUpTo someArray 5}}{{{.}}}<br>{{else}}Empty{{/mergeTags~}} 286 ``` 287 288Output: 289 290<!-- prettier-ignore --> 291 ```html 292 someArray[0]<br>someArray[1]<br>someArray[2]<br>someArray[3]<br>someArray[4]<br> 293 ``` 294 295Preview: 296 297 <pre>someArray[0]<br>someArray[1]<br>someArray[2]<br>someArray[3]<br>someArray[4]<br></pre> 298</details> 299 300### `spread` 301 302Uses the JavaScript [spread](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax) operator to convert one or more iterables into a single array. 303This allows it to be used similar to an [`Array.concat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat) operation. 304 305<details> 306 <summary>Syntax:</summary> 307 308<code>{{spread <i>iterable1</i> <i>iterable2</i> <i>...</i> <i>iterableN</i>}}</code> 309 310- _`iterableN`_ <br> 311A variable amount of iterable objects to combine into a single array. 312</details> 313<details> 314 <summary>Example:</summary> 315 316<!-- prettier-ignore --> 317 ```handlebars 318 {{#each (spread array1 array2)}}{{{.}}}<br>{{/each}} 319 ``` 320 321Output: 322 323<!-- prettier-ignore --> 324 ```html 325 array1[0]<br>array1[1]<br>array2[0]<br>array2[1]<br> 326 ``` 327 328Preview: 329 330 <pre>array1[0]<br>array1[1]<br>array2[0]<br>array2[1]<br></pre> 331</details> 332 333### `op` 334 335Performs a simple operation on one, two, or three arguments. The operations available are: 336 337- Unary operators: `+`, `-`, `~`, `!` 338- Binary operators: `+`, `-`, `/`, `*`, `%`, `**`, `==`, `!=`, `===`, `!==`, `<`, `<=`, `>`, `>=`, `<<`, `>>`, `>>>`, `&`, `|`, `^`, `&&`, `||` 339- Ternary operators: `?:` 340 341If an unknown operator is specified, the `undefined` value is returned. 342 343<details> 344 <summary>Syntax:</summary> 345 346<code>{{op <i>operator</i> <i>operand1</i> <i>[operand2]</i> <i>[operand3]</i>}}</code> 347 348- _`operator`_ <br> 349 One of the unary, binary, or ternary operators. 350- _`operand1`_ <br> 351 The first operand of the operation. 352- _`operand2`_ _(Optional)_<br> 353 The second operand of the operation. 354- _`operand3`_ _(Optional)_<br> 355The third operand of the operation. 356</details> 357<details> 358 <summary>Example:</summary> 359 360<!-- prettier-ignore --> 361 ```handlebars 362 {{#if (op "===" value1 value2)}}Values are equal{{/if~}}<br> 363 {{~#op "-" value1}}{{/op~}}<br> 364 {{~op "?:" value1 "a" "b"}} 365 ``` 366 367Output: 368 369<!-- prettier-ignore --> 370 ```html 371 Values are equal<br>-32<br>a 372 ``` 373 374Preview: 375 376 <pre>Values are equal<br>-32<br>a</pre> 377</details> 378 379### `get` 380 381Gets a value from the custom state stack. 382 383<details> 384 <summary>Syntax:</summary> 385 386<code>{{get <i>name</i>}}</code> 387 388- _`name`_ <br> 389The name of the variable to get. 390</details> 391<details> 392 <summary>Example:</summary> 393 394<!-- prettier-ignore --> 395 ```handlebars 396 {{get "some-text"}} 397 ``` 398 399Output: 400 401<!-- prettier-ignore --> 402 ```html 403 This is the value of some-text! 404 ``` 405 406</details> 407 408### `set` 409 410Assigns a value to the custom state stack. 411 412<details> 413 <summary>Syntax:</summary> 414 415<code>{{#set <i>name</i>}}<i>value</i>{{/get}}</code><br> 416<code>{{set <i>name</i> <i>value</i>}}</code><br> 417 418- _`name`_ <br> 419 The name of the variable to assign. 420- _`value`_ <br> 421The value of the variable. 422</details> 423<details> 424 <summary>Example:</summary> 425 426<!-- prettier-ignore --> 427 ```handlebars 428 {{#set "some-text"}}This is the value of some-text!{{/set~}} 429 {{~set "some-number" 32}} 430 ``` 431 432Output: 433 434<!-- prettier-ignore --> 435 ```html 436 ``` 437 438</details> 439 440### `#scope` 441 442Pushes a new variable scope to the custom state stack. 443Variable assignments are applied to the most recent scope, 444and variable lookups will start from the most recent scope and work backwards until a value is found. 445 446<details> 447 <summary>Syntax:</summary> 448 449<code>{{#scope}}<i>content</i>{{/scope}}</code> 450 451- _`name`_ <br> 452 The name of the variable to assign. 453- _`value`_ <br> 454The value of the variable. 455</details> 456<details> 457 <summary>Example:</summary> 458 459<!-- prettier-ignore --> 460 ```handlebars 461 {{~set "key" 32~}} 462 {{~get "key"~}}, 463 {{~#scope~}} 464 {{~#get "key"~}}, 465 {{~#set "key" 64~}} 466 {{~#get "key"~}}, 467 {{~/scope~}} 468 {{~get "key"~}} 469 ``` 470 471Output: 472 473<!-- prettier-ignore --> 474 ```html 475 32,32,64,32 476 ``` 477 478</details> 479 480### `property` 481 482Repeatedly gets a property of an object. 483 484<details> 485 <summary>Syntax:</summary> 486 487<code>{{property <i>object</i> <i>property1</i> <i>property2</i> <i>...</i> <i>propertyN</i>}}</code> 488 489- _`object`_ <br> 490 The initial object to use. 491- _`propertyN`_ <br> 492A chain of property names to get on the object. 493</details> 494<details> 495 <summary>Example:</summary> 496 497<!-- prettier-ignore --> 498 ```handlebars 499 {{property someObject "field" 0 "toString"}} 500 ``` 501 502Output: 503 504<!-- prettier-ignore --> 505 ```html 506 function toString() { [native code] } 507 ``` 508 509</details> 510 511### `noop` 512 513No-op. Returns the inner contents of the template. 514 515<details> 516 <summary>Syntax:</summary> 517 518<code>{{#noop}}<i>content</i>{{/noop}}</code> 519 520</details> 521<details> 522 <summary>Example:</summary> 523 524<!-- prettier-ignore --> 525 ```handlebars 526 {{noop}}Unchanged content{{/noop}} 527 ``` 528 529Output: 530 531<!-- prettier-ignore --> 532 ```html 533 Unchanged content 534 ``` 535 536</details> 537 538### `isMoraPitchHigh` 539 540Returns whether or not a mora will have a high pitch, given the index of the mora and the position of the downstep. 541 542<details> 543 <summary>Syntax:</summary> 544 545<code>{{isMoraPitchHigh <i>index</i> <i>position</i>}}</code> 546 547</details> 548<details> 549 <summary>Example:</summary> 550 551<!-- prettier-ignore --> 552 ```handlebars 553 {{#if (isMoraPitchHigh 1 2)}}High pitch{{else}}Low pitch{{/if}} 554 ``` 555 556Output: 557 558<!-- prettier-ignore --> 559 ```html 560 High pitch 561 ``` 562 563</details> 564 565### `getKanaMorae` 566 567Returns an array of the mora for a kana string. 568 569<details> 570 <summary>Syntax:</summary> 571 572<code>{{getKanaMorae <i>kana-string</i>}}</code> 573 574</details> 575<details> 576 <summary>Example:</summary> 577 578<!-- prettier-ignore --> 579 ```handlebars 580 {{#each (getKanaMorae "よみたん")}}{{{.}}}<br>{{/each}} 581 ``` 582 583Output: 584 585<!-- prettier-ignore --> 586 ```html 587 よ<br>み<br>た<br>ん<br> 588 ``` 589 590Preview: 591 592 <pre>よ<br>み<br>た<br>ん<br></pre> 593</details> 594 595### `typeof` 596 597Returns the type of a value. `#typeof` in the block form will always return `'string'`. 598 599<details> 600 <summary>Syntax:</summary> 601 602<code>{{typeof <i>value</i>}}</code><br> 603<code>{{#typeof}}<i>value</i>{{/typeof}}</code><br> 604 605- _`value`_ <br> 606The value to check. 607</details> 608<details> 609 <summary>Example:</summary> 610 611<!-- prettier-ignore --> 612 ```handlebars 613 {{typeof "よみたん"}} 614 {{typeof 1}} 615 {{#typeof}}よみたん{{/typeof}} 616 ``` 617 618Output: 619 620<!-- prettier-ignore --> 621 ```html 622 string 623 number 624 string 625 ``` 626 627</details> 628 629### `join` 630 631Joins the arguments to a single string with a separator, flattening any arguments that are arrays. 632 633<details> 634 <summary>Syntax:</summary> 635 636<code>{{join <i>separator</i> <i>value1</i> <i>value2</i> <i>valueN</i>...}}</code><br> 637 638- _`separator`_ <br> 639 The separator string to use between values. 640- _`valueN`_ <br> 641An individual value to join into the resulting string 642</details> 643<details> 644 <summary>Example:</summary> 645 646<!-- prettier-ignore --> 647 ```handlebars 648 {{set "index" 32~}} 649 {{~join "_" "yomitan" (get "index") "value"}} 650 ``` 651 652Output: 653 654<!-- prettier-ignore --> 655 ```html 656 yomitan_32_value 657 ``` 658 659</details> 660 661### `concat` 662 663Joins the arguments to a single string, without flattening arguments that are arrays. 664 665<details> 666 <summary>Syntax:</summary> 667 668<code>{{concat <i>value1</i> <i>value1</i> <i>valueN</i>...}}</code><br> 669 670- _`valueN`_ <br> 671A value to join into the resulting string 672</details> 673<details> 674 <summary>Example:</summary> 675 676<!-- prettier-ignore --> 677 ```handlebars 678 {{set "index" 32~}} 679 {{~concat "yomitan_" (get "index") "_value"}} 680 ``` 681 682Output: 683 684<!-- prettier-ignore --> 685 ```html 686 yomitan_32_value 687 ``` 688 689</details> 690 691### `pitchCategories` 692 693Returns an array representing the different pitch categories for a specific term. 694 695<details> 696 <summary>Syntax:</summary> 697 698<code>{{pitchCategories @root}}</code><br> 699 700- _`@root`_ <br> 701The argument passed should always be the root data object. 702</details> 703<details> 704 <summary>Example:</summary> 705 706<!-- prettier-ignore --> 707 ```handlebars 708 [{{#each (pitchCategories @root)}}{{.}}{{#unless @last}}, {{/unless}}{{/each}}] 709 ``` 710 711Output: 712 713<!-- prettier-ignore --> 714 ```html 715 [heiban, kifuku] 716 ``` 717 718</details> 719 720### `formatGlossary` 721 722Formats a glossary entry to a HTML content string. This helper handles image and 723structured-content generation. 724 725<details> 726 <summary>Syntax:</summary> 727 728<code>{{formatGlossary <i>dictionary</i> <i>definitionEntry</i>}}</code><br> 729 730- _`dictionary`_ <br> 731 The dictionary that the glossary entry belongs to. 732- _`definitionEntry`_ <br> 733The definition entry object in raw form. 734</details> 735<details> 736 <summary>Example:</summary> 737 738<!-- prettier-ignore --> 739 ```handlebars 740 {{#each glossary}}{{formatGlossary ../dictionary .}}{{/each}} 741 ``` 742 743Output: 744 745<!-- prettier-ignore --> 746 ```html 747 Here is the content of a gloss, which may include formatted HTML. 748 ``` 749 750</details> 751 752### `hasMedia` & `getMedia` 753 754Checks to see if a certain type of media is available for a card and injects the relevant content. 755These functions are used together in order to request media and other types of optional asynchronous content. 756 757<details> 758 <summary>Syntax:</summary> 759 760<code>{{hasMedia <i>type</i> <i>args</i>...}}</code><br> 761<code>{{getMedia <i>type</i> <i>args</i>... <i>[escape=true|false]</i>}}</code><br> 762 763- _`type`_ <br> 764 The type of media to check for. 765- _`args`_ <br> 766 Additional arguments for the media. The arguments depend on the media type. 767- _`escape`_ _(optional)_ <br> 768 Whether or not the resulting text should be HTML-escaped. If omitted, defaults to `true`. 769 770**Available media types and arguments** 771 772- <code>"audio"</code> 773- <code>"screenshot"</code> 774- <code>"clipboardImage"</code> 775- <code>"clipboardText"</code> 776- <code>"popupSelectionText"</code> 777- <code>"textFurigana" <i>japaneseText</i> <i>readingMode="default|hiragana|katakana"</i></code> 778- <code>"dictionaryMedia" <i>fileName</i> <i>dictionary="Dictionary Name"</i></code> 779</details> 780<details> 781 <summary>Examples:</summary> 782 783<!-- prettier-ignore --> 784 ```handlebars 785 {{#if (hasMedia "audio")}}The audio file name is: {{getMedia "audio"}}{{/if}} 786 787 {{#if (hasMedia "screenshot")}}The screenshot file name is: {{getMedia "screenshot"}}{{/if}} 788 789 {{#if (hasMedia "clipboardImage")}}The clipboard image file name is: {{getMedia "clipboardImage"}}{{/if}} 790 791 {{#if (hasMedia "clipboardText")}}The clipboard text is: {{getMedia "clipboardText"}}{{/if}} 792 793 {{#if (hasMedia "popupSelectionText")}}The popup selection text is: {{getMedia "popupSelectionText"}}{{/if}} 794 795 {{#if (hasMedia "textFurigana" "日本語")}}This is an example of text with generated furigana: {{getMedia "textFurigana" "日本語" escape=false}}{{/if}} 796 797 {{#if (hasMedia "dictionaryMedia" "image.png" dictionary="Example Dictionary")}}The remapped file name for image.png is: {{getMedia "dictionaryMedia" "image.png" dictionary="Example Dictionary"}}{{/if}} 798 ``` 799 800Output: 801 802<!-- prettier-ignore --> 803 ```html 804 The audio file name is: yomitan_audio_にほんご_日本語.mp3 805 806 The screenshot file name is: yomitan_browser_screenshot_にほんご_日本語.png 807 808 The clipboard image file name is: yomitan_clipboard_image_にほんご_日本語.png 809 810 The clipboard text is: This is the clipboard text 811 812 The selection text is: This is the selection text 813 814 The selection text is: This is the selection text 815 816 This is an example of text with generated furigana: <ruby>日本語<rt>にほんご</rt></ruby> 817 818 The remapped file name for image.png is: yomitan_dictionary_media_1_にほんご_日本語.png 819 ``` 820 821</details> 822 823### `pronunciation` 824 825Converts pronunciation information into a formatted HTML content string. The display layout is the 826same as the system used for generating popup and search page dictionary entries. 827 828<details> 829 <summary>Syntax:</summary> 830 831<code>{{pronunciation <i>format=string</i> <i>reading=string</i> <i>downstepPosition=integer</i> <i>[nasalPositions=array]</i> <i>[devoicePositions=array]</i>}}</code><br> 832 833- _`format`_ <br> 834 The format of the HTML to generate. This can be any of the following values: 835 - `'text'` 836 - `'graph'` 837 - `'position'` 838- _`reading`_ <br> 839 The kana reading of the term. 840- _`downstepPosition`_ <br> 841 The mora position of the downstep in the reading. 842- _`nasalPositions`_ _(optional)_ <br> 843 An array of indices of mora that have a nasal pronunciation. 844- _`devoicePositions`_ _(optional)_ <br> 845An array of indices of mora that are devoiced. 846</details> 847<details> 848 <summary>Example:</summary> 849 850<!-- prettier-ignore --> 851 ```handlebars 852 {{~pronunciation format='text' reading='よむ' downstepPosition=1~}} 853 ``` 854 855</details> 856 857### `hiragana` 858 859Converts katakana text to hiragana. 860 861<details> 862 <summary>Syntax:</summary> 863 864<code>{{hiragana <i>value</i> <i>[keepProlongedSoundMarks=true|false]</i>}}</code><br> 865<code>{{#hiragana <i>[keepProlongedSoundMarks=true|false]</i>}}<i>value</i>{{/hiragana}}</code><br> 866 867- _`value`_ <br> 868 The text to convert. 869- _`keepProlongedSoundMarks`_ _(optional)_ <br> 870Whether or not the `` character should be kept or converted to a vowel character. 871Defaults to `false` if not specified. 872</details> 873<details> 874 <summary>Example:</summary> 875 876<!-- prettier-ignore --> 877 ```handlebars 878 {{hiragana "よみたん ヨミたん ヨミタン"}} 879 {{#hiragana}}よみたん ヨミたん ヨミタン{{/hiragana}} 880 {{#hiragana}}ローマ字{{/hiragana}} 881 {{#hiragana keepProlongedSoundMarks=true}}ローマ字{{/hiragana}} 882 ``` 883 884Output: 885 886<!-- prettier-ignore --> 887 ```html 888 よみたん よみたん よみたん 889 よみたん よみたん よみたん 890 ろうま字 891 ろーま字 892 ``` 893 894</details> 895 896### `katakana` 897 898Converts hiragana text to katakana. 899 900<details> 901 <summary>Syntax:</summary> 902 903<code>{{katakana <i>text</i>}}</code><br> 904<code>{{#katakana}}<i>text</i>{{/katakana}}</code><br> 905 906- _`text`_ <br> 907The text to convert. 908</details> 909<details> 910 <summary>Example:</summary> 911 912<!-- prettier-ignore --> 913 ```handlebars 914 {{katakana "よみたん ヨミたん ヨミタン"}} 915 {{#katakana}}よみたん ヨミたん ヨミタン{{/katakana}} 916 ``` 917 918Output: 919 920<!-- prettier-ignore --> 921 ```html 922 ヨミタン ヨミタン ヨミタン 923 ヨミタン ヨミタン ヨミタン 924 ``` 925 926</details>