-
-
Notifications
You must be signed in to change notification settings - Fork 49
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
Add "role" shorthand to attribute syntax #146
Comments
More generally, from an extension viewpoint, it might be nice if there was a standardised prefix for all extension types. For example, let's say the prefix was
Went to AST like:
|
In view of
which however might be problematic due to Footnotes
|
Are classes not sufficient? |
@kaleb I think the idea is that classes and roles are semantically different and/or that you may not want role markup included as classes in rendered HTML. I can sympathize, since I sometimes use Pandoc filters to remove certain attributes in HTML output, but I'm not sure that it needs to be handled any other way. |
Reading https://borretti.me/article/brief-defense-of-xml made me think that we do need some explicit support for this. I think being “extensible” is one of the greatest features of djot, and, if we can write in the manual “this is how you define custom elements: …”, that’ll help the users to grok the capability. You can do this today with class or your own attribute, if you already know that it’s possible. Adding an explicit facility would help to unlock people’s imagination. There’s also a problem that with class the role name goes after inline element, while it wants to be the first. So perhaps we should steal a page from adoc here?
|
The thing is that it would be annoying to have to type I do not really see why the role indicator needs to come before the As for blocks it is already the case that in
wouldn't be good enough, and it's consistent, although
substituting Footnotes
|
I envision requiring that As to why it makes sense for role to be prefix -- the difference between role and other attributes is that it affects semantic interpretation of what follows, so it helps to see it first. Eg, |
This would make me very happy and secure my wavering Djot fandom. I agree that prefix is better for this and like @matklad's proposed syntax, but if it's considered too clash-prone then perhaps there could be a prefix punctuation character on top? (I'll throw |
Similar to roles in docutils (https://docutils.sourceforge.io/docs/ref/rst/roles.html):
:name:`content`
,it would be nice to have an attribute shorthand, to provide "semantic meaning to content" (see also https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles).
This would provide a clear hook for AST preprocessors to use, as discussed in #77 (comment)
Currently, one could obviously just use
`content`{role=name}
and[content]{role=name}
, but this is quite verbose if you are going to be using it often.Similar to
id=name
being shortened to#name
, it would be nice to use a prefix.The one that comes to mind is
=name
, i.e.`content`{=name}
and[content]{=name}
,although this is currently used for raw-inline 😬
The text was updated successfully, but these errors were encountered: