mirror of
https://github.com/fmhy/edit.git
synced 2026-01-17 17:31:18 +11:00
Update
This commit is contained in:
parent
c8290e853d
commit
17fd034856
1 changed files with 16 additions and 1 deletions
|
|
@ -338,6 +338,7 @@ export function transform(text: string): string {
|
||||||
.replace(/^\* \*\*Note\*\* - (.+)$/gm, ':::tip\n$1\n:::')
|
.replace(/^\* \*\*Note\*\* - (.+)$/gm, ':::tip\n$1\n:::')
|
||||||
.replace(/^Note - (.+)$/gm, ':::tip\n$1\n:::')
|
.replace(/^Note - (.+)$/gm, ':::tip\n$1\n:::')
|
||||||
.replace(/^\*\*Warning\*\* - (.+)$/gm, ':::warning\n$1\n:::')
|
.replace(/^\*\*Warning\*\* - (.+)$/gm, ':::warning\n$1\n:::')
|
||||||
|
.replace(/^\* \*\*Warning\*\* - (.+)$/gm, ':::warning\n$1\n:::')
|
||||||
.replace(/^\*\s([^*])/gm, '- $1')
|
.replace(/^\*\s([^*])/gm, '- $1')
|
||||||
// Replace links
|
// Replace links
|
||||||
.replace(
|
.replace(
|
||||||
|
|
@ -373,15 +374,29 @@ function transformLinks(text: string): string {
|
||||||
/\[GitHub\]\(([^\)]*?)\)/gm,
|
/\[GitHub\]\(([^\)]*?)\)/gm,
|
||||||
'<a target="_blank" href="$1"><div alt="GitHub" class="i-carbon:logo-github mb-1" /></a>'
|
'<a target="_blank" href="$1"><div alt="GitHub" class="i-carbon:logo-github mb-1" /></a>'
|
||||||
)
|
)
|
||||||
// Fallback for GitHub
|
// Fallback
|
||||||
.replace(
|
.replace(
|
||||||
/\[Github\]\(([^\)]*?)\)/gm,
|
/\[Github\]\(([^\)]*?)\)/gm,
|
||||||
'<a target="_blank" href="$1"><div alt="GitHub" class="i-carbon:logo-github mb-1" /></a>'
|
'<a target="_blank" href="$1"><div alt="GitHub" class="i-carbon:logo-github mb-1" /></a>'
|
||||||
)
|
)
|
||||||
|
// Transform GitLab links to icons
|
||||||
|
.replace(
|
||||||
|
/\[GitLab\]\(([^\)]*?)\)/gm,
|
||||||
|
'<a target="_blank" href="$1"><div alt="GitLab" class="i-carbon:logo-gitlab" /></a>'
|
||||||
|
)
|
||||||
|
// Fallback
|
||||||
|
.replace(
|
||||||
|
/\[Gitlab\]\(([^\)]*?)\)/gm,
|
||||||
|
'<a target="_blank" href="$1"><div alt="GitLab" class="i-carbon:logo-gitlab" /></a>'
|
||||||
|
)
|
||||||
// Transform Telegram links to icons
|
// Transform Telegram links to icons
|
||||||
.replace(
|
.replace(
|
||||||
/\[Telegram\]\(([^\)]*?)\)/gm,
|
/\[Telegram\]\(([^\)]*?)\)/gm,
|
||||||
'<a target="_blank" href="$1"><div alt="Telegram" class="i-mdi:telegram" /></a>'
|
'<a target="_blank" href="$1"><div alt="Telegram" class="i-mdi:telegram" /></a>'
|
||||||
)
|
)
|
||||||
|
.replace(
|
||||||
|
/\[Subreddit\]\(([^\)]*?)\)/gm,
|
||||||
|
'<a target="_blank" href="$1"><div alt="Telegram" class="i-mdi:reddit" /></a>'
|
||||||
|
)
|
||||||
return _text
|
return _text
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue