-
Notifications
You must be signed in to change notification settings - Fork 238
Fix navigation issues when semantic tree is not aligned with syntactic tree #1325
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
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1325 +/- ##
========================================
Coverage 86.71% 86.71%
========================================
Files 337 337
Lines 84074 84074
Branches 4758 4758
========================================
Hits 72904 72904
+ Misses 11170 11147 -23
- Partials 0 23 +23 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
As an aside, here is the "native" rendering of the above equation Github clearly still uses MathJax to convert to MathML, as the result is still exactly our structure including |
Yes, and because they are now using the browser's native MathML that means they are relying on MathML-Core, so things like equation numbers won't work: and the various table attributes aren't supported, so you get things like: which has two much space before the equal signs, and (depending on the browser), the left-hand side can be misaligned. The worst, however, is that since MathML-Core doesn't allow |
|
The math experience on GitHub is now very much browser and font dependent, which is a shame. It has been a pretty problematic implementation from the very beginning. |
dpvc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great. Thanks for fixing these issues. I left a possible alternative loop structure to reduce redundancy, and one question, but have approved as is.
The PR fixes a number of issues for the explorer, when the semantic structure is not aligned with the syntactic tree. As example consider the following equation with the
empheqpackage:In the current version the left brace is a "child" of the first row. Conversely, the right brace has the first row as "parent". The issue is that semantic children do not necessarily have to live in the DOM tree rooted in their semantic parent. Likewise, the semantic root is not necessarily the first speech element in the DOM. We now compute:
rootNodeby using the root id given in thedata-semantic-structureelementfirstChildby iterating throw thedata-semantic-ownslist until we find a node which hasdata-speech-nodeparentNode(inmoveUp) by looking for the actual parent id in the tree.In addition the
nextSiblingandprevSiblingmethods are fixed to actually ignore elements that are not speech nodes. As an example consider themc^2above in MathSpeak, where the elided times is now ignored.