Skip to content

Commit 4e0238e

Browse files
committed
修复编译错误
1 parent 556069a commit 4e0238e

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/content/blog/test/test_advancestep.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
2-
title: "AdvanceStep Component Guide"
2+
title: "Test: AdvanceStep Component Guide"
33
description: 'A comprehensive guide and documentation for the AdvanceStep component.'
44
publishDate: 2025-08-28 17:31:03
55
slug: p1jz
6-
tags: ['component', 'documentation', 'astro']
6+
tags: ['test', 'documentation', 'astro', 'custom-component']
77
---
88

99
> generated by gemini

src/plugins/rehype-advanced-steps.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
2-
import type { Element, Root, Node } from 'hast';
1+
import type { Element, Root, Node, Text, ElementContent } from 'hast';
32
import { rehype } from 'rehype';
43

54
const isElement = (node: Node): node is Element => node.type === 'element';
@@ -35,7 +34,7 @@ export const processAdvanceSteps = (html: string | undefined, split: SplitType)
3534
} else {
3635
// Fallback for 'ol' mode: if content is not a single OL, wrap everything in one step.
3736
if (tree.children.length > 0) {
38-
const li: Element = { type: 'element', tagName: 'li', properties: {}, children: tree.children };
37+
const li: Element = { type: 'element', tagName: 'li', properties: {}, children: tree.children as ElementContent[] };
3938
tree.children = [{
4039
type: 'element',
4140
tagName: 'ol',
@@ -56,7 +55,7 @@ export const processAdvanceSteps = (html: string | undefined, split: SplitType)
5655

5756
if (!hasSeparators) {
5857
if (tree.children.length > 0) {
59-
const li: Element = { type: 'element', tagName: 'li', properties: {}, children: tree.children };
58+
const li: Element = { type: 'element', tagName: 'li', properties: {}, children: tree.children as ElementContent[] };
6059
tree.children = [{
6160
type: 'element',
6261
tagName: 'ol',
@@ -90,7 +89,7 @@ export const processAdvanceSteps = (html: string | undefined, split: SplitType)
9089
.filter(
9190
(step) =>
9291
step.length > 0 &&
93-
step.some((node) => isElement(node) || (node.type === 'text' && node.value.trim() !== '')),
92+
step.some((node) => isElement(node) || (node.type === 'text' && (node as Text).value.trim() !== '')),
9493
)
9594
.map((stepNodes) => {
9695
return {
@@ -114,4 +113,4 @@ export const processAdvanceSteps = (html: string | undefined, split: SplitType)
114113

115114
const file = stepsProcessor.processSync({ value: html });
116115
return { html: file.toString() };
117-
};
116+
};

0 commit comments

Comments
 (0)