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

Adding support for furigana (e.g. the <ruby> HTML element) in myst-parser/mystmd's spec #1005

Open
sugan-reden opened this issue Nov 30, 2024 Discussed in #1004 · 0 comments

Comments

@sugan-reden
Copy link

sugan-reden commented Nov 30, 2024

Originally started on #1004

Hi!

I would like to investigate the integration of support for the <ruby> HTML element that permits the insertion of furigana in markdown content.

For full disclosure, I see the MyST project as something that could be used for much more than just the scientific side of docs/papers, and more for general SSG purpose, growing further than Sphinx and potentially rivaling or going beyond Hugo, Docusaurus, Gatsby, Jekyll and the like. That is why I chose it for my projects.

That said, as I was working on said projects, I stumbled against having to raw-dog HTML for the addition of furigana to text.

I would like to know if this would be something that could be integrated directly into the syntax?

Example: (taken from the README.md of the iltrof/furigana-markdown-it repo mentioned below)

Input Result As image
[漢字]{かんじ} 漢字かんじ
Or, if <ruby> is unsupported:
漢字【かんじ】

For reference, I found a few interesting pieces of related work on this here:

iltrof/furigana-markdown-it - An existing markdown-it extension for furigana. In my eyes, this would probably be the most interesting one in this case, because I thought it could be easier to port since MyST was, if I remember correctly, strongly related to markdown-it-py.

djfun/furigana_markdown - Another similar extension, this time in python.

ElnuDev/Foxmark - A markdown renderer capable of handling furigana out-of-the-box, made in python. More recent than the two above.

Note

Something to consider while integrating would be the language variants, as noted in this issue.

Another thing to note while integrating would the stacking/staggering of furigana, and thus <ruby> elements, like mentioned in this issue and available in HTML.

Related:

@ElnuDev mentioned an exploration of regular expressions for this in their blog. It was originally intended for Hugo use, but they again mention at the end of their conclusion that:

you can do this in any static site generator that supports regular expressions in templates.

Related to this: https://git.elnu.com/ElnuDev/furigana

Thanks for reading me :)

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

No branches or pull requests

1 participant