hackmdio / hackmdio/hackmd-io-issues

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

Open
#431 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
No language data
Stars
40
Forks
9
PR merge metrics
No merged PRs in 30d

Description

### Is this a hackmd.io issue?

- [x] Yes, the bug happens on https://hackmd.io
- [ ] No. If it's a self-hosted CodiMD instance, please fire up the issue in the repo of CodiMD: https://github.com/hackmdio/codimd

### 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:

```md
[TOC maxLevel=2]

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

Actual rendered result:

```md
[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](https://hackmd.io)

2. Create a new note

3. Paste the content below:

```md
[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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.