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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃М Give title/description to math macros #1218

Merged
merged 4 commits into from
May 28, 2024
Merged

Conversation

fwkoch
Copy link
Member

@fwkoch fwkoch commented May 20, 2024

You may now define title/description for math macros in frontmatter, e.g.

math:
  '\aMat':
    title: Custom Macro
    description: Macro I made up only for the sake of this example
    macro: '\mathrm{a}'

Defining a simple command:macro pair is also still valid:

math:
  '\aMat': '\mathrm{a}'

This PR also updates the typst exports to resolve recursive math commands prior to filling them in to the document. Latex renderers handle recursive commands just fine, but typst does not so we must manually resolve them early.

Finally, this makes one small change to simple-validators where validateObject no longer validates arrays (these still have typeof 'object' so they passed before). Only allowing actual Record<string, any>-style objects has always been the expected behaviour, so I consider this a bug fix as opposed to a breaking change.

@fwkoch fwkoch changed the title 馃М Give name/description to math macros 馃М Give title/description to math macros May 20, 2024
Base automatically changed from feat/myst-yml-template to main May 21, 2024 20:21
Copy link
Member

@rowanc1 rowanc1 left a comment

Choose a reason for hiding this comment

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

Looking through, looks good overall, and excited to see these improvements!

packages/myst-to-typst/src/math.ts Show resolved Hide resolved
@fwkoch fwkoch merged commit 65ade89 into main May 28, 2024
5 checks passed
@fwkoch fwkoch deleted the feat/math-macro-objects branch May 28, 2024 03:07
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