Skip to content

Commit

Permalink
Use ESM
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Aug 5, 2021
1 parent 438f72a commit 7ae15b5
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 35 deletions.
12 changes: 4 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
'use strict'
import toHast from 'mdast-util-to-hast'
import toHtml from 'hast-util-to-html'
import sanitize from 'hast-util-sanitize'

var toHast = require('mdast-util-to-hast')
var toHtml = require('hast-util-to-html')
var sanitize = require('hast-util-sanitize')

module.exports = plugin

function plugin(options) {
export default function remarkHtml(options) {
var settings = options || {}
var clean = settings.sanitize
var schema = clean && typeof clean === 'object' ? clean : null
Expand Down
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@
"Junyoung Choi <fluke8259@gmail.com>",
"Jonathan Soeder <jonathan.soeder@gmail.com>"
],
"types": "types/index.d.ts",
"sideEffects": false,
"type": "module",
"main": "index.js",
"files": [
"types/index.d.ts",
"index.js"
],
"dependencies": {
Expand All @@ -40,7 +41,7 @@
},
"devDependencies": {
"c8": "^7.0.0",
"commonmark.json": "^0.29.0",
"commonmark.json": "^0.30.0",
"dtslint": "^4.0.0",
"is-hidden": "^1.0.0",
"not": "^0.1.0",
Expand Down Expand Up @@ -79,6 +80,8 @@
"prettier": true,
"esnext": false,
"rules": {
"no-var": "off",
"prefer-arrow-callback": "off",
"unicorn/no-array-callback-reference": "off",
"unicorn/prefer-includes": "off",
"unicorn/prefer-optional-catch-binding": "off"
Expand Down
46 changes: 22 additions & 24 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
'use strict'

var path = require('path')
var fs = require('fs')
var test = require('tape')
var remark = require('remark')
var slug = require('remark-slug')
var footnotes = require('remark-footnotes')
var frontmatter = require('remark-frontmatter')
var gfm = require('remark-gfm')
var github = require('remark-github')
var toc = require('remark-toc')
var commonmark = require('commonmark.json')
var vfile = require('to-vfile')
var hidden = require('is-hidden')
var not = require('not')
var unified = require('unified')
var parse = require('remark-parse')
var rehypeParse = require('rehype-parse')
var rehypeStringify = require('rehype-stringify')
var all = require('mdast-util-to-hast/lib/all')
var html = require('..')
import path from 'path'
import fs from 'fs'
import test from 'tape'
import remark from 'remark'
import slug from 'remark-slug'
import footnotes from 'remark-footnotes'
import frontmatter from 'remark-frontmatter'
import gfm from 'remark-gfm'
import github from 'remark-github'
import toc from 'remark-toc'
import {commonmark} from 'commonmark.json'
import vfile from 'to-vfile'
import hidden from 'is-hidden'
import not from 'not'
import unified from 'unified'
import parse from 'remark-parse'
import rehypeParse from 'rehype-parse'
import rehypeStringify from 'rehype-stringify'
import all from 'mdast-util-to-hast/lib/all.js'
import html from '../index.js'

test('remark-html()', function (t) {
var processor
Expand Down Expand Up @@ -229,7 +227,7 @@ test('remark-html()', function (t) {

// Assert fixtures.
test('Fixtures', function (t) {
var base = path.join(__dirname, 'fixtures')
var base = path.join('test', 'fixtures')

fs.readdirSync(base).filter(not(hidden)).forEach(each)

Expand Down Expand Up @@ -296,7 +294,7 @@ test('Integrations', function (t) {
github: github,
toc: [slug, toc]
}
var base = path.join(__dirname, 'integrations')
var base = path.join('test', 'integrations')

fs.readdirSync(base).filter(not(hidden)).forEach(each)

Expand Down

0 comments on commit 7ae15b5

Please sign in to comment.