-
Notifications
You must be signed in to change notification settings - Fork 10
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
Proposal to allow Rule.check to identify the current rule #21
base: master
Are you sure you want to change the base?
Conversation
In markdown-it JS, via the `alt` list, you could specify that a rule interrupted another block, only for certain block types. This is a rough proposal to re-implement that feature, such that an implementation of `Rule.check` could identify what the current rule was. Currently, I'm just setting a string name on the `BlockState`, as this was the least intrusive way (i.e. does not require a change in the signature of check). But perhaps there is a nicer way?
This would be useful for example here: https://github.com/chrisjsewell/markdown-it-plugins.rs/blob/2bfc91dbe83fc31994b41c98546ccf570754c247/crates/footnote/src/definitions.rs#L109-L112 |
I've worked very hard to make sure What's the issue with Or |
Hmm, let me get back to you on this one. I was playing around with https://pandoc.org/try/, with e.g.
I thought there was something the markdown-it plugin was not reproducing, but I can't see what now 😬
The main thing was that |
(mainly though, this parser implementation is looking great thanks!) |
I think And the fact that it doesn't do that for Paragraph is just a bug specifically in paragraphs. |
I've checked the code, and it doesn't. Nevermind.
So can you check if it's really necessary? If it is, your approach seems to be good, except it should be But I feel like child node should avoid knowing about the exact parent type, because it might break interoperability between two custom plugins. |
sorry, I do hope to get round to this eventually 😅 |
In markdown-it JS, via the
alt
list,you could specify that a rule interrupted another block, only for certain block types.
This is a rough proposal to re-implement that feature, such that an implementation of
Rule.check
could identify what the current rule was.Currently, I'm just setting a string name on the
BlockState
, as this was the least intrusive way (i.e. does not require a change in the signature of check). But perhaps there is a nicer way?