From b8c011410d6bcd6837f4efd6a3948196a0f7aeea Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Sat, 10 Jun 2023 06:06:02 +0000
Subject: [PATCH] toc
---
quartz/plugins/transformers/description.ts | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/quartz/plugins/transformers/description.ts b/quartz/plugins/transformers/description.ts
index 065d3bf..b24dd1c 100644
--- a/quartz/plugins/transformers/description.ts
+++ b/quartz/plugins/transformers/description.ts
@@ -15,7 +15,7 @@
name = "Description"
opts: Options
- constructor(opts?: Options) {
+ constructor(opts?: Partial<Options>) {
super()
this.opts = { ...defaultOptions, ...opts }
}
@@ -29,7 +29,9 @@
() => {
return async (tree: HTMLRoot, file) => {
const frontMatterDescription = file.data.frontmatter?.description
- const desc = frontMatterDescription ?? toString(tree)
+ const text = toString(tree)
+
+ const desc = frontMatterDescription ?? text
const sentences = desc.replace(/\s+/g, ' ').split('.')
let finalDesc = ""
let sentenceIdx = 0
@@ -40,6 +42,7 @@
}
file.data.description = finalDesc
+ file.data.text = text
}
}
]
@@ -49,6 +52,7 @@
declare module 'vfile' {
interface DataMap {
description: string
+ text: string
}
}
--
Gitblit v1.10.0