Closed rowanc1 closed 2 years ago
@chrisjsewell finding myself wanting to make changes that are in the other branches just to get started on this again.
Looking forward to getting the other 3 PRs moved ahead and then will dive into some of the comments. I will add a few more tests and document it some more from the outside, as discussed I think we can take this in a few different stages (e.g. single-doc, multi-doc).
Rebased on the other three branches. I will put a bit more work into this and I think it will be good for a first pass of state!
@fwkoch @chrisjsewell this is good to come in in my opinion. Could one of you please review!
Adds three new role directives for referencing (eq, numref, ref) and has basic state management in place. That state management is not exposed externally, so it is easy to refactor it as we go and learn more. This unblocks downstream work on mystjs that @fwkoch is getting into this week!
The references currently look like this:
There is some playing that we will have to do on a numbering pass to make sure that amsmath and dollarmath get picked up ok, that will be the responsibility of Myst, but I introduced/refactored a test to have a fake renderer here.
I just moved over a few tests from mystjs
which belong here. Also added figure/math numbering.
Numbering and reference roles are updated and work in vscode.
Note this is on top of the packaging PR #26, which should be merged first.
This should now be good to go @chrisjsewell. We will have some other numbering in the mystjs package, but this will remain necessary for myst-vs-code to work, which will continue to rely on markdownit.
The more complicated multi-document referencing will happen in mystjs. There is also some additional work to get this hooked up to dollarmath/amsmath. That work is in progress here, but requires this branch (and another one incoming) to pass tests!
My recommendation is:
Thanks @chrisjsewell.
Double checked the rebase. Tests and fixtures are there correctly, tests pass!
Initial take at #10
At the moment the implementation is as follows:
Currently I am pushing the reference tokens into those states with the functions
newTarget
(e.g. called when a labelled figure is created) andresolveRefLater
(e.g. called forref
,numref
, etc.).I will call out the logic in a review. Looking forward to comment from @chrisjsewell.
Adds functionality for: