feat: add rendering for inline math #124
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 .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.