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

⦕ Complex brackets #23

Merged
merged 1 commit into from
Jan 14, 2025
Merged

⦕ Complex brackets #23

merged 1 commit into from
Jan 14, 2025

Conversation

rowanc1
Copy link
Member

@rowanc1 rowanc1 commented Jan 14, 2025

Fixes brackets to be spelled out if they are not balanced.

See jupyter-book/mystmd#1766

Fixes brackets to be spelled out if they are not balanced.

See jupyter-book/mystmd#1766
@rowanc1 rowanc1 merged commit 2790803 into main Jan 14, 2025
3 checks passed
@rowanc1 rowanc1 deleted the brackets branch January 14, 2025 03:20
}
// This could be improved to a single pass if we have an intermediate AST for writing typst
// However, we are just writing this out twice at the moment if we find unbalanced brackets.
return texToTypst(value, { writeOutBrackets: true });
Copy link

Choose a reason for hiding this comment

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

This is probably fine for now, since the unbalanced brackets are rare, so the most common case of balanced brackets will be fast.

Copy link
Member Author

Choose a reason for hiding this comment

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

That was my thought.

My original solution was just to do this all the time, however, that gives some pretty verbose exports for very simple things like e_(f(x)) to e_(f paren.l x paren.r), which I didn't want to do. :)

I think in the future we should have an intermediate tree that is meant for writing, and then do the unbalanced test on that tree, then write to string.

Put this PR together to unblock near term as that is going to be a larger change.

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.

2 participants