mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-19 16:18:58 +01:00
[markdown] Ignore brackets inside link text (#151610)
* 🔨 Allow texts in bracket pairs inside link titles; [text](link) Signed-off-by: GitHub <noreply@github.com> * 🔨 Allow texts in bracket pairs inside link titles; [text](<link>) Signed-off-by: GitHub <noreply@github.com> * ⚗️ Add tests to verify link titles can include bracket pairs Signed-off-by: GitHub <noreply@github.com>
This commit is contained in:
@@ -185,12 +185,12 @@ function stripAngleBrackets(link: string) {
|
||||
/**
|
||||
* Matches `[text](link)`
|
||||
*/
|
||||
const linkPattern = /(\[((!\[[^\]]*?\]\(\s*)([^\s\(\)]+?)\s*\)\]|(?:\\\]|[^\]])*\])\(\s*)(([^\s\(\)]|\([^\s\(\)]*?\))+)\s*("[^"]*"|'[^']*'|\([^\(\)]*\))?\s*\)/g;
|
||||
const linkPattern = /(\[((!\[[^\]]*?\]\(\s*)([^\s\(\)]+?)\s*\)\]|(?:\\\]|[^\]]|\][^(])*\])\(\s*)(([^\s\(\)]|\([^\s\(\)]*?\))+)\s*("[^"]*"|'[^']*'|\([^\(\)]*\))?\s*\)/g;
|
||||
|
||||
/**
|
||||
* Matches `[text](<link>)`
|
||||
*/
|
||||
const linkPatternAngle = /(\[((!\[[^\]]*?\]\(\s*)([^\s\(\)]+?)\s*\)\]|(?:\\\]|[^\]])*\])\(\s*<)(([^<>]|\([^\s\(\)]*?\))+)>\s*("[^"]*"|'[^']*'|\([^\(\)]*\))?\s*\)/g;
|
||||
const linkPatternAngle = /(\[((!\[[^\]]*?\]\(\s*)([^\s\(\)]+?)\s*\)\]|(?:\\\]|[^\]]|\][^(])*\])\(\s*<)(([^<>]|\([^\s\(\)]*?\))+)>\s*("[^"]*"|'[^']*'|\([^\(\)]*\))?\s*\)/g;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user