themoeway / yomitan

Pop-up dictionary browser extension. Successor to Yomichan.
https://yomitan.wiki
GNU General Public License v3.0
1.14k stars 88 forks source link

Option to change the encoding of furigana #1195

Open ElaineGilstrom opened 2 months ago

ElaineGilstrom commented 2 months ago

I've been noticing that it can be quite difficult to add additional formatting (like text color or bold) on top of fields with furigana formatted using the html/ruby tags compared furigana encoded using braces, so I would like to suggest adding an option to change how yomitan does the encoding in options.

Examples of what I mean are these:

html tag formatting: image

brace formatting: image

what I'm doing with it is adding color to represent pitch accent: image

If this already exists as an option, please let me know. If it doesn't, I can work on adding it in August. I'm not very familiar with node so it might end up taking a bit though.

ElaineGilstrom commented 2 months ago

now that I think about it, having auto pitch accent coloring would be awesome too. No idea how much of a pain that would be to implement, but I might look into it.

Kuuuube commented 2 months ago

Is there any reason you cant use css selectors for this? You should be able to select the rt tag in the ruby text.

ElaineGilstrom commented 2 months ago

That would target all of the furigana, which isn't what I'm after. Each word has its own pitch accent and so needs to have the color that I associate with that pitch accent.

Here is an example of the intended effect in the card itself: image

in this example, the words in red have the atamadaka pitch accent, blue is heiban and pink/magenta is nakadaka

Kuuuube commented 2 months ago

Are you manually editing the colors? Not sure how this is harder with html as opposed to brackets. It seems like you would be making the exact same additions.

ElaineGilstrom commented 2 months ago

I am manually editing the colors, but I am using a plugin to set the color with a hotkey. Because of that, it is significantly less work with the brace encoding as I don't have to make sure the font tags surround the entire span tag, as I do with the html encoded furigana (the plugin also doesn't function in the html editor for the fields)

emanuelps2708 commented 2 months ago

Hi @ElaineGilstrom I think something easier for you so you don't have to edit the card manually is to install AJT Japanese, it adds furigana in the format that you want and can add color depending the pitch accent of words. For more info https://tatsumoto.neocities.org/blog/anki-japanese-support#color-coding