markdown的语法
http://markdown.tw/
npm install markdown
"markdown": ">= 0.4.0"
test.md
[Java Eye](http://www.iteye.com/ "Click")
test.js
var fs = require('fs'),
markdown = require('markdown').markdown,
fileContent;
// 读入 Markdown 源文件
fileContent = fs.readFileSync('test.md', 'utf8');
// 使用 MarkdownJS 模块把源文件转换为 HTML 源代码
fileContent = markdown.toHTML(fileContent);
// 保存
fs.writeFileSync('test.html', fileContent);
console.log('Done!');
test.html
<p><a href="http://www.iteye.com/" title="Click">Java Eye</a> </p>
-------------
express:
app.get('/markdown', function(req, res) {
var html = markdown.toHTML("[Java Eye](http://www.iteye.com/ \"Click\") ");
res.send(html);
res.end();
});
访问 http://localhost:3000/markdown
-------------
s
s
s