-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Allow non-RST parsers to substitute the Locale transform #8852
Comments
I'm interested what is |
Oops, Sorry. My understanding is current Locale transform is developed only for reST translation. So it does not work well with other parsers. I merged #8853 to Sphinx because it does not affect translating of the reST document. But it does not mean that Locale transform will support the markdown translation. If your goal is translating the whole of markdown document, we need to develop the mechanism to switch a translation-transform for each parser. |
Thanks, yes, that seems like the appropriate solution. |
I'm thinking the Locale transform is mostly generic. There are just a few places where it constructs RST strings. I'm wondering if those lines can be moved to methods (e.g. |
If I understand correctly, all these issues come from the fact that in sphinx/sphinx/transforms/i18n.py Lines 73 to 78 in 80d5396
From what it saw in the extracted messages from the There could be a function in Sphinx's Parser base class like Lines 24 to 31 in 80d5396
It seems like it should allow to remove all the strange hacks in the i18n code like: sphinx/sphinx/transforms/i18n.py Lines 459 to 465 in 80d5396
sphinx/sphinx/transforms/i18n.py Lines 472 to 477 in 80d5396
Does this idea make sense to you? Do you think it could work? |
I'd like @chrisjsewell and @choldgraf from MyST Parser to reflect on your proposed In general, removing those hacks would be ideal! |
FYI, I made a proof of concept in #12238 |
LGTM! |
Describe the bug
79650f5 (#4938) added code that adds a line of hyphens under (for example) an admonition's title's text.
However, a line of hyphens is an RST-specific syntax for a heading. It does not indicate a heading in all parsers.
In Markdown, for example, a line of hyphens is a second-level heading https://spec.commonmark.org/0.29/#setext-headings. This can cause the heading level to jump from 0 to 2.
To Reproduce
I can create a test scenario, but the bug should be clear from reading the code, with the above context.
Expected behavior
For Markdown, we can just change the hyphen to an equals sign, which Markdown will interpret as a first-level heading.
For other parsers, I suppose there would need to be hooks for those parsers to convert the string to a heading.
The text was updated successfully, but these errors were encountered: