markdown-toc
markdown-toc copied to clipboard
Inserts extra words "auto" and formats incorrectly
Example of creating TOC
autoauto- [LimeAPIClient](#limeapiclient)auto - [Содержание](#содержание)auto - [Установка](#установка)auto - [Кэширование запросов](#кэширование-запросов)auto - [Интервал времени ожидания запроса](#интервал-времени-ожидания-запроса)auto - [Примеры использования](#примеры-использования)auto - [Конфигурирование клиента](#конфигурирование-клиента)auto - [Пример cоздания новой сессии](#пример-cоздания-новой-сессии)auto - [Получение баннера, рекомендованного данному устройству и приложению](#получение-баннера-рекомендованного-данному-устройству-и-приложению)auto - [Снятие (удаление) пометки «нежелательный» с баннера](#снятие-удаление-пометки-«нежелательный»-с-баннера)auto - [Пометить баннер как «нежелательный» и больше его не показывать](#пометить-баннер-как-«нежелательный»-и-больше-его-не-показывать)auto - [Получить баннер (информацию о нём)](#получить-баннер-информацию-о-нём)auto - [Получение списка каналов](#получение-списка-каналов)auto - [Получение списка каналов по группе id](#получение-списка-каналов-по-группе-id)auto - [Получение программы передач](#получение-программы-передач)auto - [Проверка работоспособности сервиса](#проверка-работоспособности-сервиса)autoautoAdditional Info
plugin version 1.5.6 Visual Code version 1.45.1 MacOS version 10.15.5 (19F101)
You can workaround that. When you open "Preferences / Settings" in Visual Studio Code and search foe "EOL", you will find an entry in "Text Editor"-->"Files". This is set to "Auto" by default (at least on Mac) and will be just copied by the extension when you create a TOC. Just set this to "\r" or "\r\n" and you are good to go.
I've just started looking at the VSCode API so forgive me if I'm wrong, but it looks like we can access the currently open file's EOL if we have access to window.activeTextEditor
(which we do): we can access the .document
property which is of type TextDocument
, which has a eol
property.
We can also obtain the tabSize
/ insertSpaces
values via the .options
property of the same window.activeTextEditor
, which has both a tabSize
and an insertSpaces
properties.
@AlanWalk is this a fair assessment?
Looks like it's using the string auto
from files.eol
literally!
There are multiple PRs open that address this issue (#72, #80, #92...).
Any plan to merge a fix for it? 🙇
I have enabled "Setting Syncs" for VSCode among my Windows/Linux/macOS environments. Using "auto" should be the best EOL configuration for me, and it's kind of inconvenient to switch it to "\n" to create TOC and then switch back.