Skip to content

Fix markdown shortcode regex dropping text around inner brackets#2844

Draft
CollinBeczak wants to merge 1 commit into
mainfrom
Fix-markdown-shortcode-dropping-bracketed-text
Draft

Fix markdown shortcode regex dropping text around inner brackets#2844
CollinBeczak wants to merge 1 commit into
mainfrom
Fix-markdown-shortcode-dropping-bracketed-text

Conversation

@CollinBeczak

Copy link
Copy Markdown
Collaborator

The shortcode tokenizer regex allowed [ inside bracketed content, so input like [HIDDEN TEXT [way 2343242]] was matched as one shortcode and OSMElementHandler then extracted only the OSM element, silently dropping the surrounding text. The [[way 1]] form lost one bracket the same way.

Excluding [ from the inner character class makes the regex match only the innermost brackets, leaving surrounding text untouched.

The shortcode tokenizer regex allowed `[` inside bracketed content,
so input like `[HIDDEN TEXT [way 2343242]]` was matched as one
shortcode and OSMElementHandler then extracted only the OSM element,
silently dropping the surrounding text. The `[[way 1]]` form lost
one bracket the same way.

Excluding `[` from the inner character class makes the regex match
only the innermost brackets, leaving surrounding text untouched.
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