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

feat: add rendering for inline math #124

Merged
merged 2 commits into from
Jan 4, 2024
Merged

feat: add rendering for inline math #124

merged 2 commits into from
Jan 4, 2024

Conversation

nfejzic
Copy link
Collaborator

@nfejzic nfejzic commented Dec 29, 2023

Rendering of math

This PR introduces parsing and rendering of Unimarkup math inlines.

Relevant decisions you made in this PR

An additional dependency mathemascii is introduced to parse and render the AsciiMath content.

The parsing is done together with rendering in the render_inline_math function. This is sub-optimal, we do not want parsing in rendering implementation. However, we will have to introduce a step (or multiple steps) between parsing and rendering for interpretation of logic, substitution etc. Parsing of math should happen after this resolving step, and before rendering.

What is now possible?

You can now use inline math in unimarkup, like this: $$sum_(i=0)^n i = (n(n+1))/2$$ which renders as image.

NOTE: I used image embed here, because GitHub's inline math is broken right now: $\sum_{i=0}^{n} i = \frac{n(n+1)}{2}$.

Implementation of block rendering would be fairly easy (check out formalize for example, and live demo). The only part really missing is the parsing of math blocks. That can be done in a separate PR.

Copy link
Contributor

@mhatzl mhatzl left a comment

Choose a reason for hiding this comment

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

really nice work 👍
thanks for the integration :)

The resolve step and math block will come at a later point.
Therefore, I am merging this PR as is.

@mhatzl mhatzl merged commit 53ec8c6 into main Jan 4, 2024
3 checks passed
@nfejzic nfejzic deleted the add-math-support branch January 4, 2024 16:25
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