diff --git a/astro.config.mjs b/astro.config.mjs index 27f818b..1f9d96f 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -125,9 +125,6 @@ export default defineConfig({ // 启用代码换行 wrap: true }, - remarkPlugins: [ - [remarkEmoji, { emoticon: false, padded: true }] - ], rehypePlugins: [ [rehypeExternalLinks, { target: '_blank', rel: ['nofollow', 'noopener', 'noreferrer'] }], rehypeCodeBlocks, diff --git a/src/content/技术日志/web/echoes博客使用说明.md b/src/content/技术日志/web/echoes博客使用说明.md index 67e2258..58f31ad 100644 --- a/src/content/技术日志/web/echoes博客使用说明.md +++ b/src/content/技术日志/web/echoes博客使用说明.md @@ -237,8 +237,6 @@ import { VISITED_PLACES } from '@/consts'; ### Mermaid 图表支持 -你可以在 Markdown 文件中使用 Mermaid 语法创建各种图表: - ````markdown ```mermaid graph TD; @@ -249,20 +247,13 @@ graph TD; ``` ```` -系统将自动渲染这些图表,并支持深色/浅色主题自动适应。 - -### 代码块样式优化 - -代码块支持多种主题和语言高亮,内置了复制按钮: - -````markdown -```javascript -// 示例代码 -function example() { - console.log("Hello, world!"); -} +```mermaid +graph TD; + A[开始] -->|处理数据| B(处理结果); + B --> C{判断条件}; + C -->|条件1| D[结果1]; + C -->|条件2| E[结果2]; ``` -```` ## SEO 优化 diff --git a/src/content/理解计算机/Web/MDX使用教程.mdx b/src/content/理解计算机/Web/markdown使用教程.md similarity index 72% rename from src/content/理解计算机/Web/MDX使用教程.mdx rename to src/content/理解计算机/Web/markdown使用教程.md index b500ab2..c6cf5c9 100644 --- a/src/content/理解计算机/Web/MDX使用教程.mdx +++ b/src/content/理解计算机/Web/markdown使用教程.md @@ -1,5 +1,5 @@ --- -title: "MDX使用教程" +title: "markdown使用教程" date: 2023-03-03 tags: [] --- @@ -51,14 +51,6 @@ tags: [] ~~这是删除线文本~~ -#### 1.2.5 下划线文本 - -```markdown -这是下划线文本 -``` - -这是下划线文本 - ### 1.3 列表 #### 1.3.1 无序列表 @@ -172,9 +164,9 @@ function greet(user: User): string { ``` > 📌 **最佳实践** -> +> > 好的文章需要有清晰的结构和流畅的表达。 -> +> > 可以包含多个段落 ### 1.7 链接和图片 @@ -203,59 +195,4 @@ function greet(user: User): string {
---- - -### 1.9 表情符号 - - -| 表情名称 | 语法 | 效果 | -|:--------|:-----|:-----| -| 笑脸 | `:smile:` | :smile: | -| 大笑 | `:laughing:` | :laughing: | -| 哭泣 | `:cry:` | :cry: | -| 心形 | `:heart:` | :heart: | -| 火箭 | `:rocket:` | :rocket: | -| 星星 | `:star:` | :star: | -| 警告 | `:warning:` | :warning: | -| 检查标记 | `:white_check_mark:` | :white_check_mark: | - -## 2. HTML/JSX 语法部分 - -### 2.1 HTML 标签 - -#### 2.1.1 下划线文本 - -```mdx -这是下划线文本 -``` - -这是下划线文本 - -#### 2.1.2 收纳语法 - -```mdx -
-点击展开 - -这里是被收纳的内容。 -可以包含任何 MDX 格式的内容。 - -- 列表项1 -- 列表项2 -- 列表项3 - -
-``` - -
-点击展开 - -这里是被收纳的内容。 -可以包含任何 MDX 格式的内容。 - -- 列表项1 -- 列表项2 -- 列表项3 - -
- +--- \ No newline at end of file diff --git a/src/pages/articles/[...id].astro b/src/pages/articles/[...id].astro index 8b7d678..338d8d4 100644 --- a/src/pages/articles/[...id].astro +++ b/src/pages/articles/[...id].astro @@ -179,32 +179,91 @@ function generateTableOfContents(headings: Heading[]) { // 查找最低级别的标题(数值最小) const minDepth = Math.min(...headings.map((h) => h.depth)); - - let tocHtml = '"; - return tocHtml; + // 递归生成HTML + function generateTocHTML(items: any[], level = 0) { + if (items.length === 0) return ''; + + const isTopLevel = level === 0; + let html = `'; + return html; + } + + return generateTocHTML(tocTree); } // 生成目录HTML @@ -378,18 +437,14 @@ const tableOfContents = generateTableOfContents(headings);