Skip to content

🐛 FIX: Enforce the reference-definition label limit - #484

Open
manav4u wants to merge 3 commits into
executablebooks:masterfrom
manav4u:fix/reference-definition-label-limit
Open

manav4u wants to merge 3 commits into
executablebooks:masterfrom
manav4u:fix/reference-definition-label-limit

Conversation

@manav4u

@manav4u manav4u commented Nov 22, 2026

Copy link
Copy Markdown

Reference definitions currently accept labels longer than CommonMark's 999-code-point limit. An oversized label such as "a" + " " * 999 is consumed as a definition and can make [a] resolve, instead of leaving the definition visible as text.

Stop the raw label scan at the boundary, before case or whitespace normalization. This addresses part 1 of markdown-it/markdown-it#1213, already fixed in markdown-it 15.0.3. It does not include the broader upstream rewrite or #480's separate title-separator fix.

The regressions cover 999/1000-code-point labels, astral characters, case expansion, escapes, multiline labels, containers and reference metadata. Against unchanged master, 14 fail and 12 pass.

Local validation (Linux):

  • tox -e py310,py313,py314 -- tests/ -q: 1,216 passed on each.
  • tox -e py313-plugins: 730 passed, 3 skipped, 1 xfailed.
  • pre-commit run --all-files: passed.
  • 168 focused boundary cases match markdown-it 15.0.3 HTML and reference metadata.
  • Combined with Require a separator before multiline reference titles #480: 1,217 passed.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant