@hashicorp/remark-plugins
Advanced tools
Comparing version 0.1.1 to 0.2.0
{ | ||
"name": "@hashicorp/remark-plugins", | ||
"description": "A potpourri of remark plugins used to process .mdx files", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"author": "Kevin Pruett", | ||
@@ -14,3 +14,3 @@ "bugs": "https://github.com/hashicorp/remark-plugins/issues", | ||
"remark-slug": "^5.1.1", | ||
"unist-util-is": "^2.1.3", | ||
"unist-util-is": "^3.0.0", | ||
"unist-util-visit": "^1.4.1" | ||
@@ -17,0 +17,0 @@ }, |
@@ -11,3 +11,5 @@ const is = require('unist-util-is') | ||
visit(liNode, 'paragraph', pNode => { | ||
visit(pNode, 'inlineCode', codeNode => { | ||
// Perform node reconstruction when code appears in first position | ||
if (is(pNode.children[0], 'inlineCode')) { | ||
const codeNode = pNode.children[0] | ||
// Construct an id/slug based on value of <code> node | ||
@@ -22,13 +24,9 @@ const codeSlug = slugger.slug(`inlinecode-${codeNode.value}`) | ||
// Wrap link element around child <code> node | ||
pNode.children = pNode.children.map(node => { | ||
return is(node, codeNode) | ||
? { | ||
type: 'link', | ||
url: `#${codeSlug}`, | ||
title: null, | ||
children: [node] | ||
} | ||
: node | ||
}) | ||
}) | ||
pNode.children[0] = { | ||
type: 'link', | ||
url: `#${codeSlug}`, | ||
title: null, | ||
children: [pNode.children[0]] | ||
} | ||
} | ||
}) | ||
@@ -35,0 +33,0 @@ }) |
@@ -22,3 +22,3 @@ const is = require('unist-util-is') | ||
parent.children = parent.children.map(node => { | ||
return is(node, pNode) | ||
return is(pNode, node) | ||
? { | ||
@@ -25,0 +25,0 @@ type: 'wrapper', |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
10797
151
1
- Removedunist-util-is@2.1.3(transitive)
Updatedunist-util-is@^3.0.0