jgm / djot

A light markup language
https://djot.net
MIT License
1.67k stars 43 forks source link

Glossary and accronym #51

Open lcnbr opened 2 years ago

lcnbr commented 2 years ago

It would be great to have a nice syntax for acronyms (abbr in HTML) and glossary entries. I am not aware of any markdown flavor that handles this.

Maybe this ties into a more robust cross-referencing syntax..

matklad commented 1 year ago

For an abbr with a title,I think a natural syntax would be

[HTML]{abbr="HyperText Markup Language"}

For an abbr without title, I'd love to write

[HTML]{abbr}

the problem with that is that we don't allow bare attributes, so that has to be {.abbr}.

Which raises the question: why do we need .attr syntax at all? Perhaps we should remove the dot and use [key1 key2=val key3] syntax instead?

We already remove the dot in one place:

::: attr

:::
jgm commented 1 year ago

Two possible reasons:

bpj commented 1 year ago
  1. .class is the CSS syntax, and it makes sense to follow it.
  2. The value is actually not always required in HTML — there is an implied ="true" (unlike XHTML) — so any change should probably be in that direction.
matklad commented 1 year ago

requiring the . makes it less likely that someone will trigger attribute syntax inadvertently

One thing I didn't realize is that attributes can apply directly to words: HTLM{.abbr}, HTML{}. An alternative is to require an explicit span (using any kind of delimiters), so that attribute syntax requires two pairs of delims, which perhaps is protection enough from accidents.

Looking at #65 and especially at #66 makes me feel that word{.attr} syntax is problematic -- it's difficult to know what the word is without unicode tables.

matklad commented 1 year ago

.class is the CSS syntax, and it makes sense to follow it.

In CSS selectors, both foo bar and foo .bar are possible. The . is there to distinguish between class selectors and tag selectors. Requiring .foo without foo also having a meaning feels odd.

lcnbr commented 1 year ago

Regardless I think having to define the acronym at each use would be awful.. what about something like the syntax here