micromark-extension-directive
micromark-extension-directive copied to clipboard
Adds support for colons in directive names
Initial checklist
- [X] I read the support docs
- [X] I read the contributing guide
- [X] I agree to follow the code of conduct
- [X] I searched issues and couldn’t find anything (or linked relevant results below)
- [X] If applicable, I’ve added docs and tests
Description of changes
This PR adds support for colons within a leaf directory name. This syntax is helpful to create namespaced methods, like so: ::hello:alice and ::hello:bob.
I needed this for a particular use case and wasn't planning on submitting a PR to the original repo. In honesty, it probably shouldn't be merged since it isn't according to the common spec. Still, I'm submitting it here for transparency and interesting conversations.
I like this because JSX/XML/HTML also support a “namespace” (:svg:rect).
I dislike this because it is close to conflicting with gemoji shortcodes (see also this related fix) in the text variant (:wave:how are you?). It’s probably not common to use a word directly after a gemoji, but gemoji are very common, so I’d imagine it exists in the wild.
If a colon was supported, I think we shouldn’t allow them arbitrarily: :a::::::::::::::::b seems weird. Instead, I think I’d like them to work as “two” names, with a single colon in between, and that dashes or underscores cannot be used to end each name part (so :a-:b would not be ok).