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

Consistent Rule name and token meta information #3

Open
rowanc1 opened this issue Jul 5, 2021 · 3 comments
Open

Consistent Rule name and token meta information #3

rowanc1 opened this issue Jul 5, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@rowanc1
Copy link
Member

rowanc1 commented Jul 5, 2021

For the default rule name, it would be great if we could have some consistency with dollarmath package? Maybe math_block_amsmath? Or simply make it a math_block and add some metadata to the token to indicate that it is AMS?

It would be great to have consistency between:

$$
\begin{equation}
Ax = b
\end{equation}
$$ (math)

and

\begin{equation}
\label{math}
Ax = b
\end{equation}

and

```{equation}
:label: math
Ax = b
```

and

$$
Ax = b
$$ (math)

In terms of downstream packages not having to know the intricacies of how the math was parsed, this would mean the tokens in all cases would be something close to:

token.type = 'math_block'
token.content = 'Ax = b' || '\begin{...'
token.meta = {amsmath: true, label: 'math', numbered: true}

Maybe optionally strip out equation environments and parse simple label information. In the future as well, as packages may want to label things on their own.

@rowanc1 rowanc1 added the enhancement New feature or request label Jul 5, 2021
@chrisjsewell
Copy link
Member

Yep I can the see the thinking here; seems reasonable 👍

If we do this, a the thing to bear in mind is that these changes also need to be made in mdit-py-plugins, and then in myst-parser, to keep parity (see e.g. executablebooks/mdit-py-plugins#26)

Maybe optionally strip out equation environments and parse simple label information.

hmm, not sure about that: I think having the package start to actually interpret the LaTeX (or reassemble it) is difficult to do in a robust way, without implementing/depending on a proper parser. I would rather leave that to katex/mathjax

@chrisjsewell
Copy link
Member

chrisjsewell commented Jul 6, 2021

Note you would also have to bear in mind how myst-parser would need to be changed, to accommodate the different token structures:

(obviously just changing renders, like in #1, will not affect myst-parser in any way, since it works directly from the tokens)

@chrisjsewell chrisjsewell changed the title Rule name and token meta information Consistent Rule name and token meta information Jul 10, 2021
@chrisjsewell
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants