-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
beginning to convert markdown to amp-html #24
- Loading branch information
1 parent
5df3f5b
commit ffa7b62
Showing
4 changed files
with
37 additions
and
2 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,11 @@ | ||
var Remarkable = require('remarkable'); | ||
// var fs = require('fs'); | ||
// var post1 = fs.readFileSync(__dirname + '/../posts/post1.md'); | ||
|
||
|
||
// console.log(md.render(post1.toString())); | ||
|
||
var md = new Remarkable('full'); | ||
module.exports = function parse(mdString) { | ||
return md.render(mdString); | ||
}; |
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 @@ | ||
[Click me](http://www.bbc.co.uk) |
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,17 @@ | ||
var test = require('tape'); | ||
var mdAmp = require('../lib/markdown-amp.js'); | ||
var fs = require('fs'); | ||
var mdFileString = fs.readFileSync(__dirname + '/../posts/postlink.md').toString(); | ||
|
||
test("testing heading parsed properly", function(t) { | ||
var expected = '<h1>hello world</h1>\n'; | ||
t.equal(mdAmp('# hello world'), expected, 'WOOOOO!'); | ||
console.log(mdAmp(mdFileString)); | ||
t.end(); | ||
}); | ||
|
||
test("testing link parsed properly", function(t) { | ||
var expected = '<p><a href="http://www.bbc.co.uk">Click me</a></p>\n'; | ||
t.equal(mdAmp(mdFileString), expected, 'SUCCESS!'); | ||
t.end(); | ||
}); |