File size: 678 Bytes
cfb0fa4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
export const disableSingleTilde = {
	tokenizer: {
		del(src) {
			// 1. First check for the REAL strikethrough: ~~text~~
			const doubleMatch = /^~~(?=\S)([\s\S]*?\S)~~/.exec(src);
			if (doubleMatch) {
				return {
					type: 'del',
					raw: doubleMatch[0],
					text: doubleMatch[1],
					tokens: this.lexer.inlineTokens(doubleMatch[1])
				};
			}

			// 2. Check for single-tilde: ~text~
			const singleMatch = /^~(?=\S)([\s\S]*?\S)~/.exec(src);
			if (singleMatch) {
				// return a plain-text token, NOT del
				return {
					type: 'text',
					raw: singleMatch[0],
					text: singleMatch[0] // include both tildes as literal text
				};
			}

			return false;
		}
	}
};