Vscode-markdown: TOC create and update not working

Created on 10 Sep 2018  ·  16Comments  ·  Source: yzhang-gh/vscode-markdown

What is the problem?

Creating or updating existing TOC blocks in markdown files doesn't work. Upon executing the command, nothing happens.

Is there any error message in the console?

no messages in devtools

table of contents Bug Fixed Upstream

All 16 comments

All TOC functionalities are broken in the latest vscode insider build... That's caused by the internal changes of the vscode built-in markdown extension. I need to think about removing the dependency on it...

Is there any chance of creating an independent extension, with just TOC functionality? I have tried other extensions however, yours has the best TOC features by far.

There are two things

  1. Dependency on the vscode built-in extension. It's relatively a big change, and will take some time given that I don't have enough time now.
  2. An extension with only the TOC features. This is easy but I guess it is not necessary...

For now, I would suggest opting out from the vscode insider channel so that the TOC features can work well.

Interesting Microsoft/vscode@281f242cfff7231515eeb3ef195bb237ae3182db added githubSlugifier. Nothing in the history was removed just refactored right? Would it make sense to abstract TocProvider to switch APIs and error next time it changes?

This should be fixed with the development build.

Working!

Broke again.

Activating extension 'yzhang.markdown-all-in-one' failed: Cannot find module '/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/markdown-language-features/out/tableOfContentsProvider'.

After taking a look at the latest build of vscode, I find we can no longer "import"/reuse vscode's codes, completely.

A good thing is that I realise this dependency is not necessary anymore. (We no longer need to contribute to outline view (TOC) since vscode takes it over.)

I can even expect a better performance by removing this dependency. The only problem is I might not have time in the near future. If someone is interested, here is the only method we need to implement by ourselves

https://github.com/neilsustc/vscode-markdown/blob/1c1272202c115c29a27fc1d637aa5eb67e97fa3d/src/toc.ts#L230

Just scan through the current document and find out the lines starts with multiple #s

I changed my mind. It breaks the whole extension 😂.

Fixed with v1.6.2.

Verified!

I get following message when trying to create / update TOC in v1.6.2 and VS Code 1.28.0:

Cannot read property '1' of null

@mprasil Could you please provide more context (e.g. your Markdown content, more detailed error message)? No one can reproduce a problem with just the error message...

Apologies for missing the details, I was in a bit of a hurry and wanted to get to this issue next day. To be specific, I was working on this specific file. You just need to remove the TOC there as that was later added by another TOC plugin.

It appears that the functionality broke as I updated to latest VS Code release.

As for the error message, unfortunately this popup is the only thing I can see:

image

There's no message in the debug console or anywhere else. I'm not familiar with debugging VS Code plugins, so if there's something I can do to get some more info, let me know.

@mprasil Many thanks! I can reproduce now. The problem is the #.drone.yml in the code block is wrongly treated as a heading.

And it is fixed now. Download the dev build here.

I can verify that the fixed version works fine. Thanks!

closing this, original problem reported fixed. Thank you @neilsustc 👍

Was this page helpful?
0 / 5 - 0 ratings

Related issues

akurani picture akurani  ·  4Comments

jerry-sky picture jerry-sky  ·  4Comments

akshaybabloo picture akshaybabloo  ·  3Comments

smallprogram picture smallprogram  ·  3Comments

maoturing picture maoturing  ·  4Comments