Skip to content

Commit 9b3ee10

Browse files
committed
fix(parser): treat special chars as literals in macro attributes
Macro attributes (image, audio, video, icon) now parse `.`, `#`, `%` as literal characters instead of interpreting them as shorthand syntax. This matches asciidoctor behavior: - `image::photo.jpg[Diablo 4 picture of Lilith.]` → trailing period preserved - `image::photo.jpg[.role]` → ".role" is alt text, not a CSS class - `image::photo.jpg[Issue #42]` → "#42" is literal, not an ID Shorthand syntax (.role, #id, %option) remains supported only in block-level attribute lines (e.g., `[.class]` before a block). Also consolidates attribute processing logic between block and macro attributes into shared helper functions.
1 parent fe87550 commit 9b3ee10

File tree

2 files changed

+282
-74
lines changed

2 files changed

+282
-74
lines changed

acdc-parser/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4444

4545
### Fixed
4646

47+
- Macro attributes (image, audio, video, icon) now parse `.`, `#`, `%` as literal characters
48+
instead of interpreting them as shorthand syntax. This matches asciidoctor behavior where
49+
`image::photo.jpg[Diablo 4 picture of Lilith.]` preserves the trailing period in alt text,
50+
and `image::photo.jpg[.role]` treats `.role` as literal text, not a CSS class. Shorthand
51+
syntax remains supported in block-level attribute lines (e.g., `[.class]` before a block).
4752
- DSV tables now correctly preserve the first cell. Previously, DSV format (`cell1:cell2`)
4853
was incorrectly treated like PSV (`| cell1 | cell2 |`), causing the first cell to be
4954
dropped. Escape handling (`\:` → literal `:`) also works correctly now.

0 commit comments

Comments
 (0)