Skip to content

Commit

Permalink
Use ESM
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Aug 6, 2021
1 parent 4675840 commit ab51cd4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
8 changes: 2 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
'use strict'

var mdast2hast = require('mdast-util-to-hast')

module.exports = remark2rehype
import mdast2hast from 'mdast-util-to-hast'

// Attacher.
// If a destination is given, runs the destination with the new hast tree
// (bridge mode).
// Without destination, returns the tree: further plugins run on that tree
// (mutate mode).
function remark2rehype(destination, options) {
export default function remarkRehype(destination, options) {
if (destination && !destination.process) {
options = destination
destination = null
Expand Down
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
"John Otander <johnotander@gmail.com> (https://johno.com)"
],
"sideEffects": false,
"type": "module",
"main": "index.js",
"files": [
"index.js",
"types/index.d.ts"
"index.js"
],
"types": "types/index.d.ts",
"dependencies": {
"mdast-util-to-hast": "^10.2.0"
},
Expand Down Expand Up @@ -65,6 +66,10 @@
"xo": {
"prettier": true,
"esnext": false,
"rules": {
"no-var": "off",
"prefer-arrow-callback": "off"
},
"ignores": [
"types/"
]
Expand Down
14 changes: 6 additions & 8 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
'use strict'

var test = require('tape')
var unified = require('unified')
var parse = require('remark-parse')
var markdown = require('remark-stringify')
var html = require('rehype-stringify')
var remark2rehype = require('.')
import test from 'tape'
import unified from 'unified'
import parse from 'remark-parse'
import markdown from 'remark-stringify'
import html from 'rehype-stringify'
import remark2rehype from './index.js'

test('remark2rehype()', function (t) {
t.equal(
Expand Down

0 comments on commit ab51cd4

Please sign in to comment.