From 42d3a7de1711bbd40a2b6857e3bf7ff17685f5d9 Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Thu, 01 Jun 2023 21:35:31 +0000
Subject: [PATCH] scss support
---
quartz/plugins/transformers/ofm.ts | 26 +++++++++++++++-----------
1 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/quartz/plugins/transformers/ofm.ts b/quartz/plugins/transformers/ofm.ts
index c089e02..9215e2c 100644
--- a/quartz/plugins/transformers/ofm.ts
+++ b/quartz/plugins/transformers/ofm.ts
@@ -38,17 +38,21 @@
const backlinkRegex = new RegExp(/!?\[\[([^\[\]\|\#]+)(#[^\[\]\|\#]+)?(\|[^\[\]\|\#]+)?\]\]/, "g")
return (tree: Root, _file) => {
findAndReplace(tree, backlinkRegex, (value: string, ...capture: string[]) => {
- const [path, rawHeader, rawAlias] = capture
- const header = rawHeader?.slice(1).trim() ?? ""
- const alias = rawAlias?.slice(1).trim() ?? value
- const url = slugify(path.trim() + header)
- return {
- type: 'link',
- url,
- children: [{
- type: 'text',
- value: alias
- }]
+ if (value.startsWith("!")) {
+
+ } else {
+ const [path, rawHeader, rawAlias] = capture
+ const header = rawHeader?.slice(1).trim() ?? ""
+ const alias = rawAlias?.slice(1).trim() ?? path
+ const url = slugify(path.trim() + header)
+ return {
+ type: 'link',
+ url,
+ children: [{
+ type: 'text',
+ value: alias
+ }]
+ }
}
})
}
--
Gitblit v1.10.0