Skip to content

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

Description

@tsungjung411

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions