Skip to content

Commit

Permalink
``style(external-links.scss, links.ts): 添加对mermaid.js.org链接的支持在exte…
Browse files Browse the repository at this point in the history
…rnal-links.scss`中为指向`mermaid.js.org`的链接添加了特定的SVG图标,并在`links.ts`中更新了链接检测逻辑,以识别包含`mermaid`的域名。

```
  • Loading branch information
hulinjiang committed Nov 29, 2024
1 parent 8ae7868 commit 39a8412
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion quartz/plugins/transformers/links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export const CrawlLinks: QuartzTransformerPlugin<Partial<Options>> = (userOpts)
domain.includes("obsidian.md") ||
domain.includes("wikipedia.org") ||
domain.includes("quartz") ||
/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(domain) // email address
domain.includes("mermaid")
)

if (hasSpecialIcon) {
Expand Down
4 changes: 4 additions & 0 deletions quartz/styles/external-links.scss
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ a.external {
background-image: url("./static/icon.webp");
}

&[href*="mermaid.js.org"]::after {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1em' height='1em' viewBox='0 0 32 32'%3E%3Cpath fill='%23fd366e' d='M29.973 4.478A14.24 14.24 0 0 0 16 13.842c-2.107-5.82-7.787-9.628-13.973-9.364a14.25 14.25 0 0 0 6.2 12.36a7.65 7.65 0 0 1 3.316 6.32v4.376h8.916V23.16a7.65 7.65 0 0 1 3.315-6.32a14.25 14.25 0 0 0 6.2-12.36z'/%3E%3C/svg%3E");
}

//rss
&[href*="index.xml"]::after {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1em' height='1em' viewBox='0 0 24 24'%3E%3Cpath fill='%23ff5b21' d='M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2m2.5 12A1.5 1.5 0 0 0 6 16.5A1.5 1.5 0 0 0 7.5 18A1.5 1.5 0 0 0 9 16.5A1.5 1.5 0 0 0 7.5 15M6 10v2a6 6 0 0 1 6 6h2a8 8 0 0 0-8-8m0-4v2a10 10 0 0 1 10 10h2A12 12 0 0 0 6 6'/%3E%3C/svg%3E")
Expand Down

0 comments on commit 39a8412

Please sign in to comment.