Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cmarked

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cmarked

更符合汉语的markdown编译器

  • 1.0.13
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8
increased by700%
Maintainers
1
Weekly downloads
 
Created
Source

cmarked

更符合中文的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

目前该JavaScript包处于开发阶段,只在我的博客网站上面进行试用http://www.jiangxuan.org

如果你是开发者,请阅读dev.md

Keywords

FAQs

Package last updated on 10 Feb 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc