Replies: 2 comments
|
I'm not quite sure what this is implementing - but it feels a little bit niche to me. Anywidget and citations are pretty different functions within myst, so it feels like merging them runs the risk of overloading too much functionality on a single directive. |
|
I fully grant that this is a niche requirement - as of now. It isn't meant as general-purpose widget tooling. It targets one specific, narrow case: a citation where the citing paper says it applied the cited paper's method to new data, and the author wants that method actually runnable, not just referenced. That's a small slice of real citations, and scoping it that narrowly is deliberate. On "overloading" — cite-invoke doesn't merge {cite} and {anywidget} in the sense of replacing either. Both stay exactly as they are for everyone who wants just a citation or just a widget. This is a third, additive directive specifically for the coupled case. The reason it's coupled rather than left as "just place a {cite} next to an {anywidget} yourself" is the actual design motivation: two separately-authored constructs can drift. Delete the citation, the widget's still there. Update the method, the citation doesn't know. Emitting both from one authoring call means they share a lifecycle — delete the construct, both go, together, by construction rather than by the author remembering to keep them in sync manually. (Happy to walk through the actual AST mechanics if that's useful — the short version is run() returns an array, so one directive call can emit a citation node and a widget node as siblings, each behaving exactly like the native version would on its own.) |
Uh oh!
There was an error while loading. Please reload this page.
I've been building a small plugin, cite-invoke, that merges citing a
method with running it -- one directive call emits both a real citation
node and a real anywidget node, so deleting the citation removes the
execution with it, and they can't drift out of sync the way two
separately-authored constructs can.
Built by reading mystmd's own source directly rather than inferring
from docs -- happy to share specifics on the DirectiveSpec/AST-node
details if useful to anyone else building directives that need to
emit more than one node type.
Three live, working demonstrations:
Donation issue open on myst-contrib: myst-contrib/.github#1
Would value any community feedback, especially from anyone who's hit
the same "I want one authoring construct to do two related things"
problem.
All reactions