Repository navigation
Références de liens : prendre en compte les définitions dans les blockquotes et colonnes - #48
Merged
Merged
Conversation
Container content is lexed per block, after reference definitions have been collected, so a definition inside a blockquote or a column was silently dropped and every reference to it stayed literal text. extractLinkDefinitions() now also walks blockquote runs and columns containers (lexing their content, recursively, depth-capped) and registers the definitions found there in document order. Definitions are global per CommonMark §4.7; first definition still wins and the URL safety check is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CPcuaaxrCottkeL1ykoSWe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problème
Une définition de lien placée dans un blockquote ou dans un bloc
:::columnsétait perdue sans erreur, et toutes les références vers elle restaient du texte littéral :Sortie avant :
<p>[foo]</p>. Attendu :<p><a href="/url">foo</a></p>.La cause : le contenu des conteneurs n'est lexé qu'au moment de construire le bloc, donc après la collecte des définitions.
parseBlocks()ignorait ensuite ces tokensLINK_DEFINITION.Correctif
extractLinkDefinitions()parcourt aussi les séquences de blockquote et les conteneurs de colonnes. Il lexe leur contenu (récursivement, profondeur plafonnée à 32) et enregistre les définitions trouvées dans l'ordre du document. Selon CommonMark §4.7, les définitions sont globales. La première définition gagne toujours, et le contrôle de sécurité des URL est inchangé (test dédié avecjavascript:).Tests
tests/Integration/NestedLinkDefinitionTest.php(6 cas) : blockquote, blockquote imbriqué avec titre, colonne, usage dans la même citation, priorité de la première définition, URL dangereuse rejetée.Note : cette PR et #47 touchent toutes deux
extractLinkDefinitions(), mais pas les mêmes lignes. Un conflit éventuel serait trivial.🤖 Generated with Claude Code
https://claude.ai/code/session_01CPcuaaxrCottkeL1ykoSWe
Generated by Claude Code