forked from thlorenz/doctoc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
By adding the `-s` or `--stdout` option, you can print to stdout now. Not th emost beuatiful PR, but I think it is pretty efficent and it works for me. Let me know if I can edit anything! Related to issue thlorenz#100
- Loading branch information
1 parent
eab6f48
commit bb4f414
Showing
4 changed files
with
75 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
DocToccing single file "test/fixtures/readme-with-custom-title.md" for github.com. | ||
|
||
================== | ||
|
||
## Table of Contents | ||
|
||
- [Installation](#installation) | ||
- [API](#api) | ||
- [License](#license) | ||
|
||
================== | ||
|
||
"test/fixtures/readme-with-custom-title.md" should be updated | ||
|
||
Everything is OK. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
'use strict'; | ||
/*jshint asi: true */ | ||
|
||
var test = require('tap').test, | ||
fs = require('fs'), | ||
exec = require("child_process").exec; | ||
|
||
test('\nshould print to stdout with --stdout option', function (t) { | ||
|
||
exec('node doctoc.js test/fixtures/readme-with-custom-title.md --stdout', function (error, stdout, stderr) { | ||
if (error) { | ||
console.error('exec error: ', error); | ||
return; | ||
} | ||
t.deepEqual(stdout | ||
, fs.readFileSync(__dirname + '/fixtures/stdout.md', 'utf8') | ||
, 'spits out the correct table of contents') | ||
|
||
t.end() | ||
}) | ||
}) | ||
|
||
test('\nshould print to stdout with -s option', function (t) { | ||
|
||
exec('node doctoc.js test/fixtures/readme-with-custom-title.md -s', function (error, stdout, stderr) { | ||
if (error) { | ||
console.error('exec error: ', error); | ||
return; | ||
} | ||
t.deepEqual(stdout | ||
, fs.readFileSync(__dirname + '/fixtures/stdout.md', 'utf8') | ||
, 'spits out the correct table of contents') | ||
|
||
t.end() | ||
}) | ||
}) |