Files
sgauthier 6e64e138e2
All checks were successful
Publish To Prod / deploy_and_publish (push) Successful in 35s
planning
2024-10-14 09:15:30 +02:00

40 lines
985 B
JavaScript

'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]
}
}