executablebooks / markdown-it-docutils

A markdown-it plugin for implementing docutils style roles/directives.
https://executablebooks.github.io/markdown-it-docutils/
MIT License
12 stars 8 forks source link

✨ NEW: Add semantic HTML roles #15

Closed rowanc1 closed 2 years ago

rowanc1 commented 3 years ago

Added a few of the basic html roles that are in sphinx out of the box.

chrisjsewell commented 3 years ago

One thing to note here, the naming of these needs a little thought:

In https://github.com/chrisjsewell/docutils/blob/8adab0660b2097b4f3c32cef7e5ff4cb3c72b084/docutils/docutils/parsers/rst/roles.py#L251-L252, the actual canonical (language independent) names are subscript and superscript, then if you are using the default english en language sub and sup are allowed: https://github.com/chrisjsewell/docutils/blob/8adab0660b2097b4f3c32cef7e5ff4cb3c72b084/docutils/docutils/parsers/rst/languages/en.py#L84-L87

Abbreviation is a bit weird, because in docutils abbreviation is the canonical name, then ab is allowed with en. BUT: then in sphinx they have decided to redefine their own abbreviation role, with the canonical name abbr 🤷 https://github.com/sphinx-doc/sphinx/blob/d788e78a5e2f339cc5e5c5fd5d8431e1991e568f/sphinx/roles.py#L356

So firstly this raises the question, should we/how do we handle language translations?

rowanc1 commented 3 years ago

I think the translation/resolution of roles into various languages is likely something that can be kicked down the road for a while. The logic for this is combined to two, non-exposed, places (in the Role/Directive classes) currently the logic is to look into a user supplied dictionary, that can always get more sophisticated if the feature is necessary.

I will add the three aliases that you suggest.

I will also add the other math role in this PR, and then get it into main - so we can resolve some of the math rendering in a similar way between the various repositories.

rowanc1 commented 3 years ago

Just another note, abbr/sub/sup were also likely chosen because they are the html standard!

rowanc1 commented 3 years ago

Ok - this PR is good to go in from my perspective.

rowanc1 commented 2 years ago

This should be good to go in.