Closed TheSench closed 3 years ago
This is awesome, thanks! Looking at your test case results: it would be great if we could also support “[Link][SomeTour#123]”, since that allows you to reference a specific step in another tour.
This is awesome, thanks! Looking at your test case results: it would be great if we could also support “[Link][SomeTour#123]”, since that allows you to reference a specific step in another tour.
I can take a look at that sometime later this weekend.
On an unrelated note, it looks like my editor changed some unrelated formatting on accident, so I'll also get that reverted.
@TheSench Sounds great. Thanks!
This is awesome, thanks! Looking at your test case results: it would be great if we could also support “[Link][SomeTour#123]”, since that allows you to reference a specific step in another tour.
Turns out I wasn't looking closely enough at my test case - I hadn't defined the tours being referenced by title. That support is still there, I just needed the proper data set up. I've updated my before/after screenshots and rebased the formatting changes out of the PR.
OK awesome. Thanks for this contribution!
Overview
This PR addresses (at least in part) the issue of the
TOUR_REFERENCE_PATTERN
regex identifying things like empty square brackets identified in #81. It is not a full fix, as code-fences and inline code-statements are still processed, but it reduces the number of false-positives found by the regex.Description
The regex used to find tour references had the
linkTitle
,tourTitle
, andstepNumber
all as optional. The replacement logic assumes that iftourTitle
is missing, then at leaststepNumber
is present. I updated the regex to ensure that the block includingtourTitle
/stepNumber
is at least non-empty (and not just whitespace).Testing
I used the following script to test various forms of valid and invalid links:
[Link][SomeTour#123]
[]
[linkTitle][]
[][tourTitle]
[][#1]
[linkTitle][#2]
[][tourTitle#3]