markdown-css
发布于 1年前 作者 nswbmw 1855 次浏览

英语不太好,将就着看吧。。。

markdown-css

As you might expect , markdown-css is a fine choice that add some CSS styles to markdown text , and finally , it will be converted to HTML .

Installation

npm install markdown-css

Usage

It’s unbelievably easy to use . For example :

var MC = require('markdown-css');

var result = MC("[google](http://google.com){{#f00 bold 3em}}");
console.log(result);
//=> <p><a href="http://google.com" style="color:#f00;font-weight:bold;font-size:3em;">google</a></p>

You just need to put some CSS styles between {{ and }} .

Examples

Here are some simple usage :

**hello world**{{#f00 3em 900}}
//=> <strong style="color:#f00;font-size:3em;font-weight:900;">hello world</strong>

**{{#f00 3em}}**
//=> <strong style="color:#f00;font-size:3em;"></strong>

<p>hello{{#00f bold 1.5em}}world</p>
//=> <p style="color:#00f;font-weight:bold;font-size:1.5em;">helloworld</p>

<p>hello{{rgb(0,255,0) italic 150%}}world</p>
//=> <p style="color:rgb(0,255,0);font-style:italic;font-size:150%;">helloworld</p>

<p style="color:#00f;text-indent:2em;">hello world</p>
//=> <p style="color:#00f;text-indent:2em;">hello world</p>

<div><p>hello world</p>{{#f00}}</div>
//=> <div><p style="color:#f00">hello world</p></div>

<div>{{#f00}}<p>hello world</p></div>
//=> <div style="color:#f00"><p>hello world</p></div>

<div>hello {{#f00}}<p>world</p></div>
//=> <div style="color:#f00;">hello <p>world</p></div>

**hello world**{{margin[5px,10px] padding[5px,10px,8px]}}
//=> <strong style="margin:5px 10px;padding:5px 10px 8px;">hello world</strong>

> hello {{#f00 20px}}world
//=> <blockquote>
     <p style="color:#f00;font-size:20px;">hello world</p>
     </blockquote>

Customizable

The most exciting is that you can make your customized CSS Mapping, like #000 means color:#000 , bold means font-weight:bold . you can find them in /lib/toCSS.js .

LICENSE

MIT

目前还有不少缺陷 ,欢迎贡献代码。。 github地址: https://github.com/nswbmw/markdown-css

1 回复

前辈你好, 请问你的N-blog在heroku部署时 http://cuitianze.herokuapp.com/ 为什么会出现如下的问题呢

Application Error

An error occurred in the application and your page could not be served. Please try again in a few moments.

If you are the application owner, check your logs for details.

另外,应该不是部署的问题,因为你的另一个开源作品N-chat能够部署成功 http://tianze.herokuapp.com/

回到顶部