mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
feature(markdown) add
This commit is contained in:
parent
e832d6bb2d
commit
cf4b3c3e37
1 changed files with 22 additions and 0 deletions
22
lib/server/rest/markdown/put.js
Normal file
22
lib/server/rest/markdown/put.js
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
(function(){
|
||||
'use strict';
|
||||
|
||||
var main = global.cloudcmd.main,
|
||||
marked = main.require('marked'),
|
||||
Util = main.util;
|
||||
|
||||
exports.parse = parse;
|
||||
|
||||
function parse(data, callback) {
|
||||
var md;
|
||||
|
||||
process.nextTick(function() {
|
||||
if (marked)
|
||||
md = marked(data);
|
||||
else
|
||||
md = '<pre>' + data + '</pre>';
|
||||
|
||||
Util.exec(callback, md);
|
||||
});
|
||||
}
|
||||
})();
|
||||
Loading…
Add table
Add a link
Reference in a new issue