@hashicorp/remark-plugins
Advanced tools
Comparing version 2.2.1 to 2.2.2
{ | ||
"name": "@hashicorp/remark-plugins", | ||
"description": "A potpourri of remark plugins used to process .mdx files", | ||
"version": "2.2.1", | ||
"version": "2.2.2", | ||
"author": "Jeff Escalante", | ||
@@ -27,2 +27,3 @@ "bugs": "https://github.com/hashicorp/remark-plugins/issues", | ||
"rehype-stringify": "^6.0.1", | ||
"release": "^6.1.0", | ||
"remark-html": "^11.0.1", | ||
@@ -40,4 +41,7 @@ "remark-rehype": "^6.0.0" | ||
"scripts": { | ||
"test": "jest --verbose" | ||
"test": "jest --verbose", | ||
"release:patch": "release patch && npm publish", | ||
"release:minor": "release minor && npm publish", | ||
"release:major": "release major && npm publish" | ||
} | ||
} |
@@ -161,3 +161,20 @@ const generateSlug = require('../../generate_slug') | ||
// we look for ((#foo)) or ((#foo, #bar)) | ||
// with the below regex, we look for ((#foo)) or ((#foo, #bar)) | ||
// | ||
// NOTE: There is a potential improvement in the fidelity of this regex, but it's | ||
// an edge case and would make the code more complex, so skipping until we need it. | ||
// Will detail here in case its ever needed in the future though. | ||
// | ||
// Headline nodes include the headline and alias, like "foo ((#bar))", where inline | ||
// lists that start with code only include the content directly after the code, like | ||
// " ((#bar)) other text". Because of this difference in behavior, this regex does | ||
// not make assumptions about *where* the anchor link alias sits in the string. That | ||
// means that something like "# foo ((#bar)) baz" would still work for a headline, and | ||
// something like "- `foo` some text ((#bar)) more text" would still work for an inline | ||
// list with code. This behavior should not be permitted -- the alias should sit directly | ||
// _after_ the headline or inline code. | ||
// | ||
// It could be enforced by differentiating the regexes that the two types use, such that | ||
// the inline list code uses `/^\s*\(\((#.*?)\)\)/` and headline uses `/\s*\(\((#.*?)\)\)$/` | ||
// but at the moment this seems like unnecessary complexity. | ||
const aliasRegex = /\s*\(\((#.*?)\)\)/ | ||
@@ -181,3 +198,3 @@ | ||
// that in the first text node. if we match this, we can continue our search. | ||
const minimumViableRegex = /\s*\(\(/ | ||
const minimumViableRegex = /\s*\(\(#/ | ||
const endRegex = /\)\)/ | ||
@@ -184,0 +201,0 @@ if (firstNode.value && firstNode.value.match(minimumViableRegex)) { |
35442
476
10