-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
Inline Styling for rehype-mathjax #99
Comments
Can you clarify what, in that very long issue, which itself is not the spec, you are referring too? |
Why do you propose changes here, and not in mathjax? |
The main issue here is that the
The issue mentioned above discusses a proposal to allow the For those who prefer a quick summary, the reason why the Moreover: https://html.spec.whatwg.org/multipage/semantics.html#the-style-element
I determined that this is an issue with rehype-mathjax, not with MathJax itself. Here’s a step-by-step explanation: MathJax is a library that outputs both mathematical expressions and CSS, which is then embedded into HTML. This process can be divided into two parts:
MathJax correctly implements part 2 by adding the CSS to the This library was initially implemented by me, Tani, and donated to this project. You can see this mentioned at the bottom of the README. The program I created only used part 1 of MathJax and implemented part 2 specifically for rehype. Even now, this library follows that same basic method. When embedding the generated expressions and CSS (part 2), if the proper place (i.e., the Since part 2 is independently implemented by rehype-mathjax, proposing this issue in the main MathJax project would be incorrect. Therefore, I’ve submitted the issue here.
There are three reasons for this:
|
I do not think this reasoning is correct.
The rest of the issue is, from what I gather, also discussing whether
Indeed, that says it is allowed. What I don’t really get is: |
https://html.spec.whatwg.org/multipage/dom.html#flow-content Oh, I see. thanks! |
Initial checklist
Problem
In HTML, the appearance of the style element in the body element is undesirable from a specification point of view. Historically, there was a time when the appearance of the style element in the body element was tacitly accepted, but the WHATWG specification, which is currently the main HTML specification, concludes that it is undesirable for the style element to appear in the body element. whatwg/html#1605
Solution
By muddling through and assigning the appropriate stylesheet to the style attribute of each element, you can properly format formulas without style elements: walk around according to the stylesheet selector and assign rules to the style attribute of matching formula elements in the form
style="..."
. This method is successful in SVG. On the other hand, it does not succeed with CHTML. This is because in the style sheet for CHTML there are rules starting with@
to define fonts. Against this background, we propose to add the following new option.Already ready for pull requests. As soon as the discussion here is complete, we will move on to work on the pull request. Tests have been added and coverage is 100%.
https://github.com/tani/remark-math/tree/inline-css
Alternatives
Existing code confirms that there was awareness of the problem, and if the head element is in the syntax tree, the style element is inserted into the head element instead of adding a style element under body, to comply with the WHATWG specification. Our proposed improvements are in the same direction as this policy and follow it when the
internal
option is enable.The text was updated successfully, but these errors were encountered: