Vscode-markdown: Creating table of contents fails

Created on 30 May 2018  ·  13Comments  ·  Source: yzhang-gh/vscode-markdown

Creating table of contents fails with Cannot read property 'fromHeading' of undefined

bug

This used to work for me. I noticed it didn't work today. I know I used it about 5 days ago.

To reproduce it i can:

create new markdown:

# TITLE
## SUBTITLE

try to create table of contents

console message:

bug2

Edit:
some more info:

  ERR Cannot read property 'fromHeading' of undefined: TypeError: Cannot read property 'fromHeading' of undefined
    at Object.slugify (C:\Users\JanezP\.vscode-insiders\extensions\yzhang.markdown-all-in-one-1.4.0\out\src\util.js:47:30)
    at tocEntries.forEach.entry (C:\Users\JanezP\.vscode-insiders\extensions\yzhang.markdown-all-in-one-1.4.0\out\src\toc.js:76:81)
    at Array.forEach (native)
    at C:\Users\JanezP\.vscode-insiders\extensions\yzhang.markdown-all-in-one-1.4.0\out\src\toc.js:69:20
    at Generator.next (<anonymous>)
    at fulfilled (C:\Users\JanezP\.vscode-insiders\extensions\yzhang.markdown-all-in-one-1.4.0\out\src\toc.js:4:58)
    at <anonymous>

Most helpful comment

After checking the code, I did this:

"markdown.extension.toc.githubCompatibility": true,

and after that it worked.

All 13 comments

After checking the code, I did this:

"markdown.extension.toc.githubCompatibility": true,

and after that it worked.

The internal interface was changed in the latest insider build. I'll fix it later.

This question is at package.json ;lines :175
change default from false to true. Thanks @TheOneSock

Already fixed in the latest CI build

Just ran into this.

me too, thanks for the work around

Ran in to this today. Code version 1.24.1 (windows)
Changed "markdown.extension.toc.githubCompatibility" from false to true
C:\Users\.vscode\extensions\yzhang.markdown-all-in-one-1.4.0\package.json
Thanks @TheOneSock @EricZQWon

This workaround also fixed problems when invoking command Markdown: Print current document to Html

(In fact, you just need to set githubCompatiblity to true in your user settings. The package.json controls the default settings which will be overridden by user settings.)

@neilsustc But the defaults errors out as stated in the current issue, why not change the defaults to avoid it ?

Thanks a lot for this extension.

As is shown in the name githubCompatibility, this setting is meant to make document compatible with GitHub Markdown link (which is slightly different with that of vscode).

I should have released an update to keep up with the vscode API change. But I didn't get enough time to get it done. We have some new features in the next version 😉

Should be fixed with v1.5.0

this again fails in v1.7.0

Was this page helpful?
0 / 5 - 0 ratings

Related issues

deanishe picture deanishe  ·  4Comments

FrancesCoronel picture FrancesCoronel  ·  4Comments

akurani picture akurani  ·  4Comments

MisterY picture MisterY  ·  3Comments

smallprogram picture smallprogram  ·  3Comments