Skip to content

Instantly share code, notes, and snippets.

@Rudo2204
Last active December 16, 2023 12:57
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Rudo2204/55f418885c2447ccbdc95b0511e20336 to your computer and use it in GitHub Desktop.
Save Rudo2204/55f418885c2447ccbdc95b0511e20336 to your computer and use it in GitHub Desktop.
Selecting specific dictionary's entry from yomichan for making cards.

Download:

https://gist.github.com/Rudo2204/7327a5bd25a60aefee963fd65327a9b7

How to:

  • Add it to your yomichan.
  • It supports 8 dictionaries (the "recommended for first time monolingual users" from the guide).
glossary-jmdict
glossary-jmdict-compact : same as above, it only replaces linebreak with one single space to make it more compact. Could be useful.
glossary-kenkyusha
glossary-kensyusha-ne : ne stands for no-example. This basically removes all the example sentences from the entry.
glossary-kireicake
glossary-meikyou
glossary-shinjirin
glossary-shinmeikai
glossary-jitsuyou
glossary-daijisen
  • You can also add -brief or -no-dictionary (e.g: {glossary-shinmeikai-no-dictionary}) to remove dictionary's name.
  • I totally stole ッツ#0176's template so it also supports: one-dict (paste one dictionary entry), two-dict (paste at most two dictionary entries) (These paste the first one/two dictionary entries depending on your dictionary priority in yomichan's settings)
  • NOTE 1:
    For these 3 dictionaries JMDict, Kenkyusha, Shinjirin I removed the first line which contains reading guide for the word (you can get reading from {reading} {furigana-plain} already so I decided to remove it).
    If you want them back for whatever reason you can search for inline "glossary-<name>", edit the second line after that from glossary-all-remove-first to glossary-all-generic.
    If you want to remove the first line of other dictionaries too, change generic to remove-first.
  • NOTE 2: I removed aligning left divs (it's better to do it inside anki using card's template) so if your card somehow get messed up this is probably why.

Extend for more dictionaries:

  1. Add these before the {{~> (lookup . "marker") ~}} line (near end of file):
{{~#*inline "glossary-NAME"~}}
    {{~> glossary-all-generic brief=brief noDictionaryTag=noDictionaryTag targetDictionary="DICTIONARY-NAME" ~}}
{{~/inline~}}

{{#*inline "glossary-NAME-no-dictionary"}}
    {{~> glossary-NAME noDictionaryTag=true ~}}
{{/inline}}

{{#*inline "glossary-NAME-brief"}}
    {{~> glossary-NAME brief=true ~}}
{{/inline}}
  1. Change NAME to whatever you want and DICTIONARY-NAME to the dictionary name you get from yomichan.
  2. (Optional) If you want to remove the first line you can change generic to remove-first

Example

Let's say we want to add ヨガ日本語アクセント辞典. We name it as accent. So this is what you paste in your handlebars.

{{~#*inline "glossary-accent"~}}
    {{~> glossary-all-generic brief=brief noDictionaryTag=noDictionaryTag targetDictionary="ヨガ日本語アクセント辞典" ~}}
{{~/inline~}}

{{#*inline "glossary-accent-no-dictionary"}}
    {{~> glossary-accent noDictionaryTag=true ~}}
{{/inline}}

{{#*inline "glossary-accent-brief"}}
    {{~> glossary-accent brief=true ~}}
{{/inline}}
@adamhl8
Copy link

adamhl8 commented Sep 15, 2021

This is amazing. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment