fix: Loosen italic markdown matching a little
see: https://github.com/outline/outline/discussions/3336
This commit is contained in:
@@ -25,9 +25,29 @@ export default class Italic extends Mark {
|
||||
}
|
||||
|
||||
inputRules({ type }: { type: MarkType }): InputRule[] {
|
||||
/**
|
||||
* Due to use of snake_case strings common in docs the matching conditions
|
||||
* are a bit more strict than e.g. the ** bold syntax to help prevent
|
||||
* false positives.
|
||||
*
|
||||
* Matches:
|
||||
* _1_
|
||||
* _123_
|
||||
* (_one_
|
||||
* [_one_
|
||||
*
|
||||
* No match:
|
||||
* __
|
||||
* __123_
|
||||
* __123__
|
||||
* _123
|
||||
* one_123_
|
||||
* ONE_123_
|
||||
* 1_123_
|
||||
*/
|
||||
return [
|
||||
markInputRule(/(?:^|[\s])(_([^_]+)_)$/, type),
|
||||
markInputRule(/(?:^|[^*])(\*([^*]+)\*)$/, type),
|
||||
markInputRule(/(?<=[^_\na-zA-Z0-9]|^)_([^_\n]+)_$/, type),
|
||||
markInputRule(/(?<=[^*\na-zA-Z0-9]|^)\*([^*\n]+)\*$/, type),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user