fix markInputRules for italics mark

add another layer of matching by introducing support for second match group
since javascript (at least in current browsers) still lacks lookbehind in regex

so now supports

/nomatch(markstart(text)markend)nomatch/ and still supports the
/markstart(text)markend/ syntax

all `nomatch` will be kept as is so kindof simulating lookbehinds
This commit is contained in:
Marius Tolzmann
2019-05-07 18:50:04 +02:00
parent b0c28da3c1
commit 98cf0e425a
2 changed files with 19 additions and 13 deletions

View File

@@ -30,7 +30,8 @@ export default class Italic extends Mark {
inputRules({ type }) {
return [
markInputRule(/(?:^|[^*_])(?:\*|_)([^*_]+)(?:\*|_)$/, type),
markInputRule(/(?:^|[^_])(_([^_]+)_)$/, type),
markInputRule(/(?:^|[^*])(\*([^*]+)\*)$/, type),
]
}