achieving collapse without vue component #845
Mister-Hope
started this conversation in
General
Replies: 1 comment
|
This is indeed an issue with the markdown list syntax itself. Without leaving an empty line for processing, consecutive content is treated as part of the same block rule. Although it requires an empty line and indentation of the content, it is actually acceptable from a readability perspective. I originally considered using Using I didn’t render it as |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
https://theme-plume.vuejs.press/guide/markdown/collapse/
This is nice with a perfect trick to simply custom tokenizer with just hack-jacking unordered lists in markdown. But it would be confusing for users to:
If users are not providing the content that you are expecting, I think your plugin will throw (or at least the layout breaks badly). And your test cases do not contain checks for these nonstandard markdown contents.
Also a Vue component is introduced.
It did take hours for me to think of a nicer plan.
See: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/details#attributes and https://caniuse.com/mdn-html_elements_details_name
The details natively support open/close state with a
openattribute and anameattribute to achieve accordion. The current support range is 2 years major support (except Firefox with 1 year+)I think it's possible to make the markdown plugin standard by outputting
<details>(absolutely better a11y)and a listener utils to handle envs that
nameare not supported.Besides, I am planning to use a similar outlook with the original one. But, I will not do the trick to convert the unordered list to a details block in the render stage. Instead, new rules shall be registered and ensure a customized token is generated. Indentations are canceled to reduce illegal contents possibility. Only contents before FIRST marker are dropped.
I am planning with the following syntax:
Prettier is happy with it :)
Custom renderer shall be supported (to convert back to vue component)
Any suggestions about this implementation?
All reactions