@sugarat/theme 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/node.js CHANGED
@@ -227,7 +227,7 @@ function getFileBirthTime(url) {
227
227
  return date;
228
228
  }
229
229
  function getTextSummary(text, count = 100) {
230
- return text?.replace(/^#+\s+.*/, "")?.replace(/#/g, "")?.replace(/!\[.*?\]\(.*?\)/g, "")?.replace(/\[(.*?)\]\(.*?\)/g, "$1")?.replace(/\*\*(.*?)\*\*/g, "$1")?.split("\n")?.filter((v) => !!v)?.join("\n")?.replace(/>(.*)/, "")?.trim()?.slice(0, count);
230
+ return text?.replace(/^#+\s+.*/, "")?.replace(/#/g, "")?.replace(/!\[.*?\]\(.*?\)/g, "")?.replace(/\[(.*?)\]\(.*?\)/g, "$1")?.replace(/\*\*(.*?)\*\*/g, "$1")?.split("\n")?.filter((v) => !!v)?.join("\n")?.replace(/>(.*)/, "")?.replace(/</g, "&lt;").replace(/>/g, "&gt;")?.trim()?.slice(0, count);
231
231
  }
232
232
  function aliasObjectToArray(obj) {
233
233
  return Object.entries(obj).map(([find, replacement]) => ({
@@ -303,7 +303,7 @@ function getMarkdownPlugins(cfg) {
303
303
  const { MermaidMarkdown } = _require("vitepress-plugin-mermaid");
304
304
  markdownPlugin.push(MermaidMarkdown);
305
305
  }
306
- if (cfg.taskCheckbox !== false) {
306
+ if (cfg?.taskCheckbox !== false) {
307
307
  markdownPlugin.push(taskCheckboxPlugin(typeof cfg?.taskCheckbox === "boolean" ? {} : cfg?.taskCheckbox));
308
308
  }
309
309
  if (cfg?.timeline !== false) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sugarat/theme",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "简约风的 Vitepress 博客主题,sugarat vitepress blog theme",
5
5
  "author": "sugar",
6
6
  "license": "MIT",
@@ -87,6 +87,7 @@ export function getTextSummary(text: string, count = 100) {
87
87
  ?.filter(v => !!v)
88
88
  ?.join('\n')
89
89
  ?.replace(/>(.*)/, '')
90
+ ?.replace(/</g, '&lt;').replace(/>/g, '&gt;')
90
91
  ?.trim()
91
92
  ?.slice(0, count)
92
93
  )
@@ -23,7 +23,7 @@ export function getMarkdownPlugins(cfg?: Partial<Theme.BlogConfig>) {
23
23
  markdownPlugin.push(MermaidMarkdown)
24
24
  }
25
25
 
26
- if (cfg.taskCheckbox !== false) {
26
+ if (cfg?.taskCheckbox !== false) {
27
27
  markdownPlugin.push(taskCheckboxPlugin(typeof cfg?.taskCheckbox === 'boolean' ? {} : cfg?.taskCheckbox))
28
28
  }
29
29