Skip to content

Improve TOC functionality in rich text editor

Himanshu Kapoor requested to merge himkp-improve-rte-toc into master

What does this MR do and why?

Improve TOC functionality in rich text editor

Previously, table of contents in rich text editor would add empty bullets for missing headings, for example if a h2 is present without an h1, it would add double bullets. Now, only one bullet is added since an h2 without an h1 is considered at the same level as an h1.

Changelog: added

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After
image.png image

How to set up and validate locally

  1. In plain text editor, either in issues, or wikis, enter the following markdown:

    [[_TOC_]]
    
    ## Heading 2
    
    #### Heading 4
    
    # Heading 1
    
    ###### Heading 6
  2. Switch to the rich text editor.

  3. Notice the extra bullets no longer appear, like in the screenshot. This also matches up with markdown preview.

Edited by Himanshu Kapoor

Merge request reports