1.1.4 • Published 6 years ago

zhike-md-parser v1.1.4

Weekly downloads
3
License
ISC
Repository
github
Last release
6 years ago

解析自定义标签为格式化数据

markdown自定义标签及规则参考产品整理的文件

Demo

use node

const MDParser = require('zhike-md-parser');
const mdParser = new MDParser({cdnCommon: '//xxx.xxx.com'});
let str = '{{paragraph}}\n{{time}}0.34/5.17{{end}}\n{{raw}}__You will hear a tutor and a student{{end}}'
	+ '{{raw}}__You will hear a tutor and a student{{end}}{{trans}}{{end}}{{raw}}__You will hear a tutor and a student{{end}}{{end}}';
let mdRet = mdParser.parse(str, true, true);

result:
{ start: 0.34,
  end: 5.17,
  raw: '<p><p><em>You will hear a tutor and a student</em>You will hear a tutor and a student__You will hear a tutor and a student</p></p>',
  trans: '' }

use browser

step: cd zhike-md-parser 
      npm i 
      node test/server
usage: http://localhost:8888/browser.html

api

1.MDParser(opts)

params

  • cdnCommon e: {cdnCommon: 'http:xxx.xxx.com'} (如果md中有img标签,cdnCommon为图片cdn前缀地址)

2.mdParser.parse(mdStr, isCombine, toHtml);

params

  • mdStr md的字符串 string
  • isCombine 是否合并 boolean
  • toHtml 是否转为html boolean
1.1.4

6 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago