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

Implement command tokens and handlers in parser #79

Merged
merged 1 commit into from
Nov 2, 2023

Conversation

runarberg
Copy link
Owner

For now only font commands are commands, previously these were styles and implemented along with other prefixes. Now commands will become new binary prefix nodes in the AST which can apply special commands on the nodes below. For fonts this means to some text transforms or add style attributes. In the future we might implement color #40 and align #39 with command tokens.

Language Changes

  • Now you can stack some font commands to combine them. For example, if you want bold italic A you can write bf it A. Not all font commands stack though e.g. fr bb will not give you double-struck fraktur.

Output Changes

  • With the exception of mathvariant="normal" we no longer use the mathvariant attribute. Instead we apply the relevant text transform directly and the unicode characters in the output (see mathvariant is mostly depricated #70).
  • Text gets some font commands applied via CSS (see Text literals should use CSS for certain font commands #78). Specifically this is bf, it, sf and tt on texts (e.g. bf tt "text"). The latter two change the font-family of the output. If you want control of sans-serif and monospace fonts in the output you can set the CSS custom properties --mathup-font-family-sans-serif and --mathup-font-family-monospace respectively.

Breaking Changes

  • Font commands now only applies to the first item in a term, previously it was applied on the entire term (see Font commands should only apply to next token not row #77). bf A_(i j) would previously also boldface the indices (i j), but now it only boldfaces the matrix A.
  • Font commands will no longer unwrap fences around the operant. For example if you write bf(A) previously the parenteses would be stripped, and you would only end up with A. Now the parenteses are left as is.

Resolves: #70
Resolves: #77
Resolves: #78

For now only font commands are commands, previously these were styles
and implemented along with other prefixes. Now commands will become
new binary prefix nodes in the AST which can apply special commands on
the nodes below. For fonts this means to some text transforms or add style
attributes. In the future we might implement color #40 and align #39
with command tokens.

**Language Changes**

- Now you can stack some font commands to combine them. For example,
  if you want bold italic A you can write `bf it A`. Not all font
  commands stack though e.g. `fr bb` will not give you double-struck
  fraktur.

**Output Changes**

- With the exception of `mathvariant="normal"` we no longer use the
  `mathvariant` attribute. Instead we apply the relevant text
  transform directly and the unicode characters in the output (see #70).
- Text gets some font commands applied via CSS (see #78). Specifically
  this is `bf`, `it`, `sf` and `tt` on texts (e.g. `bf tt "text"`).
  The latter two change the font-family of the output. If you want
  control of sans-serif and monospace fonts in the output you can set
  the CSS custom properties `--mathup-font-family-sans-serif`
  and `--mathup-font-family-monospace` respectively.

**Breaking Changes**

- Font commands now only applies to the first item in a term,
  previously it was applied on the entire term (see #77). `bf A_(i j)`
  would previously also boldface the indices (i j), but now it only
  boldfaces the matrix A.
- Font commands will no longer unwrap fences around the operant. For
  example if you write `bf(A)` previously the parenteses would be
  stripped, and you would only end up with A. Now the parenteses are
  left as is.

Resolves: #70
Resolves: #77
Resolves: #78
@runarberg runarberg merged commit a0e160d into main Nov 2, 2023
6 checks passed
@runarberg runarberg deleted the fix-font-commands branch November 2, 2023 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant