• Help
  • Change order of the Table of Contents

It's possible to change order of element blocks in the Table of Contents with the mouse by dragging and dropping, but is it possible to do sorting? For example on a TOC like

# 1
## c
## a
## b

# 3
## b
## c
## a

# 2
## a
## c
## b

how can I sort alphabetically only H1 headers by name? Or only the H2 headers? Or reverse sort?

If you open the sidebar (right hand side) and go to the table of contents tab, you can drag and drop headings, which will move the entire section accordingly.

    15 days later

    hendrik
    Sorry, email notifications don't work on this forum for some reason.
    I know I can drag and drop titles in the TOC, but for big documents it's unfeasible. Is there some way to use sorting?

      zettler Why is this unfeasible? Sorting just the headings in the ToC is not possible, as the state of the ToC depends on the document, so sorting the ToC would mean changing the document.

        hendrik It's unfeasible bebause TOCs can be huge.

        sorting the ToC would mean changing the document

        That's exactly what should happen indeed, the whole document should be rearranged, not only the TOC of course.

          zettler This could be achieved with a CodeMirror command, which would have to be written by someone.

            7 days later

            zettler I would recommend opening a feature request on GitHub. This moves it up the attention ladder.

              Thanks; I already saw it and pinned it to some places!