Comments (10)
@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 containingSTART doctoc
would be updated - With
--explicite-skip
or-E
, all files containingSKIP doctoc
would be ignored.
from doctoc.
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.
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.
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.
If that's the case, I'd love an example in the readme 👍
from doctoc.
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.
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.
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.
@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 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)
- please release/tag doctoc with the <!-- DOCTOC SKIP --> feature included HOT 6
- TOC Does not generate in a file produced from a powershell script.
- Support for .mdx files HOT 4
- Feature request: add ability to include headings before the TOC's `<!-- START -->` flag HOT 3
- Create title and description before table of contents HOT 1
- Feature Request: Generate TOC across multiple md docs
- containerize doctoc HOT 4
- %5C bug with --github option HOT 2
- Migrate Travis-CI.org to Travis-CI.com / Re-enable CI HOT 3
- Hala
- Smashing on someone, standing on, laying on ect....
- version mismatch between npmjs and github
- Not correct link
- Feature request - numbers instead of bullets
- Hi
- Rest API autopilot trade buy and sell,make binance Cridit card give maximum amount for trading and withdraw
- Sent
- Killer
- Feature request: Option for ToC numeration HOT 1
- Extremely slow with 700KB file
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from doctoc.