Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

doctoc

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

doctoc - npm Package Compare versions

Comparing version 0.14.2 to 0.15.0

27

doctoc.js

@@ -74,5 +74,2 @@ #!/usr/bin/env node

printUsageAndExit();
} else if (argv._.length != 1) {
console.error('Please specify exactly one file or directory path.');
printUsageAndExit(true);
}

@@ -92,15 +89,17 @@

var target = cleanPath(argv._[0])
, stat = fs.statSync(target)
for (var i = 0; i < argv._.length; i++) {
var target = cleanPath(argv._[i])
, stat = fs.statSync(target)
if (stat.isDirectory()) {
console.log ('\nDocToccing "%s" and its sub directories for %s.', target, mode);
files = file.findMarkdownFiles(target);
} else {
console.log ('\nDocToccing single file "%s" for %s.', target, mode);
files = [{ path: target }];
}
if (stat.isDirectory()) {
console.log ('\nDocToccing "%s" and its sub directories for %s.', target, mode);
files = file.findMarkdownFiles(target);
} else {
console.log ('\nDocToccing single file "%s" for %s.', target, mode);
files = [{ path: target }];
}
transformAndSave(files, mode, maxHeaderLevel, title, notitle);
transformAndSave(files, mode, maxHeaderLevel, title, notitle);
console.log('\nEverything is OK.');
console.log('\nEverything is OK.');
}

@@ -5,3 +5,3 @@ {

"description": "Generates TOC for markdown files of local git repo.",
"version": "0.14.2",
"version": "0.15.0",
"repository": {

@@ -8,0 +8,0 @@ "type": "git",

@@ -16,6 +16,6 @@ # DocToc [![build status](https://secure.travis-ci.org/thlorenz/doctoc.png)](http://travis-ci.org/thlorenz/doctoc)

- [Update existing doctoc TOCs effortlessly](#update-existing-doctoc-tocs-effortlessly)
- [Adding toc to a single file](#adding-toc-to-a-single-file)
- [Adding toc to individual files](#adding-toc-to-individual-files)
- [Examples](#examples)
- [Using doctoc to generate links compatible with other sites](#using-doctoc-to-generate-links-compatible-with-other-sites)
- [Example](#example)
- [Using doctoc to generate links compatible with other sites](#using-doctoc-to-generate-links-compatible-with-other-sites)
- [Example](#example-1)
- [Specifying location of toc](#specifying-location-of-toc)

@@ -34,2 +34,7 @@ - [Specifying a custom TOC title](#specifying-a-custom-toc-title)

In it's simplest usage, you can pass one or more files or folders to the
`doctoc` command. This will update the TOCs of each file specified as well as of
each markdown file found by recursively searching each folder. Below are some
examples.
### Adding toc to all files in a directory and sub directories

@@ -43,4 +48,7 @@

subdirectories with a table of content that will point at the anchors generated
by the markdown parser. Doctoc defaults to using the GitHub parser, but other [modes can be specified](#using-doctoc-to-generate-links-compatible-with-other-sites).
by the markdown parser. Doctoc defaults to using the GitHub parser, but other
[modes can be
specified](#using-doctoc-to-generate-links-compatible-with-other-sites).
### Update existing doctoc TOCs effortlessly

@@ -50,12 +58,22 @@

### Adding toc to a single file
### Adding toc to individual files
If you want to convert only a specific file, do:
If you want to convert only specific files, do:
doctoc /path/to/file
doctoc /path/to/file [...]
#### Example
#### Examples
doctoc README.md
doctoc CONTRIBUTING.md LICENSE.md
You can use this feature to do more sophisticated things. For example, if you
have [ack][ack] installed, you could add `<!-- DOCTOC SKIP -->` to specific
files and then use
ack -L 'DOCTOC SKIP' | xargs doctoc
to recompile only those files which don't have the DOCTOC SKIP comment.
### Using doctoc to generate links compatible with other sites

@@ -120,1 +138,3 @@

- whereas headings from embedded HTML are limited to 4 levels.
[ack]: http://beyondgrep.com/
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc