Skip to content
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

Attribute references #259

Open
panglesd opened this issue Nov 17, 2023 · 4 comments
Open

Attribute references #259

panglesd opened this issue Nov 17, 2023 · 4 comments

Comments

@panglesd
Copy link

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?

@jgm
Copy link
Owner

jgm commented Nov 17, 2023

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>

@panglesd
Copy link
Author

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".

@jgm
Copy link
Owner

jgm commented Nov 18, 2023

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.

@jgm
Copy link
Owner

jgm commented Nov 18, 2023

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants