Attribute references
panglesd opened this issue · 4 comments
I'd like to use the djot syntax for writing presentations, that may require quite a lot of attributes.
However, inline attributes in the middle of the text harm the readability, which was the initial goal of markdown (from which djot is clearly inspired!)
I'd like to propose some idea to improve that: references to a set of attributes.
This [text][a] is an [example][a] of [factorisation][a] of a lot of [attributes][b].
[a]: { pause emph-at-unpause}
[b]: { step top-at-unpause }
So:
- A label followed by
:
followed by a{
is a reference attribute definition, - A use of the label adds the attributes to the content.
In particular the above would be equivalent to:
This [text]{pause emph-at-unpause} is an [example]{pause emph-at-unpause} of [factorisation]{step top-at-unpause} of a lot of [attributes][b].
What do you think of this syntax?
You can already add attributes to a link reference, using the syntax that is always used for adding attributes to blocks:
% djot
[text][a]
{.foo #bar}
[a]:
^D
<p><a href="" class="foo" id="bar">text</a></p>
Currently link references only work for links. It could be interesting to think about letting them work for spans, so that when a URL is missing, as in the above example, we'd get
<span class="foo" id="bar">text</span>
Thanks for your answer! I just though that
{.foo #bar}
[a]:
is not very self-explanatory, and less readable than a "first class support":
[a]: {.foo #bar}
But maybe that's not worth "first class support".
I kind of agree with you about intuitive readability. But it's good to have a consistent system for adding attributes that works the same for every type of block. Otherwise people have to remember where attributes can go in each case. There's a high bar for making an exception, I think.
However, one could argue that there's a conceptual difference between adding an attribute to a reference definition block, and making the attribute part of the content of the reference (which is what we're doing here).