-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
Allow whitespace between attributes in directives #20
Comments
Also, this is more inline with how HTML attributes work since I'm fairly certain they allow newlines or spaces in between attributes of elements |
Have you considered how this affects different directives? Texts? Containers? Are there other markdown things that work like this? Have you found this feature in the proposal or in other implementations? |
@wooorm I don't think it would affect anything. The For container directives, it also should not play a role :::foo{
bar="xyz"
}
Some text
::: Should be functionally equivalent to: :::foo{ bar="xyz" }
Some text
::: |
HTML is a mostly whitespace-insensitive language. Markdown is a whitespace-sensitive language. Markdown blocks are parsed per line: either a line is something, or it isn’t. It doesn’t backtrack past lines. What do you want to happen for: :::foo{
bar="xyz"
qwe Additionally, you mention whitespace, there are still many forms of whitespace that you don’t show. What about: ::question{
slug="are-you-excited"
098
} To illustrate those two together, how far do you go? ::question{
# Is this a heading? Just some attributes?
> Block quote? Do we just go to the end is every word here an attribute? |
Importantly, “whitespace” is generally |
I don't know how the inner workings of the parser works, but I don't see why the parser can't enter a certain mode for parsing attributes When it runs into When it runs into a Any cases where it runs into unexpected format of attributes should cause an error |
Markdown doesn't have errors, just like html or css, unlike javascript, it never crashes. I don't think crashing for directives is a good idea. They're supposed to be like markdown. This seems like a very big departure from the proposal. If you want errors and breaking away from markdown and line endings in attributes: we have that already with MDX! |
In that case, it doesn't need to error, rather it will just not parse correctly and instead just return the directive content as text as is currently done (for example like when a comma is inserted in between directives) |
This (backtracking across lines) is something that markdown doesn’t currently do. I understand that you want to do what you propose. |
Initial checklist
Problem
suffers from long lines
Easier to write & read
Solution
Easier to write & read
Alternatives
Nope, enhancement
The text was updated successfully, but these errors were encountered: