diff --git a/changelog.yml b/changelog.yml index a16973be..1a48f453 100644 --- a/changelog.yml +++ b/changelog.yml @@ -6,6 +6,7 @@ bugs: - text: "Dark Theme: Render checkboxes in a lighter color" - text: "Fix Relative Parent links not working - #256" + - test: "Improve inline tags regex - #265" - version: "1.70" date: 2020-09-16 diff --git a/lib/core/processors/inline_tags.dart b/lib/core/processors/inline_tags.dart index d4ee305a..f9fc3946 100644 --- a/lib/core/processors/inline_tags.dart +++ b/lib/core/processors/inline_tags.dart @@ -15,7 +15,7 @@ class InlineTagsProcessor { p = '\\+'; } - var regexp = RegExp(r'(^|\s)' + p + r'([^ ]+)(\s|$)'); + var regexp = RegExp(r'(^|\s)' + p + r'([^\s]+)(\s|$)'); var matches = regexp.allMatches(text); for (var match in matches) { var tag = match.group(2); diff --git a/test/processors/inline_tags_test.dart b/test/processors/inline_tags_test.dart index 0757e437..d7276382 100644 --- a/test/processors/inline_tags_test.dart +++ b/test/processors/inline_tags_test.dart @@ -136,4 +136,17 @@ Enjoy! expect(tags, {'hello'}); }); + + test("Handles Spaces", () { + var body = """# DateTimeOffset +#csharp + +Provides a combined #structure\tof `DateTime` with an `Offset` property defining a deviation from UTC. It doesn't associate a time zone with the offset. +"""; + + var p = InlineTagsProcessor(tagPrefixes: {'#', '+', '@'}); + var tags = p.extractTags(body); + + expect(tags, {'csharp', 'structure'}); + }); }