jamietre / ImageMapster

jQuery plugin for enhancing HTML Image maps
http://jamietre.github.io/ImageMapster/
MIT License
818 stars 333 forks source link

[🐞] grunt `docco` task failing with `Fatal error: marked is not a function` #410

Closed techfg closed 6 months ago

techfg commented 6 months ago

Describe the bug

When executing the docco task, the following error is encountered:

Running "docco:source" (docco) task
Deprecated as of 10.7.0. highlight(lang, code, ...args) has been deprecated.
Deprecated as of 10.7.0. Please use highlight(code, options) instead.
https://github.com/highlightjs/highlight.js/issues/2277
Fatal error: marked is not a function

Reproduction

https://github.com/jamietre/ImageMapster

Steps to reproduce

  1. Clone repo
  2. npx grunt docco

Environment Info

Ubuntu 20.04.6 LTS

Expected Behavior

Task should complete and docs generated in ./docs folder

Additional Information

No response

techfg commented 6 months ago

grunt-docco is an unmaintained project. Version 0.5.0, which we were using, is dependent on docco ~0.7.0 which does not have a package-lock.json so it installed highlight.js >= 8.0.x resulting in version 11.9.0 being installed which has a different API than what docco ~0.7.0 was using.

The latest version of docco is 0.9.1 which has a package-lock.json and uses highlight.js ~11.3.1 and adheres to the new API. Given this, we could force grunt-docco to use docco 0.9.1 by installing it in our devDependencies and configuring an override in our package.json, however the API in docco >= 0.8.1 appears to have been broken in this commit where it assumes the config passed in is a commander object.

We could cobble together a modified config object with an opts method that returns the full set of options (the configure code path in docco >= 0.8.1 uses a some properties from config passed in and some from config.opts() but to simplify, avoiding all together and moving to docco-next with a custom task.

[!NOTE]\ ImageMapster documentation is not actively maintained and hasn't been for a long time. The docs are not generated as part of the build process and should not be relied upon. That said, in order to at least maintain feature parity and not have a broken task, it should be fixed.