Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(parser): simplified grammar rules for attributes (#804)
Process the attributes in a more generic way: positional values are retained until the block is initialized, in which case they are process accordingly, by mapping the position to an expected attribute name. Overall, the grammar for block and inline attributes is much simpler, which means that adding support for new elements will require less effort. Also: - no need to the `AdmonitionKind` and `BlockKind` types, whose constant values are all `string` now and stored in the `style` key. - for inline attributes, spaces after the opening square bracket (`[`) are not tolerated (this was already the case for block attributes). This allows for a better consistency and simpler grammar rules. BREAKING CHANGE: for images and links, positional attributes are delimited with commas, so if a link text should contain such a comma, it is necessary that the text be wrapped in single or double quotes. This makes the syntax (and thus, the parsing) consistent between block attributes and inline attributes. Eg: `link:http://example.com["a description, with comma"]` BREAKING CHANGE: inline attributes content must not start with spaces, as it is the case with block attributes. Eg: `image::cookie.png[ cookie ]` is not valid. Fixes #750 Signed-off-by: Xavier Coulon <[email protected]>
- Loading branch information