DavidAnson / vscode-markdownlint

Markdown linting and style checking for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint
MIT License
894 stars 166 forks source link

e.apply is not a function when using certain plugins #313

Closed isuftin closed 6 months ago

isuftin commented 6 months ago

Using plugin version 0.53.0, I am getting e.apply is not a function from markdownlint logs when either @iktakahiro/markdown-it-katex or markdown-it-emoji is activated.

The following is my markdownlint-cli2 config:

---
ignores:
  - 'CHANGELOG.md'
markdownItPlugins:
  - - '@iktakahiro/markdown-it-katex'
  - - 'markdown-it-emoji'
  - - 'markdown-it-for-inline'
outputFormatters:
  - - markdownlint-cli2-formatter-pretty
  - - markdownlint-cli2-formatter-summarize
    - byFile: true
      byRule: true
      byFileByRule: true
  - - markdownlint-cli2-formatter-junit
config:
  MD013:
    code_blocks: false
  MD024:
    siblings_only: true

VScode Info

Version: 1.85.1
Commit: 0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2
Date: 2023-12-13T09:48:16.874Z (2 wks ago)
Electron: 25.9.7
ElectronBuildId: 25551756
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Darwin arm64 22.6.0

Sample error log:

[9:57:20 AM] ERROR: Exception while linting with markdownlint-cli2:
TypeError: e.apply is not a function
    at k.use (/Users/isuftin/.vscode/extensions/davidanson.vscode-markdownlint-0.53.0/bundle.js:27:63353)
    at m (/Users/isuftin/.vscode/extensions/davidanson.vscode-markdownlint-0.53.0/bundle.js:38:95773)
    at g (/Users/isuftin/.vscode/extensions/davidanson.vscode-markdownlint-0.53.0/bundle.js:38:97218)
    at node:internal/util:381:7
    at new Promise (<anonymous>)
    at g (node:internal/util:367:12)
    at markdownlint (/Users/isuftin/.vscode/extensions/davidanson.vscode-markdownlint-0.53.0/bundle.js:38:98459)
    at /Users/isuftin/.vscode/extensions/davidanson.vscode-markdownlint-0.53.0/bundle.js:37:15329
    at async P (/Users/isuftin/.vscode/extensions/davidanson.vscode-markdownlint-0.53.0/bundle.js:37:14753)

Installed list:

 npm list
vscode-markdownlint@0.53.0 /Users/isuftin/.vscode/extensions/davidanson.vscode-markdownlint-0.53.0
├── @iktakahiro/markdown-it-katex@4.0.1
├── @types/vscode@1.75.0
├── @vscode/test-electron@2.3.8
├── cpy-cli@5.0.0
├── eslint-plugin-node@11.1.0
├── eslint-plugin-unicorn@49.0.0
├── eslint@8.55.0
├── ignore@5.3.0
├── js-yaml@4.1.0
├── jsonc-parser@3.2.0
├── markdown-it-emoji@3.0.0
├── markdown-it-for-inline@2.0.1
├── markdown-it@14.0.0
├── markdownlint-cli2@0.11.0
├── minimatch@9.0.3
├── path-browserify@1.0.1
├── stream-browserify@3.0.0
├── terser-webpack-plugin@5.3.9
├── util@0.12.5
├── vsce@2.15.0
├── webpack-cli@5.1.4
└── webpack@5.89.0

Please let me know what other information I can provide

DavidAnson commented 6 months ago

Thank you for the detailed information! If you could please share a link to one or more Markdown files that cause this problem, I can try to reproduce it myself and see what's going wrong.

isuftin commented 6 months ago

@DavidAnson - This is happening on any Markdown file that I open in VSCode

Even something like:

hello

I will note that if I comment out the markdown-it-emoji plugin from the markdownItPlugins list, it seems to work fine. So maybe this issue should be opened w/ https://github.com/markdown-it/markdown-it-emoji

isuftin commented 6 months ago

I did also notice that in their latest version, 3.0.0, thy do mention that their exports have changed ( https://github.com/markdown-it/markdown-it-emoji#markdown-it-emoji ) though I'm not sure how that works with this VSCode plugin.

DavidAnson commented 6 months ago

Yes, you need to update how you reference that plugin because of what they did. Here is an example: https://github.com/DavidAnson/markdownlint-cli2/commit/79a02e319529194613c41a3cbc0cad570b516ae4

isuftin commented 6 months ago

@DavidAnson - Perfect, that did indeed fix it.

---
ignores:
  - 'CHANGELOG.md'
markdownItPlugins:
  - - '@iktakahiro/markdown-it-katex'
  - - 'markdown-it-emoji/dist/bare.cjs.js'
  - - 'markdown-it-for-inline'
outputFormatters:
  - - markdownlint-cli2-formatter-pretty
  - - markdownlint-cli2-formatter-summarize
    - byFile: true
      byRule: true
      byFileByRule: true
  - - markdownlint-cli2-formatter-junit
config:
  MD013:
    code_blocks: false

Appreciate the help and the plugin!