Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: remarkjs/remark-html
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 6b45f01951d9ac5d123b21dc5ce54e062b9a9794
Choose a base ref
...
head repository: remarkjs/remark-html
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2133d209ab423ead9c6360ab93850f03a1101d8a
Choose a head ref

Commits on Aug 10, 2018

  1. Add missing dev-dependency

    wooorm committed Aug 10, 2018
    Copy the full SHA
    05f8124 View commit details

Commits on Oct 22, 2018

  1. Move LICENSE > license

    wooorm committed Oct 22, 2018
    Copy the full SHA
    9442ec6 View commit details
  2. Update dev-dependencies

    wooorm committed Oct 22, 2018
    Copy the full SHA
    68e4449 View commit details

Commits on Nov 20, 2018

  1. Move URLs to HTTPS

    wooorm committed Nov 20, 2018
    Copy the full SHA
    2d15556 View commit details
  2. Add more badges

    wooorm committed Nov 20, 2018
    Copy the full SHA
    fee6e64 View commit details
  3. Copy the full SHA
    b350587 View commit details
  4. 9.0.0

    wooorm committed Nov 20, 2018
    Copy the full SHA
    41d0237 View commit details

Commits on Jun 16, 2019

  1. Update dev-dependencies

    wooorm committed Jun 16, 2019
    Copy the full SHA
    d0a73d8 View commit details
  2. Refactor comments

    wooorm committed Jun 16, 2019
    Copy the full SHA
    72b8661 View commit details
  3. Refactor to shout less

    wooorm committed Jun 16, 2019
    Copy the full SHA
    4bc5d7a View commit details
  4. Update Node in Travis

    wooorm committed Jun 16, 2019
    Copy the full SHA
    899f4a8 View commit details
  5. Fix typo

    wooorm committed Jun 16, 2019
    Copy the full SHA
    b3d4ebd View commit details
  6. Update package.json

    wooorm committed Jun 16, 2019
    Copy the full SHA
    12ceeb4 View commit details
  7. Refactor prose

    wooorm committed Jun 16, 2019
    Copy the full SHA
    b7a9bcd View commit details
  8. 9.0.1

    wooorm committed Jun 16, 2019
    Copy the full SHA
    402c422 View commit details
  9. Update mdast-util-to-hast

    wooorm committed Jun 16, 2019
    Copy the full SHA
    995b271 View commit details
  10. Update hast-util-to-html

    wooorm committed Jun 16, 2019
    Copy the full SHA
    04641d0 View commit details

Commits on Jul 1, 2019

  1. Update hast-util-sanitize

    wooorm committed Jul 1, 2019
    Copy the full SHA
    06628d8 View commit details

Commits on Jul 19, 2019

  1. Update dev-dependencies

    wooorm committed Jul 19, 2019
    Copy the full SHA
    e4442fe View commit details
  2. 10.0.0

    wooorm committed Jul 19, 2019
    Copy the full SHA
    0cd2dab View commit details

Commits on Jul 24, 2019

  1. Update dev-dependencies

    wooorm committed Jul 24, 2019
    Copy the full SHA
    81598c4 View commit details
  2. Fix wrong default description

    wooorm committed Jul 24, 2019
    Copy the full SHA
    fa0457b View commit details
  3. Add notes on security

    wooorm committed Jul 24, 2019
    Copy the full SHA
    3d726a4 View commit details

Commits on Mar 23, 2020

  1. Copy the full SHA
    3a263ef View commit details
  2. Add keyword

    wooorm committed Mar 23, 2020
    Copy the full SHA
    6f1ac2c View commit details
  3. Refactor prose

    wooorm committed Mar 23, 2020
    Copy the full SHA
    a58bda6 View commit details
  4. Update dev-dependencies

    wooorm committed Mar 23, 2020
    Copy the full SHA
    cd997a7 View commit details
  5. Update hast-util-to-html

    wooorm committed Mar 23, 2020
    Copy the full SHA
    558d4ad View commit details
  6. Update mdast-util-to-hast

    wooorm committed Mar 23, 2020
    Copy the full SHA
    7781ead View commit details
  7. 11.0.0

    wooorm committed Mar 23, 2020
    Copy the full SHA
    d2f4489 View commit details
  8. Fix releases

    wooorm committed Mar 23, 2020
    Copy the full SHA
    58bd10e View commit details
  9. Fix deprecation warning

    wooorm committed Mar 23, 2020
    Copy the full SHA
    e370aa5 View commit details
  10. 11.0.1

    wooorm committed Mar 23, 2020
    Copy the full SHA
    8a4d280 View commit details

Commits on May 13, 2020

  1. Update dev-dependencies

    wooorm committed May 13, 2020
    Copy the full SHA
    4e47853 View commit details
  2. Rename internal method

    Closes GH-29.
    Closes GH-30.
    
    Co-authored-by: Cristiano Betta <cristiano@betta.io>
    Co-authored-by: Aaron Reisman <aaron@lifeiscontent.net>
    3 people committed May 13, 2020
    Copy the full SHA
    faf7d1f View commit details
  3. 11.0.2

    wooorm committed May 13, 2020
    Copy the full SHA
    9ca09cf View commit details

Commits on Jun 23, 2020

  1. Change master in links

    wooorm committed Jun 23, 2020
    Copy the full SHA
    2d05989 View commit details
  2. Update dev-dependencies

    wooorm committed Jun 23, 2020
    Copy the full SHA
    f59c15d View commit details

Commits on Jul 11, 2020

  1. Add docs for handlers to readme.md

    Closes GH-33.
    
    Reviewed-by: Christian Murphy <christian.murphy.42@gmail.com>
    Reviewed-by: Titus Wormer <tituswormer@gmail.com>
    muescha authored Jul 11, 2020
    Copy the full SHA
    3806b30 View commit details

Commits on Jul 14, 2020

  1. Refactors docs on options.sanitize in readme.md

    Closes GH-35.
    
    Reviewed-by: Titus Wormer <tituswormer@gmail.com>
    muescha authored Jul 14, 2020
    Copy the full SHA
    3126be4 View commit details

Commits on Jul 23, 2020

  1. Add types

    Closes GH-28.
    Closes GH-32.
    
    Reviewed-by: Christian Murphy <christian.murphy.42@gmail.com>
    Reviewed-by: Jonathan Haines <jonno.haines@gmail.com>
    Reviewed-by: Junyoung Choi <fluke8259@gmail.com>
    Reviewed-by: Titus Wormer <tituswormer@gmail.com>
    TaylorBeeston authored Jul 23, 2020
    Copy the full SHA
    87d88f7 View commit details
  2. 12.0.0

    wooorm committed Jul 23, 2020
    Copy the full SHA
    60841bf View commit details

Commits on Aug 22, 2020

  1. Add Discussions

    wooorm authored Aug 22, 2020
    Copy the full SHA
    db1a1d0 View commit details

Commits on Oct 2, 2020

  1. Update dev-dependencies

    wooorm committed Oct 2, 2020
    Copy the full SHA
    5fec432 View commit details

Commits on Oct 3, 2020

  1. Change to comply to CommonMark

    * Change to comply to CommonMark — prefer the first when duplicate
      definitions are found
    * Replace `xtend` w/ `Object.assign`
    * Refactor old stuff in tests
    wooorm committed Oct 3, 2020
    Copy the full SHA
    0b1cd0a View commit details
  2. Update docs

    wooorm committed Oct 3, 2020
    Copy the full SHA
    efa1a5a View commit details
  3. 13.0.0

    wooorm committed Oct 3, 2020
    Copy the full SHA
    bdeeee5 View commit details
  4. Update mdast-util-to-hast

    wooorm committed Oct 3, 2020
    Copy the full SHA
    7a8cb0e View commit details
  5. 13.0.1

    wooorm committed Oct 3, 2020
    Copy the full SHA
    c0b2f69 View commit details

Commits on Sep 7, 2021

  1. Fix to sanitize by default

    The docs have always said `remark-html` is safe by default.
    It wasn’t and this patches that.
    
    If you do want to be unsafe, use `remark-html` with `sanitize: false`:
    
    ```diff
      -.use(remarkHtml)
      +.use(remarkHtml, {sanitize: false})
    ```
    wooorm committed Sep 7, 2021
    Copy the full SHA
    b0b1ba5 View commit details
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
coverage/
remark-html.js
remark-html.min.js
*.html
*.json
*.md
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
language: node_js
node_js:
- lts/boron
- node
- lts/dubnium
- node
after_script: bash <(curl -s https://codecov.io/bash)
deploy:
provider: releases
skip_cleanup: true
api_key:
secure: Dk+BizJGxzQopL8tVdknG6+dB/6QyruT2qlbNNT3RRiJNDuji8Ux3certNqclRe4NtxfU+haOZDcQ+7mdoMATP6zwFEG5IAOuUUA5JMxTyVfDHG/SErae1nq9w7U4JkpuKNu+pbQlxL+BjkJaqkPJexElYnGxjJgcnh3hGjEpU3cIk/QrthFYq9Bd0PbrpHsaopTwzAMz1uiqWIA/mF03I+l3FC+iRYRqK/9TOhecYiMV0PT027Q1gnYwpDGVAvrkoFqtXWnDZxYRWqguwQXbTUvcoL8KdSeJXslKiS9YiqW/4Q+x9sM1KuycQK1DZi23g733nKtfnUX0NTHuAZ+Kihsgn0ltikI9F9JiFwwJ5kB9sGpE34Xjflr2+bBCsnAfMwK4Ao5tgBKJrHupK+dw5yg53+KmBL/WZTj/xy5ygI1mqcJT+282RTr7J8XGsNLrQP0C+PExFQbBVdqdvN72d/BRnPoI8ubUdMB0dgffkKEQkzPlOyE1MwoOy9ZyI9O7XXgXxZCPPRQoTCZmKR4mRkBgd5k3ZuV5nQWIC7vNihfEeqABz0S7Ed3DWvmu0aworH2wsI3GGAMFs/Ssi0MjhlEBp6dJ+zhJ86p+FY1BzHer2FzG4b4ouZFBcKmY1SN00b8XW1UhHhA3LSYq8HsEAMcMuRGvAn0UZb7oGq7R6I=
file:
- "remark-html.js"
- "remark-html.min.js"
- 'remark-html.js'
- 'remark-html.min.js'
on:
tags: true
36 changes: 24 additions & 12 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,49 @@
'use strict'

var xtend = require('xtend')
var toHAST = require('mdast-util-to-hast')
var toHTML = require('hast-util-to-html')
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) {
var settings = options || {}
var clean = settings.sanitize
var schema = clean && typeof clean === 'object' ? clean : null
var handlers = settings.handlers || {}
var settings = Object.assign({}, options || {})
let clean

if (typeof settings.sanitize === 'boolean') {
clean = settings.sanitize
settings.sanitize = undefined
}

if (typeof clean !== 'boolean') {
clean = true
}

this.Compiler = compiler

function compiler(node, file) {
var root = node && node.type && node.type === 'root'
var hast = toHAST(node, {allowDangerousHTML: !clean, handlers: handlers})
var hast = toHast(node, {
allowDangerousHtml: !clean,
handlers: settings.handlers
})
var result

if (file.extname) {
file.extname = '.html'
}

if (clean) {
hast = sanitize(hast, schema)
hast = sanitize(hast, settings.sanitize)
}

result = toHTML(hast, xtend(settings, {allowDangerousHTML: !clean}))
result = toHtml(
hast,
Object.assign({}, settings, {allowDangerousHtml: !clean})
)

/* Add a final newline. */
if (root && result.charAt(result.length - 1) !== '\n') {
// Add an eof eol.
if (root && result && /[^\r\n]/.test(result.charAt(result.length - 1))) {
result += '\n'
}

File renamed without changes.
72 changes: 47 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,57 +1,74 @@
{
"name": "remark-html",
"version": "8.0.0",
"description": "Compile Markdown to HTML with remark",
"version": "13.0.2",
"description": "remark plugin to compile Markdown to HTML",
"license": "MIT",
"keywords": [
"unified",
"remark",
"remark-plugin",
"plugin",
"mdast",
"markdown",
"html",
"stringify",
"compile",
"remark"
"compile"
],
"repository": "remarkjs/remark-html",
"bugs": "https://github.com/remarkjs/remark-html/issues",
"author": "Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
},
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
"contributors": [
"Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)",
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
"Ben Briggs <beneb.info@gmail.com>",
"Seth Vincent <sethvincent@gmail.com>",
"Junyoung Choi <fluke8259@gmail.com>",
"Jonathan Soeder <jonathan.soeder@gmail.com>"
],
"types": "types/index.d.ts",
"files": [
"types/index.d.ts",
"index.js"
],
"dependencies": {
"hast-util-sanitize": "^1.0.0",
"hast-util-to-html": "^4.0.0",
"mdast-util-to-hast": "^3.0.0",
"xtend": "^4.0.1"
"hast-util-sanitize": "^3.0.0",
"hast-util-to-html": "^7.0.0",
"mdast-util-to-hast": "^10.0.0"
},
"devDependencies": {
"browserify": "^16.0.0",
"commonmark.json": "^0.27.0",
"is-hidden": "^1.0.1",
"nyc": "^12.0.0",
"prettier": "^1.14.2",
"remark": "^9.0.0",
"remark-cli": "^5.0.0",
"remark-github": "^7.0.0",
"remark-preset-wooorm": "^4.0.0",
"remark-toc": "^5.0.0",
"tape": "^4.0.0",
"to-vfile": "^5.0.0",
"xo": "^0.22.0"
"commonmark.json": "^0.29.0",
"dtslint": "^4.0.0",
"is-hidden": "^1.0.0",
"not": "^0.1.0",
"nyc": "^15.0.0",
"prettier": "^2.0.0",
"rehype-parse": "^7.0.0",
"rehype-stringify": "^8.0.0",
"remark": "^13.0.0-alpha.0",
"remark-cli": "^8.0.0",
"remark-github": "^9.0.0",
"remark-preset-wooorm": "^7.0.0",
"remark-slug": "^6.0.0",
"remark-toc": "^7.0.0",
"tape": "^5.0.0",
"tinyify": "^3.0.0",
"to-vfile": "^6.0.0",
"unified": "^9.0.0",
"xo": "^0.33.0"
},
"scripts": {
"format": "remark *..md -qfo && prettier --write \"**/*.js\" && xo --fix",
"format": "remark . -qfo --ignore-pattern test/ && prettier . --write && xo --fix",
"build-bundle": "browserify . -s remarkHtml > remark-html.js",
"build-mangle": "browserify . -s remarkHtml -p tinyify > remark-html.js",
"build-mangle": "browserify . -s remarkHtml -p tinyify > remark-html.min.js",
"build": "npm run build-bundle && npm run build-mangle",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test/index.js",
"test": "npm run format && npm run build && npm run test-coverage"
"test-types": "dtslint types",
"test": "npm run format && npm run build && npm run test-coverage && npm run test-types"
},
"nyc": {
"check-coverage": true,
@@ -70,6 +87,11 @@
"xo": {
"prettier": true,
"esnext": false,
"rules": {
"unicorn/no-fn-reference-in-iterator": "off",
"unicorn/prefer-includes": "off",
"unicorn/prefer-optional-catch-binding": "off"
},
"ignores": [
"remark-html.js"
]
Loading