Giter Site home page Giter Site logo

Skip file about doctoc HOT 10 CLOSED

thlorenz avatar thlorenz commented on August 24, 2024
Skip file

from doctoc.

Comments (10)

zyskowsk avatar zyskowsk commented on August 24, 2024 6

@karfau Thanks for the tip! This looks very similar to the rough idea I posted in my PR except that it only allows for whitelisting certain files if I understand correctly?

For my case it is much more useful to blacklist just a few files and have every other file automatically updated. My use case is the following:

We have a github repo that we use for documentation, I would like each .md file to be automatically updated with a TOC on each commit. I would also like new files to automatically have a TOC added without the author being required to add START doctoc each time. We have a few files, namely an issue template in .github/ that we wish to never be updated with a TOC. A few options that I considered where:

  • Automatic blacklisting of files that contain a certain tag <!-- DOCTOC SKIP --> for example
  • An option arg --exclude-dir which would ignore certain directories by path.
  • An option arg --ignore-file which would ignore certain files by path.

I would be happy to piggyback on your work though if would wouldn't be opposed to including an additional flag for the contrary statement. For example:

  • With --explicite-start or -e, only files containing START doctoc would be updated
  • With --explicite-skip or -E, all files containing SKIP doctoc would be ignored.

from doctoc.

revelt avatar revelt commented on August 24, 2024 4

hi guys, I came here researching has anybody suggested recogniseable DOCTOC SKIP tag within file. I'm running automated scripts and doctoc is automatically ran if there is a readme. Now that's fine on 99% of cases, except sometimes I don't need doctoc, I want to put something in a file to make it skip it. This ack way is OK, but it will bloat my scripts and I'd rather control doctoc via comment tags. Please consider this issue, it is relevant and imho undeservedly closed.

from doctoc.

zyskowsk avatar zyskowsk commented on August 24, 2024 1

I agree with @revelt. In particular, I would like to run doctoc as an async job an a separate machine, and I don't want to think about what system utilities are installed on that machine. I opened a PR here: #143

from doctoc.

jez avatar jez commented on August 24, 2024

I think this is the kind of thing that is perhaps best solved with Unix filters or bash globs. For example, you could use ack, ag, or find to enumerate the files or directories you want to ignore.

@thlorenz What do you think?

from doctoc.

knownasilya avatar knownasilya commented on August 24, 2024

If that's the case, I'd love an example in the readme 👍

from doctoc.

jez avatar jez commented on August 24, 2024

Oh, interesting. I didn't realize you couldn't send multiple filenames to the command; it takes a single file or a single folder.

from doctoc.

jez avatar jez commented on August 24, 2024

I just sent a PR to add support so that you could do something like add <!-- DOCTOC SKIP --> to your files and then use ack -L 'DOCTOC SKIP' | xargs doctoc to recompile them.

from doctoc.

karfau avatar karfau commented on August 24, 2024

Would #132 solve your use case?
With the flag it introduces doctoc only updates files, that already contain a TOC.

Maybe a 👍 over there finally supports landing that one 😇

from doctoc.

revelt avatar revelt commented on August 24, 2024

@karfau by the way, I'm still running doctoc from the custom fork of Yours, it's awesome and I'm not looking back to official doctoc install. Thanks again for supplying it. If it landed that would be great. If not, we'll live with local install.

@zyskowsk definitely check out #132

from doctoc.

karfau avatar karfau commented on August 24, 2024

@karfau by the way, I'm still running doctoc from the custom fork of Yours, it's awesome and I'm not looking back to official doctoc install. Thanks again for supplying it. If it landed that would be great. If not, we'll live with local install.

@revelt Thx for letting me know. I just updated all the branches.
What do you mean with "local install"?
Did you now that you can put
"doctoc": "github:karfau/doctoc#<tag-or-hash>",
into your package.json, to directly install form github?
The same should work when using npx.
I haven't tested it with this specific repo but I have done this with many other forks.
Of course you can not upgrade with the usual tooling, but just flipping the hash for a more current one and running npm i does the job.

Feel free to file issues there if anything stops working while using my fork.

from doctoc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.