-
-
Notifications
You must be signed in to change notification settings - Fork 476
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Anticipate and counter rogue blank line between header comment lines (introduced by Prettier) #147
Comments
Not to derail this issue, but in the vein of making |
@zackhsi good idea! It's interesting how much happened since I originally posted the above: GitHub sold us out, I moved all my libraries to BitBucket, got fed up with Speaking about |
@revelt sounds good. Where can I find it? is it on npm? |
@mkay581 it's maintenance CLI, "lect", https://www.npmjs.com/package/lect — basically, premise is that readme itself is a carcass, as long as you stick to certain pattern, existing readme content slots can be updated/replaced with new ones. That's opposed to generating from scratch or Jon Schlinkert's https://github.com/verbose/verb-generate-readme — where special template is kept. Now, TOC is only one of components and it was quick to gather h* titles and generate slugs for each. But Lect also updates many other areas, including some files outside readme — for example, npmrc, rollup config and updates package.json. @mkay581 Feel free to inspect the lect's source, fork it, link local CLI and tweak it to your needs. |
As you know, Prettier cleans
.md
files. One of the actions it will make it will add a an empty line between each HTML comment line. Which, in our case, results in:Now, when doctoc is ran next time, it "doesn't see" the
<!-- DON'T EDIT THIS SECTION
line and it erroneously adds another one. We end up with:Each prettier+doctoc cycle will add one more: line break +
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
row.Now, I achieved that Prettier would allow comment blocks, ie.
<!-- prettier-ignore-start -->
and<!-- prettier-ignore-end -->
to prevent this from happening.However, we should take steps to make
doctoc
more intelligent too and make it tolerate the blank lines between<!-- START doctoc
and<!-- DON'T EDIT THIS SECTION
.doctoc
should not add duplicate line because of a single line break.Do you think it's technically achievable?
The text was updated successfully, but these errors were encountered: