Search code examples
visual-studio-codemarkdowntableofcontents

MarkdownTOC in table of contents is substituting auto for newlines on update and insert


When editing or creating markdown files inserting of updating the table of contents will substitute the word auto for new line characters between the TOC tags. Such as:

<!-- TOC fromDepth:2 ToDepth:4 insertAnchor:true -->autoauto- [1. Introduction](#1-introduction)auto- [2. Section](#2-section)auto    - [2.1. Sub Section One](#21-sub-section-one)auto    - [2.2. Sub Section Two](#22-sub-section-two)auto    - [2.3. Sub Section Three](#23-sub-section-three)autoauto<!-- /TOC -->

I am using VS Code and MarkdownTOC. Any suggestions on what may be going on with this.


Solution

  • This issue is being discussed here

    It seems that the issue was introduced by a change in VSCode 1.29.0.

    There are two workarounds for solving this:

    1. Setting eol back to \n in VSCode settings.

    enter image description here

    2. Manually replace all ocurrences of auto with \n (be careful not to break your content)

    enter image description here