forked from remarkjs/remark-gfm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
39 lines (32 loc) · 985 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
'use strict'
var syntax = require('micromark-extension-gfm')
var fromMarkdown = require('mdast-util-gfm/from-markdown')
var toMarkdown = require('mdast-util-gfm/to-markdown')
var warningIssued
module.exports = gfm
function gfm(options) {
var data = this.data()
/* istanbul ignore next - old remark. */
if (
!warningIssued &&
((this.Parser &&
this.Parser.prototype &&
this.Parser.prototype.blockTokenizers) ||
(this.Compiler &&
this.Compiler.prototype &&
this.Compiler.prototype.visitors))
) {
warningIssued = true
console.warn(
'[remark-gfm] Warning: please upgrade to remark 13 to use this plugin'
)
}
add('micromarkExtensions', syntax(options))
add('fromMarkdownExtensions', fromMarkdown)
add('toMarkdownExtensions', toMarkdown(options))
function add(field, value) {
/* istanbul ignore if - other extensions. */
if (data[field]) data[field].push(value)
else data[field] = [value]
}
}