mdast-util-to-hast
Advanced tools
Comparing version 3.0.1 to 3.0.2
@@ -6,3 +6,3 @@ 'use strict' | ||
var normalize = require('mdurl/encode') | ||
var failsafe = require('../failsafe') | ||
var revert = require('../revert') | ||
@@ -12,9 +12,15 @@ /* Transform a reference to an image. */ | ||
var def = h.definition(node.identifier) | ||
var props = {src: normalize((def && def.url) || ''), alt: node.alt} | ||
var props | ||
if (def && def.title !== null && def.title !== undefined) { | ||
if (!def) { | ||
return revert(h, node) | ||
} | ||
props = {src: normalize(def.url || ''), alt: node.alt} | ||
if (def.title !== null && def.title !== undefined) { | ||
props.title = def.title | ||
} | ||
return failsafe(h, node, def) || h(node, 'img', props) | ||
return h(node, 'img', props) | ||
} |
@@ -6,3 +6,3 @@ 'use strict' | ||
var normalize = require('mdurl/encode') | ||
var failsafe = require('../failsafe') | ||
var revert = require('../revert') | ||
var all = require('../all') | ||
@@ -13,9 +13,15 @@ | ||
var def = h.definition(node.identifier) | ||
var props = {href: normalize((def && def.url) || '')} | ||
var props | ||
if (def && def.title !== null && def.title !== undefined) { | ||
if (!def) { | ||
return revert(h, node) | ||
} | ||
props = {href: normalize(def.url || '')} | ||
if (def.title !== null && def.title !== undefined) { | ||
props.title = def.title | ||
} | ||
return failsafe(h, node, def) || h(node, 'a', props, all(h, node)) | ||
return h(node, 'a', props, all(h, node)) | ||
} |
{ | ||
"name": "mdast-util-to-hast", | ||
"version": "3.0.1", | ||
"version": "3.0.2", | ||
"description": "Transform MDAST to HAST", | ||
@@ -36,3 +36,2 @@ "license": "MIT", | ||
"browserify": "^16.0.0", | ||
"esmangle": "^1.0.1", | ||
"nyc": "^12.0.0", | ||
@@ -43,2 +42,3 @@ "prettier": "^1.13.3", | ||
"tape": "^4.0.0", | ||
"tinyify": "^2.4.3", | ||
"xo": "^0.21.0" | ||
@@ -48,4 +48,4 @@ }, | ||
"format": "remark . -qfo && prettier --write '**/*.js' && xo --fix", | ||
"build-bundle": "browserify index.js --bare -s mdastUtilToHAST > mdast-util-to-hast.js", | ||
"build-mangle": "esmangle mdast-util-to-hast.js > mdast-util-to-hast.min.js", | ||
"build-bundle": "browserify index.js -s mdastUtilToHAST > mdast-util-to-hast.js", | ||
"build-mangle": "browserify index.js -s mdastUtilToHAST -p tinyify > mdast-util-to-hast.min.js", | ||
"build": "npm run build-bundle && npm run build-mangle", | ||
@@ -52,0 +52,0 @@ "test-api": "node test", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
24630
587
0