Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds abbreviation definition syntax to djot, enabling automatic wrapping of defined terms in abbreviation elements throughout a document.
Syntax
When these abbreviations appear in text, they render as:
Rationale
1. Accessibility
Screen readers can expand abbreviations for users, improving comprehension. The
<abbr>element with atitleattribute is the semantic HTML way to provide this.2. DRY Principle
Currently, the only way to create abbreviations in djot is manually per occurrence:
For technical documentation with dozens of acronyms appearing multiple times, this is tedious and error-prone. Define-once, apply-everywhere is more practical.
3. Established Syntax
The
*[ABBR]: expansionsyntax is well-established:abbreviationsextensionabbrextensionThis isn't inventing new syntax—it's adopting a proven pattern.
4. Fits Djot's Design
The syntax mirrors existing djot patterns:
[label]: url[^label]: content*[ABBR]: expansionThe
*prefix distinguishes it from links, and the structure is consistent with other definition-style blocks.5. Non-Breaking Addition
*[at line start isn't valid in current djotImplementation Notes
HTMLvshtml) are validPrior Art / Requests
Reference Implementation
djot-php implements this syntax and can serve as a reference:
https://php-collective.github.io/djot-php/guide/syntax.html#abbreviations-extension
A corresponding PR for djot.js can follow if this spec change is accepted.