[TOC maxLevel=2] is rendered as plain text instead of generating a table of contents

未关闭
#431 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
冷清
技术栈
markdown
领域
frontend, web-dev

调研方向

首先,在新的 HackMD 笔记中复现该示例,并在渲染视图中比较 [TOC] 和 [TOC maxLevel=2]。阅读介绍 [TOC maxLevel=1] 的官方教程部分;issue 中没有指定源文件或测试。完成的标准是能够识别带参数的语法,并生成目录而不是纯文本。

由索引模型根据 Issue 内容生成。

描述

Is this a hackmd.io issue?
Read our Official tutorial

It's on https://hackmd.io/c/tutorials/

or Chinese version: https://hackmd.io/c/tutorials-tw/

What's the problem
Current behaviour

[TOC] works, but [TOC maxLevel=2] is rendered as plain text and does not generate a table of contents.

Image Image

Reproducible content:

[TOC maxLevel=2]

### Section
- ### Case1
- ### Case2
- ### Case3

Actual rendered result:

[TOC maxLevel=2]

It is displayed as plain text instead of being parsed as TOC syntax.

Provide steps to reproduce:

  1. Go to https://hackmd.io

  2. Create a new note

  3. Paste the content below:

    [TOC maxLevel=2]
    
    ### Section
    - ### Case1
    - ### Case2
    - ### Case3
    
  4. Switch to preview / rendered view

  5. Observe that [TOC maxLevel=2] is shown as plain text

Here is an example: https://hackmd.io/AkRF_wKqQWqpo_MJ32Veww

Expected behaviour

[TOC maxLevel=2] should be recognized as valid TOC syntax and generate a table of contents, instead of being rendered as plain text.

Environment

I use HackMD on:

Desktop

  • OS: Windows / Ubuntu 24.04 / Android 14
  • Browser: Chrome 147.0.7727.56 , FireFox 143.0(64 位元)

Mobile

  • Device: Xiaomi Pro 13
  • OS: Android 14
  • Browser: Chrome 146.0.7880.177
Additional context

The official tutorial documents [TOC maxLevel=1] as supported syntax, so this behavior appears inconsistent with the documentation.

主要语言
没有语言数据
星标
40
派生
9
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

hackmdio/hackmd-io-issues 的其他 Issue

查看 hackmdio/hackmd-io-issues 的全部 Issue

相似的 Issue

更多 Web Dev Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。