alanwalk / markdown-toc

MarkdownTOC(Table Of Contents) Plugin for Visual Studio Code.
MIT License
141 stars 111 forks source link

Refactor and many many fixes #92

Open mcornella opened 3 years ago

mcornella commented 3 years ago

This PR introduces the following:

  1. Refresh VSC extension development environment (basically make it as if the extension was just generated via the yeoman code extension generator).

    • Add eslint (introduces the lint npm script)
    • Update .vscode settings
    • Substitute vscode for @types/vscode and vscode-test packages (vscode is deprecated and doesn't contain all the typings)
    • Update package.json scripts
    • Update tsconfig and remove typings folder (compiles to es6)
    • Update vsc-extension-quickstart document (really not needed, I could remove it)
  2. Fix TypeScript errors and linting warnings Some of these fix a reliance on null coercing to undefined, others are making sure the TS compiler knows that window.activeTextEditor is always defined.

  3. Use line ending and tab settings of the file currently open. For this to be available I had to update the VS Code typings (commit 1). This is a better solution than #72 and #80

    Fixes #57, fixes #60, fixes #65, fixes #67, fixes #68, fixes #82, fixes #90, fixes #91. Closes #72, closes #80.

  4. Replace bold and italic marks but only if on start or end of a word. This fixes wrong removal of _ in headers introduced in fe9b778, which made headings like word_and_another_word be words all mushed together. Fixes #30, fixes #39. This fix should be upstreamed to anchor-markdown-header, which should only remove these marks in the anchor, not the link text.

  5. Simplify optionsFlag property operations Instead of using an array, it now uses an object so the test for flags is simpler (no .indexOf).

  6. Don't match ignore:true comments as the start of the TOC. Fixes https://github.com/AlanWalk/markdown-toc/issues/26#issuecomment-466784656.

  7. Remove decodeURI call which breaks on headings containing % Fixes #35, fixes #49, fixes #79.

  8. Track repeated links using the anchor (#title) instead of the title (title). Fixes #93.

I know this is a big change but it can be more easily reviewed commit by commit and with whitespace changes turned off.

Other (issues maintenance)

Closes #26: fixes bug described in https://github.com/AlanWalk/markdown-toc/issues/26#issuecomment-466784656 (commit 7). Closes #31: this was fixed in 1.6.0. Closes #37: the bug in VS Code Preview doesn't happen anymore. Closes #46, closes #56, closes #87: links in headings are supported in the latest version, can be closed. Closes #52: comments in code blocks aren't parsed as headings in the latest version, can be closed. Closes #53: orderedList:true plays well with updateOnSave in the latest version, can be closed. Closes #59: can't reproduce after this PR is merged. Closes #62: feature request already exists with depthFrom:2. Closes #64, closes #69, closes #75: the bug happens because of wrong markdown syntax, can be closed. Closes #74: can't reproduce after this PR is merged. Closes #84: can't reproduce after this PR is merged.

JulienGrv commented 3 years ago

@AlanWalk please merge :)

Flowkap commented 3 years ago

Any eta? Thanks for your efforts! Really appreciated!

kulak commented 3 years ago

How can I get this version of extension?

mcornella commented 3 years ago

I tried contacting the author a few times but I get no response. I submitted the PR because I knew this extension was used by many people and I could have the greatest impact, so I really don't want to go the way other PR authors have and create a new extension.

Jenriksen commented 3 years ago

I tried contacting the author a few times but I get no response. I submitted the PR because I knew this extension was used by many people and I could have the greatest impact, so I really don't want to go the way other PR authors have and create a new extension.

It almost seems like abandonment of the project, perhaps it is needed to create a new project based on this to implement your changes? I know that it is not the preferable way of doing it.

kulak commented 3 years ago

I ended up looking at all forks of this project and there is one that seems to have progressed in the good direction. This fork is easy to spot, because it has forks of its own. It appears to have fixed at least some issues mentioned here. so, I ended up installing extension from that fork.