@@ -33,13 +33,10 @@ export class Regex {
33
33
this . headingsRegex = / ^ { 0 , 3 } ( # { 1 , 6 } ) + ( [ ^ \n ] + ?) ? ( (?: * # \S + ) * ) * $ / gim;
34
34
35
35
// Supported images https://publish.obsidian.md/help/How+to/Embed+files
36
- this . wikiImageLinks =
37
- / ! \[ \[ ( .* \. (?: p n g | j p g | j p e g | g i f | b m p | s v g | t i f f ) ) .* ?\] \] / gim;
38
- this . markdownImageLinks =
39
- / ! \[ \] \( ( .* \. (?: p n g | j p g | j p e g | g i f | b m p | s v g | t i f f ) ) .* ?\) / gim;
36
+ this . wikiImageLinks = / ! \[ \[ ( .* \. (?: p n g | j p g | j p e g | g i f | b m p | s v g | t i f f ) ) .* ?\] \] / gim;
37
+ this . markdownImageLinks = / ! \[ \] \( ( .* \. (?: p n g | j p g | j p e g | g i f | b m p | s v g | t i f f ) ) .* ?\) / gim;
40
38
41
- this . wikiAudioLinks =
42
- / ! \[ \[ ( .* \. (?: m p 3 | w e b m | w a v | m 4 a | o g g | 3 g p | f l a c ) ) .* ?\] \] / gim;
39
+ this . wikiAudioLinks = / ! \[ \[ ( .* \. (?: m p 3 | w e b m | w a v | m 4 a | o g g | 3 g p | f l a c ) ) .* ?\] \] / gim;
43
40
44
41
// https://regex101.com/r/eqnJeW/1
45
42
this . obsidianCodeBlock = / (?: ` ` ` (?: .* ?\n ? ) + ?` ` ` ) (?: \n | $ ) / gim;
@@ -53,8 +50,7 @@ export class Regex {
53
50
this . cardsToDelete = / ^ \s * (?: \n ) (?: \^ ( \d { 13 } ) ) (?: \n \s * ?) ? / gm;
54
51
55
52
// https://regex101.com/r/WxuFI2/1
56
- this . globalTagsSplitter =
57
- / \[ \[ ( .* ?) \] \] | # ( [ \p{ L} \d : \- _ / ] + ) | ( [ \p{ L} \d : \- _ / ] + ) / gimu;
53
+ this . globalTagsSplitter = / \[ \[ ( .* ?) \] \] | # ( [ \p{ L} \d : \- _ / ] + ) | ( [ \p{ L} \d : \- _ / ] + ) / gimu;
58
54
this . tagHierarchy = / \/ / gm;
59
55
60
56
// Cards
@@ -66,17 +62,31 @@ export class Regex {
66
62
"(?:[/-]reverse)?)((?: *#[\\p{Number}\\p{Letter}\\-\\/_]+)*) *?\\n+((?:[^\\n]\\n?)*?(?=\\^\\d{13}|$))(?:\\^(\\d{13}))?" ;
67
63
this . flashscardsWithTag = new RegExp ( str , flags ) ;
68
64
69
- // https://regex101.com/r/8wmOo8/1
70
- const sepLongest = settings . inlineSeparator . length >= settings . inlineSeparatorReverse . length ? settings . inlineSeparator : settings . inlineSeparatorReverse ;
71
- const sepShortest = settings . inlineSeparator . length < settings . inlineSeparatorReverse . length ? settings . inlineSeparator : settings . inlineSeparatorReverse ;
65
+ // https://regex101.com/r/8wmOo8/2
66
+ const sepLongest =
67
+ settings . inlineSeparator . length >= settings . inlineSeparatorReverse . length
68
+ ? settings . inlineSeparator
69
+ : settings . inlineSeparatorReverse ;
70
+ const sepShortest =
71
+ settings . inlineSeparator . length < settings . inlineSeparatorReverse . length
72
+ ? settings . inlineSeparator
73
+ : settings . inlineSeparatorReverse ;
72
74
// sepLongest is the longest between the inlineSeparator and the inlineSeparatorReverse because if the order is ::|::: then always the first will be matched
73
75
// sepShortest is the shortest
74
76
if ( settings . inlineID ) {
75
77
str =
76
- "( {0,3}[#]{0,6})?(?:(?:[\\t ]*)(?:\\d.|[-+*]|#{1,6}))?(.+?) ?(" + sepLongest + "|" + sepShortest + ") ?(.+?)((?: *#[\\p{Letter}\\-\\/_]+)+)?(?:\\s+\\^(\\d{13})|$)" ;
78
+ "( {0,3}[#]{0,6})?(?:(?:[\\t ]*)(?:\\d\\.|[-+*]|#{1,6}))?(.+?) ?(" +
79
+ sepLongest +
80
+ "|" +
81
+ sepShortest +
82
+ ") ?(.+?)((?: *#[\\p{Letter}\\-\\/_]+)+)?(?:\\s+\\^(\\d{13})|$)" ;
77
83
} else {
78
84
str =
79
- "( {0,3}[#]{0,6})?(?:(?:[\\t ]*)(?:\\d.|[-+*]|#{1,6}))?(.+?) ?(" + sepLongest + "|" + sepShortest + ") ?(.+?)((?: *#[\\p{Letter}\\-\\/_]+)+|$)(?:\\n\\^(\\d{13}))?" ;
85
+ "( {0,3}[#]{0,6})?(?:(?:[\\t ]*)(?:\\d\\.|[-+*]|#{1,6}))?(.+?) ?(" +
86
+ sepLongest +
87
+ "|" +
88
+ sepShortest +
89
+ ") ?(.+?)((?: *#[\\p{Letter}\\-\\/_]+)+|$)(?:\\n\\^(\\d{13}))?" ;
80
90
}
81
91
this . cardsInlineStyle = new RegExp ( str , flags ) ;
82
92
@@ -89,9 +99,10 @@ export class Regex {
89
99
90
100
// https://regex101.com/r/cgtnLf/1
91
101
92
- str = "( {0,3}[#]{0,6})?(?:(?:[\\t ]*)(?:\\d.|[-+*]|#{1,6}))?(.*?(==.+?==|\\{.+?\\}).*?)((?: *#[\\w\\-\\/_]+)+|$)(?:\n\\^(\\d{13}))?"
102
+ str =
103
+ "( {0,3}[#]{0,6})?(?:(?:[\\t ]*)(?:\\d.|[-+*]|#{1,6}))?(.*?(==.+?==|\\{.+?\\}).*?)((?: *#[\\w\\-\\/_]+)+|$)(?:\n\\^(\\d{13}))?" ;
93
104
this . cardsClozeWholeLine = new RegExp ( str , flags ) ;
94
-
105
+
95
106
this . singleClozeCurly = / ( (?: { ) (?: ( \d ) : ? ) ? ( .+ ?) (?: } ) ) / g;
96
107
this . singleClozeHighlight = / ( (?: = = ) ( .+ ?) (?: = = ) ) / g;
97
108
0 commit comments