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
Possible parsing ambiguity: attribute key starting with punctuation #242
Comments
This is the grammar in the comments in attributes.ts:
|
I see the issue with allowing |
Thoughts:
I am torn about what's the best solution here. Given that we already assign special meaning to |
Actually, did something change? I can no longer reproduce the original example on the playground. Here's what I get
So that it seems that we just never parse |
I never did check the actual behavior. Nonetheless, this is a parsing ambiguity. We should at the very least document that the emphasis interpretation takes precedence, and maybe go further and disallow As for |
I think it's safer to disallow underscores at the start of keys, as it removes any ambiguity. I have a feeling that this will be a recurrent issue otherwise. Does HTML allow underscores at the start of attribute names? Not that djot should be as bound to HTML as Pandoc's element types still largely are. |
It does; HTML allows attributes to consist of all characters other than controls, |
Hello,
I'm still discovering the syntax and trying to understand the existing parser, please let me know if I missed something.
As far as I understand, attribute keys and bare value allow
_
,:
, and-
anywhere, including in the first character of a key and the last character of the value.Therefore:
word{_key=value_}
would mean<span _key="_value">word</span>
,word{_keyvalue_}
would meanword<em>keyvalue</em>
,word<em>key=value</em>
would require something likeword{_key\=value_}
?I find it not very satisfying, that
=
having a potentially very long range, and the overall (admittedly contrieved) construct being hard to disambiguate with the brain.The samething happens with
-
instead of_
, replacingem
withdel
.Wouldn't it be simpler for both humans and parsers to forbid punctuation at the beginning of an attribute key? (Or would it break too much existing text?)
The text was updated successfully, but these errors were encountered: