remarkjs / remark-toc

plugin to generate a table of contents (TOC)

Home Page:https://remark.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Command line usage

RichardLitt opened this issue · comments

I'd like to be able to check that a TOC exists and to create it appropriately as part of an npm script. See this PR for more.

remark-validate-links provides this functionality; is there a lot that needs to be done to enable this for remark-toc?

commented

As I understand it, say case a) toc heading without toc, and b) toc heading with toc, and c) no toc heading, you want to (re)generate a toc in case a) and b), and exit with a warning in case c), but not in the other cases?

remark-toc does the regeneration in a) and b).

Other than that, the closest thing I know that’s out there is https://github.com/sindresorhus/awesome-lint/blob/master/rules/toc.js, but I don’t think it’s exactly what you want?

That sums it up, yeah. I think I realized that this was more effort than it is worth for what I need - remark-toc does what I want without also adding a linter to it. The thing you pointed to would work, but I'd have to extract it from that module, which is more effort than gain for me at the moment.

So, thank you. :)

commented

Yeah, I was thinking along the same lines. We could create a new rule though, but yup, it may be more work than it’s worth!