Comparing version 1.0.6 to 1.0.7
@@ -456,2 +456,9 @@ 'use strict' | ||
} | ||
cmarked.options = | ||
cmarked.setOptions = function(opt) { | ||
Object.assign(cmarked.default, opt) | ||
return cmarked | ||
} | ||
cmarked.default = { | ||
@@ -458,0 +465,0 @@ // h1-h6空格填充物 |
{ | ||
"name": "cmarked", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "更符合汉语的markdown编译器", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# cmarked | ||
markdown的js编译器。 | ||
更符合中文的markdown编译器 | ||
## 安装 | ||
npm install cmarked | ||
## 使用方法 | ||
最小的使用 | ||
var cmarked = require('cmarked') | ||
console.log(cmarked('**我正在使用markdown语法书写文章**')) | ||
//输出 <p><strong>我正在使用markdown语法书写文章</strong></p> | ||
设置选项的例子,用默认值来示例: | ||
var cmarked = require('cmarked') | ||
cmarked.setOptions({ | ||
gap: '-', | ||
smartOrderList: false | ||
}) | ||
### Options | ||
### gap | ||
Type:`String` | ||
h1-h6标题的id中的空格的填充符 | ||
例子 | ||
var cmarked = require('cmarked') | ||
console.log(cmarked('# cmarked爱你')) | ||
//输出 <h1 id='cmarked爱你'>cmarked爱你</h1> | ||
console.log(cmarked('## cmarked 还 是 爱 你')) | ||
//输出 <h2 id='cmarked-还-是-爱-你'>cmarked 还 是 爱 你</h2> | ||
自定义填充符 | ||
var cmarked = require('cmarked') | ||
cmarked.setOptions({ | ||
gap: '~' | ||
}) | ||
console.log(cmarked('### cmarked 依 旧 爱 你')) | ||
//输出 <h3 id='cmarked~依~旧~爱~你'>cmarked 依 旧 爱 你</h3> | ||
// 连续的空格只会生成一个填充符 | ||
### smarkOrderList | ||
type: `Boolean` default: `false` | ||
是否使用智能的的有序列表,如果你的有序列表想要从不是1开头的,需要开启此选项。注意,原生的markdown并不支持此语法。 | ||
例子 - 不开启智能有序列表 | ||
var cmarked = require('cmarked') | ||
console.log(cmarked('3. cmarked\n4. cmarked')) | ||
//输出 | ||
1. cmarked | ||
2. cmarked | ||
例子 - 开启智能有序列表 | ||
var cmarked = require('cmarked') | ||
console.log(cmarked('3. cmarked\n4. cmarked')) | ||
//输出 | ||
3. cmarked | ||
4. cmarked | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17974
491
76