This repository has been archived by the owner on Feb 8, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 308
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modify first h1/p just like npm does
- Loading branch information
1 parent
b3fd5bc
commit c67d598
Showing
3 changed files
with
46 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env node | ||
// Extend marky-markdown.js to support the package argument: | ||
// https://www.npmjs.com/package/marky-markdown#npm-packages | ||
|
||
var fs = require('fs') | ||
var path = require('path') | ||
var marky = require('marky-markdown') | ||
|
||
if (process.argv.length < 3) { | ||
console.log('Usage:\n\nour-marky-markdown some.md pkg > some.html') | ||
process.exit() | ||
} | ||
|
||
var filePath = path.resolve(process.cwd(), process.argv[2]) | ||
|
||
fs.readFile(filePath, function (err, data) { | ||
if (err) throw err; | ||
var package = process.argv[3] ? JSON.parse(process.argv[3]) : null; | ||
var $ = marky(data.toString(), {package: package}) | ||
process.stdout.write($.html()) | ||
}) |
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