I’m trying to write a Markdown highlight definition for the CustomEditfield open source editor. Unless I’m misunderstanding, I think I have found a bug in the highlight engine.
This is a really simple definition that should highlight text flanked with
<?xml version="1.0" encoding="UTF-8"?> <highlightDefinition version="1.0"> <name>Markdown</name> <contexts defaultColor="#000000" caseSensitive="no"> <highlightContext name="BoldUnderscore" highlightColor="#326510"> <startRegEx>\s__[^ \t]</startRegEx> <endRegEx>__</endRegEx> </highlightContext> </contexts> </highlightDefinition>
Note that the context should begin with a
__ that is preceded by whitespace with at least one non-space or non-tab character. This fails to work on this text:
which it should. If I remove
\s and replace it with
[ ], same thing. If I change the regex to
__[^ \t] then it highlights the
bold text but this is an incorrect pattern as I need to assert that there is whitespace before the
I’ve looked through the code of CustomEditfield to make sure that the engine isn’t trimming spaces between matches but I don’t think it is.
Am I misunderstanding something here?