Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to set lang attribute on ruby tags #5

Open
ElnuDev opened this issue Aug 2, 2021 · 1 comment · May be fixed by #9
Open

Option to set lang attribute on ruby tags #5

ElnuDev opened this issue Aug 2, 2021 · 1 comment · May be fixed by #9

Comments

@ElnuDev
Copy link

ElnuDev commented Aug 2, 2021

By default, most browsers render the Chinese variants of CJK characters. In order to get them to display Japanese, one needs to use the lang="ja" attribute on a parent element of the Japanese content. Of course, the quickest fix would be putting lang="ja" on the root <html> element, but this certainly isn't ideal if one's website language is English (or something other than Japanese) with then Japanese interspersed in it. It'd be great to have an option lets one set the lang attribute on all <ruby> tags that furigana-markdown-it outputs, i.e. replacing <ruby> with <ruby lang="ja"> or whatever one's preferred language is.

@patarapolw
Copy link

patarapolw commented Apr 13, 2022

Though, in my browser (Firefox on Arch Linux), it seems to be non-compliant - lang="ja" doesn't work, have to be lang="ja-JP" (or at least a hyphen - after ja). On my Firefox for Android, all work fine without a hyphen.

  • No lang attribute: 誤解
  • ja: 誤解
  • ja-JP: 誤解
  • zh: 誤解
  • zh-CN: 誤解
  • ko: 誤解
  • ko-KR: 誤解

Compare CJK, with or without hyphen

Furthermore, the some CSS might be required, if you own the website - to force the fonts - see MDBG or Jisho

@ElnuDev It might be better to nest in another span - とうなんたつみの方角 - The last character 角 isn't a part of ruby, but it is inside the span.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants