Skip to content
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

Add --test man documentation and changes argv parameters test/index.js #1442

Merged
merged 12 commits into from
Mar 12, 2019
2 changes: 1 addition & 1 deletion bin/marked
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function main(argv, callback) {
arg = getarg();
switch (arg) {
case '--test':
return require('../test').main(process.argv.slice());
return require('../test').main(process.argv);
styfle marked this conversation as resolved.
Show resolved Hide resolved
case '-o':
case '--output':
output = argv.shift();
Expand Down
23 changes: 23 additions & 0 deletions man/marked.1
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,29 @@ Specify file output. If none is specified, write to stdout.
Specify file input, otherwise use last argument as input file. If no input file
is specified, read from stdin.
.TP
.BI \-\-test
Makes sure the test(s) pass.
.RS
.PP
.B \-\-glob [\fIfile\fP]
Specify which test to use.
.PP
.B \-\-fix
Fixes tests.
.PP
.B \-\-bench
Benchmarks the test(s).
.PP
.B \-\-time
Times The test(s).
.PP
.B \-\-minified
Runs test file(s) as minified.
.PP
.B \-\-stop
Stop process if a test fails.
.RE
.TP
.BI \-t,\ \-\-tokens
Output a token stream instead of html.
.TP
Expand Down
68 changes: 33 additions & 35 deletions man/marked.1.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
marked(1) marked.js marked(1)


marked(1) marked.js marked(1)

NAME
marked - a javascript markdown parser


SYNOPSIS
marked [-o <output>] [-i <input>] [--help] [--tokens] [--pedantic]
[--gfm] [--breaks] [--tables] [--sanitize] [--smart-lists] [--lang-pre‐
fix <prefix>] [--no-etc...] [--silent] [filename]

marked [-o <output>] [-i <input>] [--help] [--tokens] [--pedantic] [--gfm] [--breaks] [--tables] [--sanitize] [--smart-lists]
[--lang-prefix <prefix>] [--no-etc...] [--silent] [filename]

DESCRIPTION
marked is a full-featured javascript markdown parser, built for speed.
It also includes multiple GFM features.

marked is a full-featured javascript markdown parser, built for speed. It also includes multiple GFM features.

EXAMPLES
cat in.md | marked > out.html
Expand All @@ -26,71 +19,76 @@ EXAMPLES

marked --output="hello world.html" -i in.md --no-breaks


OPTIONS
-o, --output [output]
Specify file output. If none is specified, write to stdout.
Specify file output. If none is specified, write to stdout.

-i, --input [input]
Specify file input, otherwise use last argument as input file.
If no input file is specified, read from stdin.
Specify file input, otherwise use last argument as input file. If no input file is specified, read from stdin.

--test Makes sure the test(s) pass.

--glob [file] Specify which test to use.

--fix Fixes tests.

--bench Benchmarks the test(s).

--time Times The test(s).

--minified Runs test file(s) as minified.

--stop Stop process if a test fails.

-t, --tokens
Output a token stream instead of html.
Output a token stream instead of html.

--pedantic
Conform to obscure parts of markdown.pl as much as possible.
Don't fix original markdown bugs.
Conform to obscure parts of markdown.pl as much as possible. Don't fix original markdown bugs.

--gfm Enable github flavored markdown.

--breaks
Enable GFM line breaks. Only works with the gfm option.
Enable GFM line breaks. Only works with the gfm option.

--tables
Enable GFM tables. Only works with the gfm option.
Enable GFM tables. Only works with the gfm option.

--sanitize
Sanitize output. Ignore any HTML input.
Sanitize output. Ignore any HTML input.

--smart-lists
Use smarter list behavior than the original markdown.
Use smarter list behavior than the original markdown.

--lang-prefix [prefix]
Set the prefix for code block classes.
Set the prefix for code block classes.

--mangle
Mangle email addresses.
Mangle email addresses.

--no-sanitize, -no-etc...
The inverse of any of the marked options above.
The inverse of any of the marked options above.

--silent
Silence error output.
Silence error output.

-h, --help
Display help information.

Display help information.

CONFIGURATION
For configuring and running programmatically.

Example

require('marked')('*foo*', { gfm: true });

require('marked')('*foo*', { gfm: true });

BUGS
Please report any bugs to https://github.com/markedjs/marked.


LICENSE
Copyright (c) 2011-2014, Christopher Jeffrey (MIT License).


SEE ALSO
markdown(1), node.js(1)



v0.3.1 2014-01-31 marked(1)
v0.3.1 2014-01-31 marked(1)
styfle marked this conversation as resolved.
Show resolved Hide resolved
10 changes: 5 additions & 5 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -441,13 +441,13 @@ function fix() {
* Argument Parsing
*/

function parseArg() {
var argv = process.argv.slice(2),
UziTech marked this conversation as resolved.
Show resolved Hide resolved
options = {},
function parseArg(argv) {
var options = {},
opt = '',
orphans = [],
arg;

argv = argv.slice(2);
function getarg() {
var arg = argv.shift();

Expand Down Expand Up @@ -551,7 +551,7 @@ function camelize(text) {
*/

function main(argv) {
var opt = parseArg();
var opt = parseArg(argv);
UziTech marked this conversation as resolved.
Show resolved Hide resolved

if (opt.fix !== false) {
fix();
Expand Down Expand Up @@ -582,7 +582,7 @@ function main(argv) {

if (!module.parent) {
process.title = 'marked';
process.exit(main(process.argv.slice()) ? 0 : 1);
process.exit(main(process.argv) ? 0 : 1);
styfle marked this conversation as resolved.
Show resolved Hide resolved
} else {
exports = main;
exports.main = main;
Expand Down