forked from j201/meta-marked
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6313095
commit 8b0cf4c
Showing
5 changed files
with
316 additions
and
70 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,3 @@ | ||
[*.js] | ||
indent_style = space | ||
indent_size = 2 |
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 |
---|---|---|
@@ -1,27 +1,27 @@ | ||
{ | ||
"name": "meta-marked", | ||
"version": "0.4.2", | ||
"description": "The 'marked' markdown processor with a simple metadata system.", | ||
"main": "./lib/meta-marked.js", | ||
"keywords": [ | ||
"markdown", | ||
"metadata", | ||
"html" | ||
], | ||
"author": "j201 <j201.alex@gmail.com> (http://j201.github.io/)", | ||
"license": "MIT", | ||
"repository" : { | ||
"type" : "git", | ||
"url" : "git://github.com/j201/meta-marked.git" | ||
}, | ||
"dependencies" : { | ||
"marked" : "~0.3.6", | ||
"js-yaml" : "~3.5.5" | ||
}, | ||
"devDependencies" : { | ||
"tape" : "~4.2.0" | ||
}, | ||
"scripts" : { | ||
"test" : "node ./test/test" | ||
} | ||
"name": "meta-marked", | ||
"version": "0.4.3", | ||
"description": "The 'marked' markdown processor with a simple metadata system.", | ||
"main": "./lib/meta-marked.js", | ||
"keywords": [ | ||
"markdown", | ||
"metadata", | ||
"html" | ||
], | ||
"author": "j201 <j201.alex@gmail.com> (http://j201.github.io/)", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/hackmdio/meta-marked" | ||
}, | ||
"dependencies": { | ||
"marked": "~0.3.12", | ||
"js-yaml": "~3.10.0" | ||
}, | ||
"devDependencies": { | ||
"tape": "~4.8.0" | ||
}, | ||
"scripts": { | ||
"test": "node ./test/test" | ||
} | ||
} |
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 |
---|---|---|
@@ -1,33 +1,52 @@ | ||
var metaMarked = require('../lib/meta-marked.js'); | ||
var marked = require('marked'); | ||
var tape = require('tape'); | ||
const metaMarked = require("../lib/meta-marked.js"); | ||
const marked = require("marked"); | ||
const tape = require("tape"); | ||
|
||
tape("meta-marked", function(t) { | ||
var basicTestText = "---\nTitle: My awesome markdown file\nAuthor: Me\nScripts:\n - js/doStuff.js\n - js/doMoreStuff.js\n...\n\n##Header\nRegular text and stuff goes here. \n\n...\n\n---\n"; | ||
var basicTestMD = "\n\n##Header\nRegular text and stuff goes here. \n\n...\n\n---\n"; | ||
var basicResult = metaMarked(basicTestText); | ||
var basicTestText = | ||
"---\nTitle: My awesome markdown file\nAuthor: Me\nScripts:\n - js/doStuff.js\n - js/doMoreStuff.js\n...\n\n##Header\nRegular text and stuff goes here. \n\n...\n\n---\n"; | ||
var basicTestMD = | ||
"\n\n##Header\nRegular text and stuff goes here. \n\n...\n\n---\n"; | ||
var basicResult = metaMarked(basicTestText); | ||
|
||
t.ok(basicResult.meta, "result.meta exists"); | ||
t.ok(basicResult.html, "result.html exists"); | ||
t.ok(basicResult.markdown, "result.markdown exists"); | ||
t.ok(basicResult.meta, "result.meta exists"); | ||
t.ok(basicResult.html, "result.html exists"); | ||
t.ok(basicResult.markdown, "result.markdown exists"); | ||
|
||
t.equal(basicResult.html, marked(basicTestMD), "result.html matches the marked output"); | ||
t.deepEqual(basicResult.meta, { | ||
"Title": "My awesome markdown file", | ||
"Author": "Me", | ||
"Scripts": [ | ||
"js/doStuff.js", | ||
"js/doMoreStuff.js" | ||
] | ||
}, "result.meta matches the yml output"); | ||
t.equal(basicResult.markdown, basicTestMD, "result.markdown matches the markdown input"); | ||
t.equal( | ||
basicResult.html, | ||
marked(basicTestMD), | ||
"result.html matches the marked output" | ||
); | ||
t.deepEqual( | ||
basicResult.meta, | ||
{ | ||
Title: "My awesome markdown file", | ||
Author: "Me", | ||
Scripts: ["js/doStuff.js", "js/doMoreStuff.js"] | ||
}, | ||
"result.meta matches the yml output" | ||
); | ||
t.equal( | ||
basicResult.markdown, | ||
basicTestMD, | ||
"result.markdown matches the markdown input" | ||
); | ||
|
||
t.equal(metaMarked.noMeta(basicTestMD), marked(basicTestMD), ".noMeta produces the same output as marked"); | ||
t.equal( | ||
metaMarked.noMeta(basicTestMD), | ||
marked(basicTestMD), | ||
".noMeta produces the same output as marked" | ||
); | ||
|
||
t.equal(metaMarked.lexer, marked.lexer, "inherits from marked"); | ||
t.equal(metaMarked.lexer, marked.lexer, "inherits from marked"); | ||
|
||
var dashTestText = basicTestText.replace('...', '---'); | ||
t.deepEqual(basicResult, metaMarked(dashTestText), "works with dashes as yaml terminators too"); | ||
var dashTestText = basicTestText.replace("...", "---"); | ||
t.deepEqual( | ||
basicResult, | ||
metaMarked(dashTestText), | ||
"works with dashes as yaml terminators too" | ||
); | ||
|
||
t.end(); | ||
t.end(); | ||
}); |
Oops, something went wrong.