mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-24 05:14:06 -06:00
Support only simple cases
This commit is contained in:
parent
5e5c607b80
commit
46f857d5e6
@ -126,21 +126,18 @@ export const tableRegex = new RegExp(/^\|([^\n])+\|\n(\|)( ?:?-{3,}:? ?\|)+\n(\|
|
|||||||
// matches any wikilink, only used for escaping wikilinks inside tables
|
// matches any wikilink, only used for escaping wikilinks inside tables
|
||||||
export const tableWikilinkRegex = new RegExp(/(!?\[\[[^\]]*?\]\]|\[\^[^\]]*?\])/g)
|
export const tableWikilinkRegex = new RegExp(/(!?\[\[[^\]]*?\]\]|\[\^[^\]]*?\])/g)
|
||||||
|
|
||||||
// Edge cases for highlight syntax `==<text>==`:
|
/*
|
||||||
// 1. Exclude arrow syntax from highlight syntax matching, namely `==>` and `<==`.
|
Exclude arrow syntax from highlight syntax matching, namely `==>` and `<==`.
|
||||||
// -> (?<!<)==(?!>)
|
-> (?<!<)==(?!>)
|
||||||
// Test examples:
|
Test examples:
|
||||||
// * ==A ==> B and B <== C==
|
* ==A ==> B and B <== C==
|
||||||
// 2. Skip over `==` signs in LaTeX math blocks or code blocks.
|
Note that `==` within LaTeX and code blocks are not supported, apply <span class="text-highlight"> instead
|
||||||
// -> For LaTeX: (?:.*?\${1,2}[^$]*?==[^$]*?\${1,2}.*?)*?
|
for the following edge cases:
|
||||||
// -> For code blocks: (?:.*?`[^`]*?==[^`]*?`.*?)*?
|
* ==$$A == B \land B == C$$ and $$B == C \land C == D$$!==
|
||||||
// Test Examples:
|
* ==$A == B \land B == C$ and $B == C \land C == D$!==
|
||||||
// * ==$$A == B \land B == C$$ and $$B == C \land C == D$$==
|
* ==`A == B && B == C` and `B == C && C == D`!==
|
||||||
// * ==$A == B \land B == C$ and $B == C \land C == D$==
|
*/
|
||||||
// * ==`A == B && B == C` and `B == C && C == D`==
|
const highlightRegex = new RegExp(/(?<!<)==(?!>)(.+?)(?<!<)==(?!>)/gm)
|
||||||
const highlightRegex = new RegExp(
|
|
||||||
/(?<!<)==(?!>)((?:.*?\${1,2}[^$]*?==[^$]*?\${1,2}.*?)*?|(?:.*?`[^`]*?==[^`]*?`.*?)*?|.+?)(?<!<)==(?!>)/g,
|
|
||||||
)
|
|
||||||
const commentRegex = new RegExp(/%%[\s\S]*?%%/g)
|
const commentRegex = new RegExp(/%%[\s\S]*?%%/g)
|
||||||
// from https://github.com/escwxyz/remark-obsidian-callout/blob/main/src/index.ts
|
// from https://github.com/escwxyz/remark-obsidian-callout/blob/main/src/index.ts
|
||||||
const calloutRegex = new RegExp(/^\[\!([\w-]+)\|?(.+?)?\]([+-]?)/)
|
const calloutRegex = new RegExp(/^\[\!([\w-]+)\|?(.+?)?\]([+-]?)/)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user