Open baincd opened 2 years ago
Hi @Gruntfuggly , I understand you don't want change the default regex, but I feel this isn't really a change but a fix to the existing default regex. You can see my explanation for my suggested changes above. I have already applied this in my own settings, but I really think this fix could benefit other users and even potentially resolve some outstanding issues.
Either way you decide, thank you for your consideration :smile:
I found an issue with this regex, it is matching tags even if they are not preceded by any comment An example with the ! tag
I was using this regex for a while and it doesn't have this issue but it matches the tag if it is proceeded by anything even if it is not in the list (//|# ...
(//|#|--|;|/\*|^|^[ \t]*(-|\d+.))[^\s]*($TAGS)
@JustOptimize,
I found an issue with this regex, it is matching tags even if they are not preceded by any comment An example with the ! tag
I would disagree that this is a bug. I believe this is exactly how it is intended to work - one of the conditions a tag is matched is if the only chars before it on the line is whitespace
To accomplish what I believe you are looking for (to not to match tags preceded by only whitespace), I would suggest trying this modified version of this PR: (//|#|<!--|;|/\\*|^[ \\t]*(-|\\d+\\.)[ \\t])[ \\t]*($TAGS)
Of course you are free to make this modification in your own settings, but this change should not be made to the default regex because as @Gruntfuggly has made perfectly clear the functionality of default regex will not be changed. (This PR only fix bugs in the default regex without changing it's functionality)
The changes 1+2 actually are a change that effects current highlighting "intended for better highlighting markdown", while "the main part" 3 does fix a bug. Can you please move 1+2 out to a separate PR in the hope that the main change gets merged to close the linked bug?
I understand that changes to the default regex are rejected. However, this PR does not change the default regex, but rather fixes a couple of issues with the default regex.
Here is the current regex, and the proposed regex as entered in the Settings UI editor
.
1X TODO
to match-
or1.
1.TODO
or-TODO
matching, as those are not valid markdown lists($TAGS)
to only match spaces and tabs (not newlines)