Skip to content

Ignore empty abbreviation definitions in element tails - #1677

Merged
waylan merged 2 commits into
Python-Markdown:masterfrom
Nikhil-4404:fix/abbr-empty-tail-definitions
Oct 26, 2026
Merged

waylan merged 2 commits into
Python-Markdown:masterfrom
Nikhil-4404:fix/abbr-empty-tail-definitions

Conversation

@Nikhil-4404

@Nikhil-4404 Nikhil-4404 commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Description

An empty glossary definition is already ignored when an abbreviation occurs
in an element's text. After an inline element, the same abbreviation is
incorrectly wrapped in an empty-title <abbr> element.

For example:

import markdown
from markdown.extensions.abbr import AbbrExtension

markdown.markdown('*word* HTML', extensions=[AbbrExtension(glossary={'HTML': ''})])

Actual output:

<p><em>word</em> <abbr title="">HTML</abbr></p>

Expected output:

<p><em>word</em> HTML</p>

Apply the existing nonempty-definition check to element tails as well. Add a
regression with empty and nonempty glossary definitions before and after an
emphasis element, and an unreleased changelog entry.

The new regression failed before the fix. All 31 abbreviation tests pass
afterward. python -m unittest discover tests reports 1,138 tests run, OK,
with 52 skipped on Windows / CPython 3.14.0. Optional Pygments and Tidy
dependencies were not installed. Changed-file Flake8 passes. Full Flake8
reports four unchanged E201/E202 findings in postprocessors.py:90, also
reproduced from the base source.

AI Assistance Disclosure

  • No AI tools were used in preparing this PR.

  • AI tools were used and I have disclosed which ones, and have fully reviewed and verified their output.

    OpenAI Codex generated the proposed fix, regression test, changelog entry,
    proposed commit message and this draft description. The submitter must
    personally review and
    understand the changes before checking the declaration above.

    AI tools were used to assist with the following:

    • Code
    • Code Comments
    • Documentation
    • Changelog Entry
    • Commit Message
    • The Description Above
    • Other: ______________

Checklist

Apply the same nonempty-definition check used for element text to tails.
Cover empty and nonempty glossary entries around inline elements and
record the behavior in the unreleased changelog.

Assisted-by: OpenAI GPT-6 <[email protected]>
@waylan

waylan commented Oct 26, 2026

Copy link
Copy Markdown
Member

You have some unmet requirements according to the unchecked items. If you can't be bothered to follow our guidelines, then why should we be bothered to review your submission?

@waylan waylan added the more-info-needed More information needs to be provided. label Oct 26, 2026
@Nikhil-4404

Copy link
Copy Markdown
Contributor Author

Thanks for pointing this out. I’ve reviewed the changes and corrected the checklist. The changelog merge conflict is also resolved

@waylan waylan added approved The pull request is ready to be merged. and removed more-info-needed More information needs to be provided. labels Oct 26, 2026
@waylan
waylan merged commit 8bfb9aa into Python-Markdown:master Oct 26, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved The pull request is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants