Skip to content

Conversation

tpluscode
Copy link
Contributor

@tpluscode tpluscode commented Jul 3, 2025

Summary

Starting this to hopefully fix #5065

Test plan

I found that the tests of remarksShortcodes are very isolated and completely stub out remark. I don't think that's appropriate and they should instead use a more realistic scenario, using remark and test widgets. More verbose, a not "unit" anymore but I think that method will be more robust in simulating actual usage scenario. Current tests actually ignore how remark works so it's easy to create passing tests of code which does not work in practice

Checklist

Please add a x inside each checkbox:

@tpluscode
Copy link
Contributor Author

The main problem I see is with patterns which do not begin with ^ line start character and maybe multiline patterns.

See, remark goes through the markdown document and cuts off what has already been matched. Multiline pattern without ^ will match too early, leaving some preceding content not yet consumed by remark.

Decap could strongly require matching ^ and forbid the m flag but that would be a breaking change.

Instead, it could check the pattern and ignore matches which are not at the beginning of the remaining markdown value. I would need to think about possible edge cases.

@tpluscode tpluscode force-pushed the fix-shortcode-parser branch from 9411948 to 2d5acb4 Compare July 4, 2025 09:37
@tpluscode tpluscode marked this pull request as ready for review July 4, 2025 09:37
@tpluscode tpluscode requested a review from a team as a code owner July 4, 2025 09:37
@demshy demshy merged commit 46ae63f into decaporg:main Jul 11, 2025
7 checks passed
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.

Inline custom widgets
3 participants