markedインストール
https://github.com/chjj/marked
npm install marked
サンプルコード
var marked = require('marked'); console.log(marked('I am using __markdown__.')); console.log(marked('> scross site scripting!'));
実行結果
$node marked.js <p>I am using <strong>markdown</strong>.</p> <blockquote> <p>scross site scripting!</p> </blockquote>
※markdownも紹介
https://github.com/evilstreak/markdown-js
npm install markdown
サンプルコード
console.log('=====markdown出力====='); var markdown = require( "markdown" ).markdown; console.log( markdown.toHTML( "Hello *World*!" ) ); console.log( markdown.toHTML( 'I am using __markdown__.' ) ); console.log( markdown.toHTML( '> scross site scripting!' ) ); console.log('=====markedと比較====='); var marked = require('marked'); console.log(marked('Hello *World*!')); console.log(marked('I am using __markdown__.')); console.log(marked('> scross site scripting!'));
実行結果
$node markdown.js =====markdown出力===== <p>Hello <em>World</em>!</p> <p>I am using <strong>markdown</strong>.</p> <blockquote><p>scross site scripting!</p></blockquote> =====markedと比較===== <p>Hello <em>World</em>!</p> <p>I am using <strong>markdown</strong>.</p> <blockquote> <p>scross site scripting!</p> </blockquote>
リソース
markdown文法
http://daringfireball.net/projects/markdown/syntax
node.js markdownモジュール
https://github.com/chjj/marked
0 件のコメント:
コメントを投稿