Skip to content

Feature Request: Set HTML "id" for admonition blocks #1174

@iBug

Description

@iBug

As far as I understand, admonition blocks support extra classes via the syntax !!! class1 class2 class3. It would be nice if this could be extended to support an id for navigation.

Example input:

!!! class1 class2 #my_admonition

Example output:

<div class="admonition class1 class2" id="my_admonition">

It would be better if the hash tag can appear in the class list, so !!! class1 #my_admonition class2 should produce the same output. The behavior would be undefined if multiple "hash tags" are present for the same admonition block, as it's up to the user to ensure the syntax is valid (it's invalid HTML that one element has multiple IDs).

I've seen #685 and it seems at first glance it wouldn't be too complex to add this support, but I'm open to any thoughts and ideas you may have.

Metadata

Metadata

Assignees

No one assigned

    Labels

    3rd-partyShould be implemented as a third party extension.extensionRelated to one or more of the included extensions.featureFeature request.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions