Fix adjacent shortcut-style links not rendering correctly#275
Merged
Conversation
Add preprocessor regex to convert shortcut links [text] to explicit form [text][] when followed by whitespace and another [. This disambiguates the syntax for Hoedown, which otherwise fails to parse the first link. The fix requires whitespace between links to avoid incorrectly modifying explicit reference links like [text][ref]. Related to #25
Add negative lookbehind (?<!\]) to the shortcut link regex to avoid matching the reference ID part of [text][ref] or ![text][ref] when it's followed by whitespace and another [. For example, this prevents incorrectly modifying: ![Another reference][img2] [img1]: url where [img2] would have been matched and converted to [img2][] because it's followed by newlines and then [img1]. Related to #25
Contributor
Code Coverage ReportCurrent Coverage: 52.63% Coverage Details (Summary) |
schuyler
pushed a commit
that referenced
this pull request
Jan 24, 2026
Comprehensive testing plan covering all changes since v3000.0.3: - Smart quote substitution fix (#289) - Editor jumping when typing at end of long documents (#288) - New document window positioning (#286) - Graphviz/Mermaid button positioning in Compilation Settings (#280) - Adjacent shortcut-style links rendering (#275) Includes regression testing checklist for core functionality.
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.
Summary
[text]to explicit form[text][]when followed by whitespace and another[[text][ref]Related Issue
Related to #25
Test Plan
regression-issue25.mdandregression-issue25.htmlgolden files testing adjacent shortcut linkstestRegressionIssue25_AdjacentShortcutLinksunit testtestImageswhich validates the lookbehind works correctly)Manual Testing
Test the following markdown in the editor preview:
Both
[foo]and[bar]should render as clickable links.