Skip to content

abbr extension breaks title attribute added using attr_list #1460

Closed

Description

@nbanyan

Bug description

*[abbr]: Abbreviation Definition

![Image with abbr in title](abbr.png){title="Image with abbr in title"}

This renders the attribute code as plain text because the Abbreviation extension modifies the text in the attribute causing it to no longer be a valid attribute list.

Reproduction

9.5.18-abbr-attr_list-conflict.zip

Steps to reproduce

  1. Enable the abbr and attr_list extensions
  2. Include an abbreviation definition on a page
  3. Use the abbreviation in a title attribute for an object using the attr_list syntax

Activity

  1. waylan commented on Apr 23, 2024

    @waylan
    Member

    I can confirm this is an issue.

    >>> import markdown
    >>> src = '''
    ... *[abbr]: Abbreviation Definition
    ...
    ... ![Image with abbr in title](abbr.png){title="Image with abbr in title"}
    ... '''
    >>> markdown.markdown(src, extensions=['abbr', 'attr_list'])
    '<p><img alt="Image with abbr in title" src="abbr.png" />{title="Image with <abbr title="Abbreviation Definition">abbr</abbr> in title"}</p>'

    The cause of the issue is that the abbr extension runs an inline processor while the attr_list extension runs a treeprocessor. If both extensions used the same type of processor we would just ensure they were ordered so that the attr_list processor ran first. But being different processor types, it is not so easy. Especially because we generally want inline processors to run before attr_list so that attribute lists can be applied to inline elements.

    This may require use of a custom treeprocessor for the addr extension which runs later. I will have to think about that.

  2. added
    bugBug report.
    extensionRelated to one or more of the included extensions.
    confirmedConfirmed bug report or approved feature request.
    on Apr 23, 2024
  3. added a commit that references this issue on Apr 24, 2024
    c03724b
  4. added a commit that references this issue on Apr 25, 2024
    ec8c305
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug report.confirmedConfirmed bug report or approved feature request.extensionRelated to one or more of the included extensions.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions