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

Update handling of braket bars so that the enclosing braket can be more accurately found. (mathjax/MathJax#3164) #1041

Merged
merged 1 commit into from
Feb 1, 2024

Conversation

dpvc
Copy link
Member

@dpvc dpvc commented Jan 24, 2024

This PR fixes a problem where the BraketMethods.Bar() function doesn't find the enclosing braket item properly when there are certain types of enclosing elements (like style or color changes).

To do this, we add a function to the Stack object to get its current height (the number of elements on the stack), and save that in the braket item's env object, which will be available in the parser stack's env object. Then the BraketMethods.Bar() function can use parser.stack.env.braketItem to find the matching braket item without having to look through the stack items to find it. (The current approach doesn't work if there are intervening items other than an over item).

We also set the braket package priority so that it is searched before the base package, guaranteeing that the braket function for | is used rather than the base one.

Finally, we fix a few comments along the way.

Resolves issue mathjax/MathJax#3164.

@dpvc dpvc requested a review from zorkow January 24, 2024 16:30
@dpvc dpvc added this to the v4.0 milestone Jan 24, 2024
Copy link
Member

@zorkow zorkow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm.

@dpvc dpvc merged commit 9af65e8 into develop Feb 1, 2024
@dpvc dpvc deleted the issue3164 branch February 1, 2024 12:46
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

Successfully merging this pull request may close these issues.

None yet

2 participants