-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
nested directive container not working properly #11
Comments
Why? Your proposal breaks some use cases. Why is it better than those use cases? |
Hello @wooorm, Thanks for the quick response. For us, it makes the container directive difficult to use, because you can't put one inside an another and expect them to act as html containers, one closing tag for one opening tag and several siblings existing inside a container. For example, we'd like to use the container to create a tabs component : :::tabs
:::tab[tab1]
Hello
:::
:::tab[tab2]
World
:::
::: We have a workaround for this specific case, but it seems to me this is closer to the way html works. May be it would be an another type of directive, like a 4th level ? Thanks |
Also see the discussion in micromark/micromark-extension-directive#8 |
Sure you can put them inside each other: ::::tabs
:::tab[tab1]
Hello
:::
:::tab[tab2]
World
:::
:::: https://github.com/micromark/micromark-extension-directive#syntax Fenced code works the same. You can nest several things in markdown by using more markers around less markers |
This comment has been minimized.
This comment has been minimized.
Thank you for your responses and the link to the discussion. It helped clarify the matter. I do see one drawback with this hierarchical nesting approach: the container needs to be aware of its contents to determine the appropriate level. Taking the tab example again, if each tab's content is externalized into separate markdown files (which is something we’re planning to do), it might become challenging to identify the correct level to use. Thanks. |
Yep. That’s indeed one of the aspects of this. But you will see it in many languages, such as Rust strings too. Markdown is often very context dependent. Though, your argumentation about externalizing into separate files is of no consequence. |
Initial checklist
Affected package
mdast-util-directive
Steps to reproduce
parsing this markdown :
Actual behavior
the first closing pattern
:::
closes the inside and outside containers instead of just the last one openedSo they are nested, but only one container can be nested in an another one, the "World" container isn't in the outside container as expected
Expected behavior
the closing pattern should only close one container, not several at a time and only the deepest (latest) one opened.
Runtime
No response
Package manager
No response
Operating system
No response
Build and bundle tools
No response
The text was updated successfully, but these errors were encountered: