diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 6c33d04dae6..33aaa6304fe 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -22,3 +22,16 @@ updates: applies-to: version-updates patterns: - '*' + + - package-ecosystem: npm + directory: /tools/lint-md + schedule: + interval: monthly + commit-message: + prefix: tools + open-pull-requests-limit: 10 + groups: + lint-md: + applies-to: version-updates + patterns: + - '*' diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index d6e5a7a2640..11d6ac02a0d 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -28,7 +28,6 @@ on: - histogram - icu # - libuv - - lint-md-dependencies - llhttp - minimatch - nbytes @@ -187,24 +186,6 @@ jobs: # cat temp-output # tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true # rm temp-output - - id: lint-md-dependencies - subsystem: tools - label: tools - run: | - cd tools/lint-md - npm ci - NEW_VERSION=$(npm outdated --parseable | cut -d: -f4 | xargs) - if [ "$NEW_VERSION" != "" ]; then - echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV - rm -rf package-lock.json node_modules - # Include $NEW_VERSION to explicitly update the package.json - # entry for the dependency and also so that semver-major updates - # are not skipped. - npm install --ignore-scripts $NEW_VERSION - npm install --ignore-scripts - cd ../.. - make lint-md-rollup - fi - id: llhttp subsystem: deps label: dependencies diff --git a/.gitignore b/.gitignore index 748e1904bc6..60a3ff8b4a4 100644 --- a/.gitignore +++ b/.gitignore @@ -114,6 +114,7 @@ tools/*/*.i.tmp /tools/doc/node_modules /tools/clang-format/node_modules /tools/eslint/node_modules +/tools/lint-md/node_modules # === Rules for test artifacts === /*.tap diff --git a/Makefile b/Makefile index 7f3f09ecbcb..b6cd644e286 100644 --- a/Makefile +++ b/Makefile @@ -1335,21 +1335,6 @@ bench-addons-clean: $(RM) -r benchmark/napi/*/build $(RM) benchmark/napi/.buildstamp -.PHONY: lint-md-rollup -lint-md-rollup: - $(RM) tools/.*mdlintstamp - cd tools/lint-md && npm ci && npm run build - -.PHONY: lint-md-clean -.NOTPARALLEL: lint-md-clean -lint-md-clean: - $(RM) -r tools/lint-md/node_modules - $(RM) tools/.*mdlintstamp - -.PHONY: lint-md-build -lint-md-build: - $(warning Deprecated no-op target 'lint-md-build') - ifeq ("$(wildcard tools/.mdlintstamp)","") LINT_MD_NEWER = else @@ -1361,8 +1346,13 @@ LINT_MD_FILES = $(shell $(FIND) $(LINT_MD_TARGETS) -type f \ ! -path '*node_modules*' ! -path 'test/fixtures/*' -name '*.md' \ $(LINT_MD_NEWER)) run-lint-md = tools/lint-md/lint-md.mjs $(LINT_MD_FILES) + +# Check for a specific file, as (empty) directories are persisted in git. +tools/lint-md/node_modules/remark-parse/package.json: + -cd tools/lint-md && $(call available-node,$(run-npm-ci)) + # Lint all changed markdown files maintained by us -tools/.mdlintstamp: $(LINT_MD_FILES) +tools/.mdlintstamp: tools/lint-md/node_modules/remark-parse/package.json $(LINT_MD_FILES) $(info Running Markdown linter...) @$(call available-node,$(run-lint-md)) @touch $@ @@ -1372,7 +1362,7 @@ lint-md: lint-js-doc | tools/.mdlintstamp ## Lint the markdown documents maintai run-format-md = tools/lint-md/lint-md.mjs --format $(LINT_MD_FILES) .PHONY: format-md -format-md: ## Format the markdown documents maintained by us in the codebase. +format-md: tools/lint-md/node_modules/remark-parse/package.json ## Format the markdown documents maintained by us in the codebase. @$(call available-node,$(run-format-md)) @@ -1601,6 +1591,7 @@ lint-clean: ## Remove linting artifacts. $(RM) tools/.*lintstamp $(RM) .eslintcache $(RM) -r tools/eslint/node_modules + $(RM) -r tools/lint-md/node_modules $(RM) tools/pip/site_packages HAS_DOCKER ?= $(shell command -v docker > /dev/null 2>&1; [ $$? -eq 0 ] && echo 1 || echo 0) diff --git a/eslint.config.mjs b/eslint.config.mjs index f22bbc3bbd2..a26ea19154e 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -54,7 +54,6 @@ export default [ 'test/message/esm_display_syntax_error.mjs', 'tools/github_reporter/**', 'tools/icu/**', - 'tools/lint-md/lint-md.mjs', ], }, // #endregion diff --git a/tools/lint-md/.gitignore b/tools/lint-md/.gitignore deleted file mode 100644 index 3c3629e647f..00000000000 --- a/tools/lint-md/.gitignore +++ /dev/null @@ -1 +0,0 @@ -node_modules diff --git a/tools/lint-md/lint-md.mjs b/tools/lint-md/lint-md.mjs index 81c72856249..4116d7e803b 100644 --- a/tools/lint-md/lint-md.mjs +++ b/tools/lint-md/lint-md.mjs @@ -1,23913 +1,37 @@ import fs from 'fs'; -import path$1 from 'path'; -import { pathToFileURL } from 'url'; -import minpath from 'node:path'; -import process$1 from 'node:process'; -import { fileURLToPath } from 'node:url'; -import fs$1 from 'node:fs'; -import os from 'node:os'; -import tty from 'node:tty'; -function bail(error) { - if (error) { - throw error - } -} - -function getDefaultExportFromCjs (x) { - return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; -} - -var extend$2; -var hasRequiredExtend; -function requireExtend () { - if (hasRequiredExtend) return extend$2; - hasRequiredExtend = 1; - var hasOwn = Object.prototype.hasOwnProperty; - var toStr = Object.prototype.toString; - var defineProperty = Object.defineProperty; - var gOPD = Object.getOwnPropertyDescriptor; - var isArray = function isArray(arr) { - if (typeof Array.isArray === 'function') { - return Array.isArray(arr); - } - return toStr.call(arr) === '[object Array]'; - }; - var isPlainObject = function isPlainObject(obj) { - if (!obj || toStr.call(obj) !== '[object Object]') { - return false; - } - var hasOwnConstructor = hasOwn.call(obj, 'constructor'); - var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf'); - if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) { - return false; - } - var key; - for (key in obj) { } - return typeof key === 'undefined' || hasOwn.call(obj, key); - }; - var setProperty = function setProperty(target, options) { - if (defineProperty && options.name === '__proto__') { - defineProperty(target, options.name, { - enumerable: true, - configurable: true, - value: options.newValue, - writable: true - }); - } else { - target[options.name] = options.newValue; - } - }; - var getProperty = function getProperty(obj, name) { - if (name === '__proto__') { - if (!hasOwn.call(obj, name)) { - return void 0; - } else if (gOPD) { - return gOPD(obj, name).value; - } - } - return obj[name]; - }; - extend$2 = function extend() { - var options, name, src, copy, copyIsArray, clone; - var target = arguments[0]; - var i = 1; - var length = arguments.length; - var deep = false; - if (typeof target === 'boolean') { - deep = target; - target = arguments[1] || {}; - i = 2; - } - if (target == null || (typeof target !== 'object' && typeof target !== 'function')) { - target = {}; - } - for (; i < length; ++i) { - options = arguments[i]; - if (options != null) { - for (name in options) { - src = getProperty(target, name); - copy = getProperty(options, name); - if (target !== copy) { - if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) { - if (copyIsArray) { - copyIsArray = false; - clone = src && isArray(src) ? src : []; - } else { - clone = src && isPlainObject(src) ? src : {}; - } - setProperty(target, { name: name, newValue: extend(deep, clone, copy) }); - } else if (typeof copy !== 'undefined') { - setProperty(target, { name: name, newValue: copy }); - } - } - } - } - } - return target; - }; - return extend$2; -} - -var extendExports = requireExtend(); -var extend$1 = /*@__PURE__*/getDefaultExportFromCjs(extendExports); - -function ok$1() {} - -function isPlainObject(value) { - if (typeof value !== 'object' || value === null) { - return false; - } - const prototype = Object.getPrototypeOf(value); - return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value); -} - -function trough() { - const fns = []; - const pipeline = {run, use}; - return pipeline - function run(...values) { - let middlewareIndex = -1; - const callback = values.pop(); - if (typeof callback !== 'function') { - throw new TypeError('Expected function as last argument, not ' + callback) - } - next(null, ...values); - function next(error, ...output) { - const fn = fns[++middlewareIndex]; - let index = -1; - if (error) { - callback(error); - return - } - while (++index < values.length) { - if (output[index] === null || output[index] === undefined) { - output[index] = values[index]; - } - } - values = output; - if (fn) { - wrap(fn, next)(...output); - } else { - callback(null, ...output); - } - } - } - function use(middelware) { - if (typeof middelware !== 'function') { - throw new TypeError( - 'Expected `middelware` to be a function, not ' + middelware - ) - } - fns.push(middelware); - return pipeline - } -} -function wrap(middleware, callback) { - let called; - return wrapped - function wrapped(...parameters) { - const fnExpectsCallback = middleware.length > parameters.length; - let result; - if (fnExpectsCallback) { - parameters.push(done); - } - try { - result = middleware.apply(this, parameters); - } catch (error) { - const exception = (error); - if (fnExpectsCallback && called) { - throw exception - } - return done(exception) - } - if (!fnExpectsCallback) { - if (result && result.then && typeof result.then === 'function') { - result.then(then, done); - } else if (result instanceof Error) { - done(result); - } else { - then(result); - } - } - } - function done(error, ...output) { - if (!called) { - called = true; - callback(error, ...output); - } - } - function then(value) { - done(null, value); - } -} - -function stringifyPosition(value) { - if (!value || typeof value !== 'object') { - return '' - } - if ('position' in value || 'type' in value) { - return position$1(value.position) - } - if ('start' in value || 'end' in value) { - return position$1(value) - } - if ('line' in value || 'column' in value) { - return point$2(value) - } - return '' -} -function point$2(point) { - return index(point && point.line) + ':' + index(point && point.column) -} -function position$1(pos) { - return point$2(pos && pos.start) + '-' + point$2(pos && pos.end) -} -function index(value) { - return value && typeof value === 'number' ? value : 1 -} - -class VFileMessage extends Error { - constructor(causeOrReason, optionsOrParentOrPlace, origin) { - super(); - if (typeof optionsOrParentOrPlace === 'string') { - origin = optionsOrParentOrPlace; - optionsOrParentOrPlace = undefined; - } - let reason = ''; - let options = {}; - let legacyCause = false; - if (optionsOrParentOrPlace) { - if ( - 'line' in optionsOrParentOrPlace && - 'column' in optionsOrParentOrPlace - ) { - options = {place: optionsOrParentOrPlace}; - } - else if ( - 'start' in optionsOrParentOrPlace && - 'end' in optionsOrParentOrPlace - ) { - options = {place: optionsOrParentOrPlace}; - } - else if ('type' in optionsOrParentOrPlace) { - options = { - ancestors: [optionsOrParentOrPlace], - place: optionsOrParentOrPlace.position - }; - } - else { - options = {...optionsOrParentOrPlace}; - } - } - if (typeof causeOrReason === 'string') { - reason = causeOrReason; - } - else if (!options.cause && causeOrReason) { - legacyCause = true; - reason = causeOrReason.message; - options.cause = causeOrReason; - } - if (!options.ruleId && !options.source && typeof origin === 'string') { - const index = origin.indexOf(':'); - if (index === -1) { - options.ruleId = origin; - } else { - options.source = origin.slice(0, index); - options.ruleId = origin.slice(index + 1); - } - } - if (!options.place && options.ancestors && options.ancestors) { - const parent = options.ancestors[options.ancestors.length - 1]; - if (parent) { - options.place = parent.position; - } - } - const start = - options.place && 'start' in options.place - ? options.place.start - : options.place; - this.ancestors = options.ancestors || undefined; - this.cause = options.cause || undefined; - this.column = start ? start.column : undefined; - this.fatal = undefined; - this.file; - this.message = reason; - this.line = start ? start.line : undefined; - this.name = stringifyPosition(options.place) || '1:1'; - this.place = options.place || undefined; - this.reason = this.message; - this.ruleId = options.ruleId || undefined; - this.source = options.source || undefined; - this.stack = - legacyCause && options.cause && typeof options.cause.stack === 'string' - ? options.cause.stack - : ''; - this.actual; - this.expected; - this.note; - this.url; - } -} -VFileMessage.prototype.file = ''; -VFileMessage.prototype.name = ''; -VFileMessage.prototype.reason = ''; -VFileMessage.prototype.message = ''; -VFileMessage.prototype.stack = ''; -VFileMessage.prototype.column = undefined; -VFileMessage.prototype.line = undefined; -VFileMessage.prototype.ancestors = undefined; -VFileMessage.prototype.cause = undefined; -VFileMessage.prototype.fatal = undefined; -VFileMessage.prototype.place = undefined; -VFileMessage.prototype.ruleId = undefined; -VFileMessage.prototype.source = undefined; - -function isUrl(fileUrlOrPath) { - return Boolean( - fileUrlOrPath !== null && - typeof fileUrlOrPath === 'object' && - 'href' in fileUrlOrPath && - fileUrlOrPath.href && - 'protocol' in fileUrlOrPath && - fileUrlOrPath.protocol && - fileUrlOrPath.auth === undefined - ) -} - -const order = ([ - 'history', - 'path', - 'basename', - 'stem', - 'extname', - 'dirname' -]); -class VFile { - constructor(value) { - let options; - if (!value) { - options = {}; - } else if (isUrl(value)) { - options = {path: value}; - } else if (typeof value === 'string' || isUint8Array$2(value)) { - options = {value}; - } else { - options = value; - } - this.cwd = 'cwd' in options ? '' : process$1.cwd(); - this.data = {}; - this.history = []; - this.messages = []; - this.value; - this.map; - this.result; - this.stored; - let index = -1; - while (++index < order.length) { - const field = order[index]; - if ( - field in options && - options[field] !== undefined && - options[field] !== null - ) { - this[field] = field === 'history' ? [...options[field]] : options[field]; - } - } - let field; - for (field in options) { - if (!order.includes(field)) { - this[field] = options[field]; - } - } - } - get basename() { - return typeof this.path === 'string' - ? minpath.basename(this.path) - : undefined - } - set basename(basename) { - assertNonEmpty(basename, 'basename'); - assertPart(basename, 'basename'); - this.path = minpath.join(this.dirname || '', basename); - } - get dirname() { - return typeof this.path === 'string' - ? minpath.dirname(this.path) - : undefined - } - set dirname(dirname) { - assertPath(this.basename, 'dirname'); - this.path = minpath.join(dirname || '', this.basename); - } - get extname() { - return typeof this.path === 'string' - ? minpath.extname(this.path) - : undefined - } - set extname(extname) { - assertPart(extname, 'extname'); - assertPath(this.dirname, 'extname'); - if (extname) { - if (extname.codePointAt(0) !== 46 ) { - throw new Error('`extname` must start with `.`') - } - if (extname.includes('.', 1)) { - throw new Error('`extname` cannot contain multiple dots') - } - } - this.path = minpath.join(this.dirname, this.stem + (extname || '')); - } - get path() { - return this.history[this.history.length - 1] - } - set path(path) { - if (isUrl(path)) { - path = fileURLToPath(path); - } - assertNonEmpty(path, 'path'); - if (this.path !== path) { - this.history.push(path); - } - } - get stem() { - return typeof this.path === 'string' - ? minpath.basename(this.path, this.extname) - : undefined - } - set stem(stem) { - assertNonEmpty(stem, 'stem'); - assertPart(stem, 'stem'); - this.path = minpath.join(this.dirname || '', stem + (this.extname || '')); - } - fail(causeOrReason, optionsOrParentOrPlace, origin) { - const message = this.message(causeOrReason, optionsOrParentOrPlace, origin); - message.fatal = true; - throw message - } - info(causeOrReason, optionsOrParentOrPlace, origin) { - const message = this.message(causeOrReason, optionsOrParentOrPlace, origin); - message.fatal = undefined; - return message - } - message(causeOrReason, optionsOrParentOrPlace, origin) { - const message = new VFileMessage( - causeOrReason, - optionsOrParentOrPlace, - origin - ); - if (this.path) { - message.name = this.path + ':' + message.name; - message.file = this.path; - } - message.fatal = false; - this.messages.push(message); - return message - } - toString(encoding) { - if (this.value === undefined) { - return '' - } - if (typeof this.value === 'string') { - return this.value - } - const decoder = new TextDecoder(encoding || undefined); - return decoder.decode(this.value) - } -} -function assertPart(part, name) { - if (part && part.includes(minpath.sep)) { - throw new Error( - '`' + name + '` cannot be a path: did not expect `' + minpath.sep + '`' - ) - } -} -function assertNonEmpty(part, name) { - if (!part) { - throw new Error('`' + name + '` cannot be empty') - } -} -function assertPath(path, name) { - if (!path) { - throw new Error('Setting `' + name + '` requires `path` to be set too') - } -} -function isUint8Array$2(value) { - return Boolean( - value && - typeof value === 'object' && - 'byteLength' in value && - 'byteOffset' in value - ) -} - -const CallableInstance = - ( - ( - function (property) { - const self = this; - const constr = self.constructor; - const proto = ( - constr.prototype - ); - const value = proto[property]; - const apply = function () { - return value.apply(apply, arguments) - }; - Object.setPrototypeOf(apply, proto); - return apply - } - ) - ); - -const own$5 = {}.hasOwnProperty; -class Processor extends CallableInstance { - constructor() { - super('copy'); - this.Compiler = undefined; - this.Parser = undefined; - this.attachers = []; - this.compiler = undefined; - this.freezeIndex = -1; - this.frozen = undefined; - this.namespace = {}; - this.parser = undefined; - this.transformers = trough(); - } - copy() { - const destination = - ( - new Processor() - ); - let index = -1; - while (++index < this.attachers.length) { - const attacher = this.attachers[index]; - destination.use(...attacher); - } - destination.data(extend$1(true, {}, this.namespace)); - return destination - } - data(key, value) { - if (typeof key === 'string') { - if (arguments.length === 2) { - assertUnfrozen('data', this.frozen); - this.namespace[key] = value; - return this - } - return (own$5.call(this.namespace, key) && this.namespace[key]) || undefined - } - if (key) { - assertUnfrozen('data', this.frozen); - this.namespace = key; - return this - } - return this.namespace - } - freeze() { - if (this.frozen) { - return this - } - const self = ( (this)); - while (++this.freezeIndex < this.attachers.length) { - const [attacher, ...options] = this.attachers[this.freezeIndex]; - if (options[0] === false) { - continue - } - if (options[0] === true) { - options[0] = undefined; - } - const transformer = attacher.call(self, ...options); - if (typeof transformer === 'function') { - this.transformers.use(transformer); - } - } - this.frozen = true; - this.freezeIndex = Number.POSITIVE_INFINITY; - return this - } - parse(file) { - this.freeze(); - const realFile = vfile(file); - const parser = this.parser || this.Parser; - assertParser('parse', parser); - return parser(String(realFile), realFile) - } - process(file, done) { - const self = this; - this.freeze(); - assertParser('process', this.parser || this.Parser); - assertCompiler('process', this.compiler || this.Compiler); - return done ? executor(undefined, done) : new Promise(executor) - function executor(resolve, reject) { - const realFile = vfile(file); - const parseTree = - ( - (self.parse(realFile)) - ); - self.run(parseTree, realFile, function (error, tree, file) { - if (error || !tree || !file) { - return realDone(error) - } - const compileTree = - ( - (tree) - ); - const compileResult = self.stringify(compileTree, file); - if (looksLikeAValue(compileResult)) { - file.value = compileResult; - } else { - file.result = compileResult; - } - realDone(error, (file)); - }); - function realDone(error, file) { - if (error || !file) { - reject(error); - } else if (resolve) { - resolve(file); - } else { - done(undefined, file); - } - } - } - } - processSync(file) { - let complete = false; - let result; - this.freeze(); - assertParser('processSync', this.parser || this.Parser); - assertCompiler('processSync', this.compiler || this.Compiler); - this.process(file, realDone); - assertDone('processSync', 'process', complete); - return result - function realDone(error, file) { - complete = true; - bail(error); - result = file; - } - } - run(tree, file, done) { - assertNode(tree); - this.freeze(); - const transformers = this.transformers; - if (!done && typeof file === 'function') { - done = file; - file = undefined; - } - return done ? executor(undefined, done) : new Promise(executor) - function executor(resolve, reject) { - const realFile = vfile(file); - transformers.run(tree, realFile, realDone); - function realDone(error, outputTree, file) { - const resultingTree = - ( - outputTree || tree - ); - if (error) { - reject(error); - } else if (resolve) { - resolve(resultingTree); - } else { - done(undefined, resultingTree, file); - } - } - } - } - runSync(tree, file) { - let complete = false; - let result; - this.run(tree, file, realDone); - assertDone('runSync', 'run', complete); - return result - function realDone(error, tree) { - bail(error); - result = tree; - complete = true; - } - } - stringify(tree, file) { - this.freeze(); - const realFile = vfile(file); - const compiler = this.compiler || this.Compiler; - assertCompiler('stringify', compiler); - assertNode(tree); - return compiler(tree, realFile) - } - use(value, ...parameters) { - const attachers = this.attachers; - const namespace = this.namespace; - assertUnfrozen('use', this.frozen); - if (value === null || value === undefined) ; else if (typeof value === 'function') { - addPlugin(value, parameters); - } else if (typeof value === 'object') { - if (Array.isArray(value)) { - addList(value); - } else { - addPreset(value); - } - } else { - throw new TypeError('Expected usable value, not `' + value + '`') - } - return this - function add(value) { - if (typeof value === 'function') { - addPlugin(value, []); - } else if (typeof value === 'object') { - if (Array.isArray(value)) { - const [plugin, ...parameters] = - (value); - addPlugin(plugin, parameters); - } else { - addPreset(value); - } - } else { - throw new TypeError('Expected usable value, not `' + value + '`') - } - } - function addPreset(result) { - if (!('plugins' in result) && !('settings' in result)) { - throw new Error( - 'Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither' - ) - } - addList(result.plugins); - if (result.settings) { - namespace.settings = extend$1(true, namespace.settings, result.settings); - } - } - function addList(plugins) { - let index = -1; - if (plugins === null || plugins === undefined) ; else if (Array.isArray(plugins)) { - while (++index < plugins.length) { - const thing = plugins[index]; - add(thing); - } - } else { - throw new TypeError('Expected a list of plugins, not `' + plugins + '`') - } - } - function addPlugin(plugin, parameters) { - let index = -1; - let entryIndex = -1; - while (++index < attachers.length) { - if (attachers[index][0] === plugin) { - entryIndex = index; - break - } - } - if (entryIndex === -1) { - attachers.push([plugin, ...parameters]); - } - else if (parameters.length > 0) { - let [primary, ...rest] = parameters; - const currentPrimary = attachers[entryIndex][1]; - if (isPlainObject(currentPrimary) && isPlainObject(primary)) { - primary = extend$1(true, currentPrimary, primary); - } - attachers[entryIndex] = [plugin, primary, ...rest]; - } - } - } -} -const unified = new Processor().freeze(); -function assertParser(name, value) { - if (typeof value !== 'function') { - throw new TypeError('Cannot `' + name + '` without `parser`') - } -} -function assertCompiler(name, value) { - if (typeof value !== 'function') { - throw new TypeError('Cannot `' + name + '` without `compiler`') - } -} -function assertUnfrozen(name, frozen) { - if (frozen) { - throw new Error( - 'Cannot call `' + - name + - '` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.' - ) - } -} -function assertNode(node) { - if (!isPlainObject(node) || typeof node.type !== 'string') { - throw new TypeError('Expected node, got `' + node + '`') - } -} -function assertDone(name, asyncName, complete) { - if (!complete) { - throw new Error( - '`' + name + '` finished async. Use `' + asyncName + '` instead' - ) - } -} -function vfile(value) { - return looksLikeAVFile$1(value) ? value : new VFile(value) -} -function looksLikeAVFile$1(value) { - return Boolean( - value && - typeof value === 'object' && - 'message' in value && - 'messages' in value - ) -} -function looksLikeAValue(value) { - return typeof value === 'string' || isUint8Array$1(value) -} -function isUint8Array$1(value) { - return Boolean( - value && - typeof value === 'object' && - 'byteLength' in value && - 'byteOffset' in value - ) -} - -const emptyOptions$2 = {}; -function toString(value, options) { - const settings = emptyOptions$2; - const includeImageAlt = - typeof settings.includeImageAlt === 'boolean' - ? settings.includeImageAlt - : true; - const includeHtml = - typeof settings.includeHtml === 'boolean' ? settings.includeHtml : true; - return one(value, includeImageAlt, includeHtml) -} -function one(value, includeImageAlt, includeHtml) { - if (node(value)) { - if ('value' in value) { - return value.type === 'html' && !includeHtml ? '' : value.value - } - if (includeImageAlt && 'alt' in value && value.alt) { - return value.alt - } - if ('children' in value) { - return all(value.children, includeImageAlt, includeHtml) - } - } - if (Array.isArray(value)) { - return all(value, includeImageAlt, includeHtml) - } - return '' -} -function all(values, includeImageAlt, includeHtml) { - const result = []; - let index = -1; - while (++index < values.length) { - result[index] = one(values[index], includeImageAlt, includeHtml); - } - return result.join('') -} -function node(value) { - return Boolean(value && typeof value === 'object') -} - -const characterEntities = { - AElig: 'Æ', - AMP: '&', - Aacute: 'Á', - Abreve: 'Ă', - Acirc: 'Â', - Acy: 'А', - Afr: '𝔄', - Agrave: 'À', - Alpha: 'Α', - Amacr: 'Ā', - And: '⩓', - Aogon: 'Ą', - Aopf: '𝔸', - ApplyFunction: '⁡', - Aring: 'Å', - Ascr: '𝒜', - Assign: '≔', - Atilde: 'Ã', - Auml: 'Ä', - Backslash: '∖', - Barv: '⫧', - Barwed: '⌆', - Bcy: 'Б', - Because: '∵', - Bernoullis: 'ℬ', - Beta: 'Β', - Bfr: '𝔅', - Bopf: '𝔹', - Breve: '˘', - Bscr: 'ℬ', - Bumpeq: '≎', - CHcy: 'Ч', - COPY: '©', - Cacute: 'Ć', - Cap: '⋒', - CapitalDifferentialD: 'ⅅ', - Cayleys: 'ℭ', - Ccaron: 'Č', - Ccedil: 'Ç', - Ccirc: 'Ĉ', - Cconint: '∰', - Cdot: 'Ċ', - Cedilla: '¸', - CenterDot: '·', - Cfr: 'ℭ', - Chi: 'Χ', - CircleDot: '⊙', - CircleMinus: '⊖', - CirclePlus: '⊕', - CircleTimes: '⊗', - ClockwiseContourIntegral: '∲', - CloseCurlyDoubleQuote: '”', - CloseCurlyQuote: '’', - Colon: '∷', - Colone: '⩴', - Congruent: '≡', - Conint: '∯', - ContourIntegral: '∮', - Copf: 'ℂ', - Coproduct: '∐', - CounterClockwiseContourIntegral: '∳', - Cross: '⨯', - Cscr: '𝒞', - Cup: '⋓', - CupCap: '≍', - DD: 'ⅅ', - DDotrahd: '⤑', - DJcy: 'Ђ', - DScy: 'Ѕ', - DZcy: 'Џ', - Dagger: '‡', - Darr: '↡', - Dashv: '⫤', - Dcaron: 'Ď', - Dcy: 'Д', - Del: '∇', - Delta: 'Δ', - Dfr: '𝔇', - DiacriticalAcute: '´', - DiacriticalDot: '˙', - DiacriticalDoubleAcute: '˝', - DiacriticalGrave: '`', - DiacriticalTilde: '˜', - Diamond: '⋄', - DifferentialD: 'ⅆ', - Dopf: '𝔻', - Dot: '¨', - DotDot: '⃜', - DotEqual: '≐', - DoubleContourIntegral: '∯', - DoubleDot: '¨', - DoubleDownArrow: '⇓', - DoubleLeftArrow: '⇐', - DoubleLeftRightArrow: '⇔', - DoubleLeftTee: '⫤', - DoubleLongLeftArrow: '⟸', - DoubleLongLeftRightArrow: '⟺', - DoubleLongRightArrow: '⟹', - DoubleRightArrow: '⇒', - DoubleRightTee: '⊨', - DoubleUpArrow: '⇑', - DoubleUpDownArrow: '⇕', - DoubleVerticalBar: '∥', - DownArrow: '↓', - DownArrowBar: '⤓', - DownArrowUpArrow: '⇵', - DownBreve: '̑', - DownLeftRightVector: '⥐', - DownLeftTeeVector: '⥞', - DownLeftVector: '↽', - DownLeftVectorBar: '⥖', - DownRightTeeVector: '⥟', - DownRightVector: '⇁', - DownRightVectorBar: '⥗', - DownTee: '⊤', - DownTeeArrow: '↧', - Downarrow: '⇓', - Dscr: '𝒟', - Dstrok: 'Đ', - ENG: 'Ŋ', - ETH: 'Ð', - Eacute: 'É', - Ecaron: 'Ě', - Ecirc: 'Ê', - Ecy: 'Э', - Edot: 'Ė', - Efr: '𝔈', - Egrave: 'È', - Element: '∈', - Emacr: 'Ē', - EmptySmallSquare: '◻', - EmptyVerySmallSquare: '▫', - Eogon: 'Ę', - Eopf: '𝔼', - Epsilon: 'Ε', - Equal: '⩵', - EqualTilde: '≂', - Equilibrium: '⇌', - Escr: 'ℰ', - Esim: '⩳', - Eta: 'Η', - Euml: 'Ë', - Exists: '∃', - ExponentialE: 'ⅇ', - Fcy: 'Ф', - Ffr: '𝔉', - FilledSmallSquare: '◼', - FilledVerySmallSquare: '▪', - Fopf: '𝔽', - ForAll: '∀', - Fouriertrf: 'ℱ', - Fscr: 'ℱ', - GJcy: 'Ѓ', - GT: '>', - Gamma: 'Γ', - Gammad: 'Ϝ', - Gbreve: 'Ğ', - Gcedil: 'Ģ', - Gcirc: 'Ĝ', - Gcy: 'Г', - Gdot: 'Ġ', - Gfr: '𝔊', - Gg: '⋙', - Gopf: '𝔾', - GreaterEqual: '≥', - GreaterEqualLess: '⋛', - GreaterFullEqual: '≧', - GreaterGreater: '⪢', - GreaterLess: '≷', - GreaterSlantEqual: '⩾', - GreaterTilde: '≳', - Gscr: '𝒢', - Gt: '≫', - HARDcy: 'Ъ', - Hacek: 'ˇ', - Hat: '^', - Hcirc: 'Ĥ', - Hfr: 'ℌ', - HilbertSpace: 'ℋ', - Hopf: 'ℍ', - HorizontalLine: '─', - Hscr: 'ℋ', - Hstrok: 'Ħ', - HumpDownHump: '≎', - HumpEqual: '≏', - IEcy: 'Е', - IJlig: 'IJ', - IOcy: 'Ё', - Iacute: 'Í', - Icirc: 'Î', - Icy: 'И', - Idot: 'İ', - Ifr: 'ℑ', - Igrave: 'Ì', - Im: 'ℑ', - Imacr: 'Ī', - ImaginaryI: 'ⅈ', - Implies: '⇒', - Int: '∬', - Integral: '∫', - Intersection: '⋂', - InvisibleComma: '⁣', - InvisibleTimes: '⁢', - Iogon: 'Į', - Iopf: '𝕀', - Iota: 'Ι', - Iscr: 'ℐ', - Itilde: 'Ĩ', - Iukcy: 'І', - Iuml: 'Ï', - Jcirc: 'Ĵ', - Jcy: 'Й', - Jfr: '𝔍', - Jopf: '𝕁', - Jscr: '𝒥', - Jsercy: 'Ј', - Jukcy: 'Є', - KHcy: 'Х', - KJcy: 'Ќ', - Kappa: 'Κ', - Kcedil: 'Ķ', - Kcy: 'К', - Kfr: '𝔎', - Kopf: '𝕂', - Kscr: '𝒦', - LJcy: 'Љ', - LT: '<', - Lacute: 'Ĺ', - Lambda: 'Λ', - Lang: '⟪', - Laplacetrf: 'ℒ', - Larr: '↞', - Lcaron: 'Ľ', - Lcedil: 'Ļ', - Lcy: 'Л', - LeftAngleBracket: '⟨', - LeftArrow: '←', - LeftArrowBar: '⇤', - LeftArrowRightArrow: '⇆', - LeftCeiling: '⌈', - LeftDoubleBracket: '⟦', - LeftDownTeeVector: '⥡', - LeftDownVector: '⇃', - LeftDownVectorBar: '⥙', - LeftFloor: '⌊', - LeftRightArrow: '↔', - LeftRightVector: '⥎', - LeftTee: '⊣', - LeftTeeArrow: '↤', - LeftTeeVector: '⥚', - LeftTriangle: '⊲', - LeftTriangleBar: '⧏', - LeftTriangleEqual: '⊴', - LeftUpDownVector: '⥑', - LeftUpTeeVector: '⥠', - LeftUpVector: '↿', - LeftUpVectorBar: '⥘', - LeftVector: '↼', - LeftVectorBar: '⥒', - Leftarrow: '⇐', - Leftrightarrow: '⇔', - LessEqualGreater: '⋚', - LessFullEqual: '≦', - LessGreater: '≶', - LessLess: '⪡', - LessSlantEqual: '⩽', - LessTilde: '≲', - Lfr: '𝔏', - Ll: '⋘', - Lleftarrow: '⇚', - Lmidot: 'Ŀ', - LongLeftArrow: '⟵', - LongLeftRightArrow: '⟷', - LongRightArrow: '⟶', - Longleftarrow: '⟸', - Longleftrightarrow: '⟺', - Longrightarrow: '⟹', - Lopf: '𝕃', - LowerLeftArrow: '↙', - LowerRightArrow: '↘', - Lscr: 'ℒ', - Lsh: '↰', - Lstrok: 'Ł', - Lt: '≪', - Map: '⤅', - Mcy: 'М', - MediumSpace: ' ', - Mellintrf: 'ℳ', - Mfr: '𝔐', - MinusPlus: '∓', - Mopf: '𝕄', - Mscr: 'ℳ', - Mu: 'Μ', - NJcy: 'Њ', - Nacute: 'Ń', - Ncaron: 'Ň', - Ncedil: 'Ņ', - Ncy: 'Н', - NegativeMediumSpace: '​', - NegativeThickSpace: '​', - NegativeThinSpace: '​', - NegativeVeryThinSpace: '​', - NestedGreaterGreater: '≫', - NestedLessLess: '≪', - NewLine: '\n', - Nfr: '𝔑', - NoBreak: '⁠', - NonBreakingSpace: ' ', - Nopf: 'ℕ', - Not: '⫬', - NotCongruent: '≢', - NotCupCap: '≭', - NotDoubleVerticalBar: '∦', - NotElement: '∉', - NotEqual: '≠', - NotEqualTilde: '≂̸', - NotExists: '∄', - NotGreater: '≯', - NotGreaterEqual: '≱', - NotGreaterFullEqual: '≧̸', - NotGreaterGreater: '≫̸', - NotGreaterLess: '≹', - NotGreaterSlantEqual: '⩾̸', - NotGreaterTilde: '≵', - NotHumpDownHump: '≎̸', - NotHumpEqual: '≏̸', - NotLeftTriangle: '⋪', - NotLeftTriangleBar: '⧏̸', - NotLeftTriangleEqual: '⋬', - NotLess: '≮', - NotLessEqual: '≰', - NotLessGreater: '≸', - NotLessLess: '≪̸', - NotLessSlantEqual: '⩽̸', - NotLessTilde: '≴', - NotNestedGreaterGreater: '⪢̸', - NotNestedLessLess: '⪡̸', - NotPrecedes: '⊀', - NotPrecedesEqual: '⪯̸', - NotPrecedesSlantEqual: '⋠', - NotReverseElement: '∌', - NotRightTriangle: '⋫', - NotRightTriangleBar: '⧐̸', - NotRightTriangleEqual: '⋭', - NotSquareSubset: '⊏̸', - NotSquareSubsetEqual: '⋢', - NotSquareSuperset: '⊐̸', - NotSquareSupersetEqual: '⋣', - NotSubset: '⊂⃒', - NotSubsetEqual: '⊈', - NotSucceeds: '⊁', - NotSucceedsEqual: '⪰̸', - NotSucceedsSlantEqual: '⋡', - NotSucceedsTilde: '≿̸', - NotSuperset: '⊃⃒', - NotSupersetEqual: '⊉', - NotTilde: '≁', - NotTildeEqual: '≄', - NotTildeFullEqual: '≇', - NotTildeTilde: '≉', - NotVerticalBar: '∤', - Nscr: '𝒩', - Ntilde: 'Ñ', - Nu: 'Ν', - OElig: 'Œ', - Oacute: 'Ó', - Ocirc: 'Ô', - Ocy: 'О', - Odblac: 'Ő', - Ofr: '𝔒', - Ograve: 'Ò', - Omacr: 'Ō', - Omega: 'Ω', - Omicron: 'Ο', - Oopf: '𝕆', - OpenCurlyDoubleQuote: '“', - OpenCurlyQuote: '‘', - Or: '⩔', - Oscr: '𝒪', - Oslash: 'Ø', - Otilde: 'Õ', - Otimes: '⨷', - Ouml: 'Ö', - OverBar: '‾', - OverBrace: '⏞', - OverBracket: '⎴', - OverParenthesis: '⏜', - PartialD: '∂', - Pcy: 'П', - Pfr: '𝔓', - Phi: 'Φ', - Pi: 'Π', - PlusMinus: '±', - Poincareplane: 'ℌ', - Popf: 'ℙ', - Pr: '⪻', - Precedes: '≺', - PrecedesEqual: '⪯', - PrecedesSlantEqual: '≼', - PrecedesTilde: '≾', - Prime: '″', - Product: '∏', - Proportion: '∷', - Proportional: '∝', - Pscr: '𝒫', - Psi: 'Ψ', - QUOT: '"', - Qfr: '𝔔', - Qopf: 'ℚ', - Qscr: '𝒬', - RBarr: '⤐', - REG: '®', - Racute: 'Ŕ', - Rang: '⟫', - Rarr: '↠', - Rarrtl: '⤖', - Rcaron: 'Ř', - Rcedil: 'Ŗ', - Rcy: 'Р', - Re: 'ℜ', - ReverseElement: '∋', - ReverseEquilibrium: '⇋', - ReverseUpEquilibrium: '⥯', - Rfr: 'ℜ', - Rho: 'Ρ', - RightAngleBracket: '⟩', - RightArrow: '→', - RightArrowBar: '⇥', - RightArrowLeftArrow: '⇄', - RightCeiling: '⌉', - RightDoubleBracket: '⟧', - RightDownTeeVector: '⥝', - RightDownVector: '⇂', - RightDownVectorBar: '⥕', - RightFloor: '⌋', - RightTee: '⊢', - RightTeeArrow: '↦', - RightTeeVector: '⥛', - RightTriangle: '⊳', - RightTriangleBar: '⧐', - RightTriangleEqual: '⊵', - RightUpDownVector: '⥏', - RightUpTeeVector: '⥜', - RightUpVector: '↾', - RightUpVectorBar: '⥔', - RightVector: '⇀', - RightVectorBar: '⥓', - Rightarrow: '⇒', - Ropf: 'ℝ', - RoundImplies: '⥰', - Rrightarrow: '⇛', - Rscr: 'ℛ', - Rsh: '↱', - RuleDelayed: '⧴', - SHCHcy: 'Щ', - SHcy: 'Ш', - SOFTcy: 'Ь', - Sacute: 'Ś', - Sc: '⪼', - Scaron: 'Š', - Scedil: 'Ş', - Scirc: 'Ŝ', - Scy: 'С', - Sfr: '𝔖', - ShortDownArrow: '↓', - ShortLeftArrow: '←', - ShortRightArrow: '→', - ShortUpArrow: '↑', - Sigma: 'Σ', - SmallCircle: '∘', - Sopf: '𝕊', - Sqrt: '√', - Square: '□', - SquareIntersection: '⊓', - SquareSubset: '⊏', - SquareSubsetEqual: '⊑', - SquareSuperset: '⊐', - SquareSupersetEqual: '⊒', - SquareUnion: '⊔', - Sscr: '𝒮', - Star: '⋆', - Sub: '⋐', - Subset: '⋐', - SubsetEqual: '⊆', - Succeeds: '≻', - SucceedsEqual: '⪰', - SucceedsSlantEqual: '≽', - SucceedsTilde: '≿', - SuchThat: '∋', - Sum: '∑', - Sup: '⋑', - Superset: '⊃', - SupersetEqual: '⊇', - Supset: '⋑', - THORN: 'Þ', - TRADE: '™', - TSHcy: 'Ћ', - TScy: 'Ц', - Tab: '\t', - Tau: 'Τ', - Tcaron: 'Ť', - Tcedil: 'Ţ', - Tcy: 'Т', - Tfr: '𝔗', - Therefore: '∴', - Theta: 'Θ', - ThickSpace: '  ', - ThinSpace: ' ', - Tilde: '∼', - TildeEqual: '≃', - TildeFullEqual: '≅', - TildeTilde: '≈', - Topf: '𝕋', - TripleDot: '⃛', - Tscr: '𝒯', - Tstrok: 'Ŧ', - Uacute: 'Ú', - Uarr: '↟', - Uarrocir: '⥉', - Ubrcy: 'Ў', - Ubreve: 'Ŭ', - Ucirc: 'Û', - Ucy: 'У', - Udblac: 'Ű', - Ufr: '𝔘', - Ugrave: 'Ù', - Umacr: 'Ū', - UnderBar: '_', - UnderBrace: '⏟', - UnderBracket: '⎵', - UnderParenthesis: '⏝', - Union: '⋃', - UnionPlus: '⊎', - Uogon: 'Ų', - Uopf: '𝕌', - UpArrow: '↑', - UpArrowBar: '⤒', - UpArrowDownArrow: '⇅', - UpDownArrow: '↕', - UpEquilibrium: '⥮', - UpTee: '⊥', - UpTeeArrow: '↥', - Uparrow: '⇑', - Updownarrow: '⇕', - UpperLeftArrow: '↖', - UpperRightArrow: '↗', - Upsi: 'ϒ', - Upsilon: 'Υ', - Uring: 'Ů', - Uscr: '𝒰', - Utilde: 'Ũ', - Uuml: 'Ü', - VDash: '⊫', - Vbar: '⫫', - Vcy: 'В', - Vdash: '⊩', - Vdashl: '⫦', - Vee: '⋁', - Verbar: '‖', - Vert: '‖', - VerticalBar: '∣', - VerticalLine: '|', - VerticalSeparator: '❘', - VerticalTilde: '≀', - VeryThinSpace: ' ', - Vfr: '𝔙', - Vopf: '𝕍', - Vscr: '𝒱', - Vvdash: '⊪', - Wcirc: 'Ŵ', - Wedge: '⋀', - Wfr: '𝔚', - Wopf: '𝕎', - Wscr: '𝒲', - Xfr: '𝔛', - Xi: 'Ξ', - Xopf: '𝕏', - Xscr: '𝒳', - YAcy: 'Я', - YIcy: 'Ї', - YUcy: 'Ю', - Yacute: 'Ý', - Ycirc: 'Ŷ', - Ycy: 'Ы', - Yfr: '𝔜', - Yopf: '𝕐', - Yscr: '𝒴', - Yuml: 'Ÿ', - ZHcy: 'Ж', - Zacute: 'Ź', - Zcaron: 'Ž', - Zcy: 'З', - Zdot: 'Ż', - ZeroWidthSpace: '​', - Zeta: 'Ζ', - Zfr: 'ℨ', - Zopf: 'ℤ', - Zscr: '𝒵', - aacute: 'á', - abreve: 'ă', - ac: '∾', - acE: '∾̳', - acd: '∿', - acirc: 'â', - acute: '´', - acy: 'а', - aelig: 'æ', - af: '⁡', - afr: '𝔞', - agrave: 'à', - alefsym: 'ℵ', - aleph: 'ℵ', - alpha: 'α', - amacr: 'ā', - amalg: '⨿', - amp: '&', - and: '∧', - andand: '⩕', - andd: '⩜', - andslope: '⩘', - andv: '⩚', - ang: '∠', - ange: '⦤', - angle: '∠', - angmsd: '∡', - angmsdaa: '⦨', - angmsdab: '⦩', - angmsdac: '⦪', - angmsdad: '⦫', - angmsdae: '⦬', - angmsdaf: '⦭', - angmsdag: '⦮', - angmsdah: '⦯', - angrt: '∟', - angrtvb: '⊾', - angrtvbd: '⦝', - angsph: '∢', - angst: 'Å', - angzarr: '⍼', - aogon: 'ą', - aopf: '𝕒', - ap: '≈', - apE: '⩰', - apacir: '⩯', - ape: '≊', - apid: '≋', - apos: "'", - approx: '≈', - approxeq: '≊', - aring: 'å', - ascr: '𝒶', - ast: '*', - asymp: '≈', - asympeq: '≍', - atilde: 'ã', - auml: 'ä', - awconint: '∳', - awint: '⨑', - bNot: '⫭', - backcong: '≌', - backepsilon: '϶', - backprime: '‵', - backsim: '∽', - backsimeq: '⋍', - barvee: '⊽', - barwed: '⌅', - barwedge: '⌅', - bbrk: '⎵', - bbrktbrk: '⎶', - bcong: '≌', - bcy: 'б', - bdquo: '„', - becaus: '∵', - because: '∵', - bemptyv: '⦰', - bepsi: '϶', - bernou: 'ℬ', - beta: 'β', - beth: 'ℶ', - between: '≬', - bfr: '𝔟', - bigcap: '⋂', - bigcirc: '◯', - bigcup: '⋃', - bigodot: '⨀', - bigoplus: '⨁', - bigotimes: '⨂', - bigsqcup: '⨆', - bigstar: '★', - bigtriangledown: '▽', - bigtriangleup: '△', - biguplus: '⨄', - bigvee: '⋁', - bigwedge: '⋀', - bkarow: '⤍', - blacklozenge: '⧫', - blacksquare: '▪', - blacktriangle: '▴', - blacktriangledown: '▾', - blacktriangleleft: '◂', - blacktriangleright: '▸', - blank: '␣', - blk12: '▒', - blk14: '░', - blk34: '▓', - block: '█', - bne: '=⃥', - bnequiv: '≡⃥', - bnot: '⌐', - bopf: '𝕓', - bot: '⊥', - bottom: '⊥', - bowtie: '⋈', - boxDL: '╗', - boxDR: '╔', - boxDl: '╖', - boxDr: '╓', - boxH: '═', - boxHD: '╦', - boxHU: '╩', - boxHd: '╤', - boxHu: '╧', - boxUL: '╝', - boxUR: '╚', - boxUl: '╜', - boxUr: '╙', - boxV: '║', - boxVH: '╬', - boxVL: '╣', - boxVR: '╠', - boxVh: '╫', - boxVl: '╢', - boxVr: '╟', - boxbox: '⧉', - boxdL: '╕', - boxdR: '╒', - boxdl: '┐', - boxdr: '┌', - boxh: '─', - boxhD: '╥', - boxhU: '╨', - boxhd: '┬', - boxhu: '┴', - boxminus: '⊟', - boxplus: '⊞', - boxtimes: '⊠', - boxuL: '╛', - boxuR: '╘', - boxul: '┘', - boxur: '└', - boxv: '│', - boxvH: '╪', - boxvL: '╡', - boxvR: '╞', - boxvh: '┼', - boxvl: '┤', - boxvr: '├', - bprime: '‵', - breve: '˘', - brvbar: '¦', - bscr: '𝒷', - bsemi: '⁏', - bsim: '∽', - bsime: '⋍', - bsol: '\\', - bsolb: '⧅', - bsolhsub: '⟈', - bull: '•', - bullet: '•', - bump: '≎', - bumpE: '⪮', - bumpe: '≏', - bumpeq: '≏', - cacute: 'ć', - cap: '∩', - capand: '⩄', - capbrcup: '⩉', - capcap: '⩋', - capcup: '⩇', - capdot: '⩀', - caps: '∩︀', - caret: '⁁', - caron: 'ˇ', - ccaps: '⩍', - ccaron: 'č', - ccedil: 'ç', - ccirc: 'ĉ', - ccups: '⩌', - ccupssm: '⩐', - cdot: 'ċ', - cedil: '¸', - cemptyv: '⦲', - cent: '¢', - centerdot: '·', - cfr: '𝔠', - chcy: 'ч', - check: '✓', - checkmark: '✓', - chi: 'χ', - cir: '○', - cirE: '⧃', - circ: 'ˆ', - circeq: '≗', - circlearrowleft: '↺', - circlearrowright: '↻', - circledR: '®', - circledS: 'Ⓢ', - circledast: '⊛', - circledcirc: '⊚', - circleddash: '⊝', - cire: '≗', - cirfnint: '⨐', - cirmid: '⫯', - cirscir: '⧂', - clubs: '♣', - clubsuit: '♣', - colon: ':', - colone: '≔', - coloneq: '≔', - comma: ',', - commat: '@', - comp: '∁', - compfn: '∘', - complement: '∁', - complexes: 'ℂ', - cong: '≅', - congdot: '⩭', - conint: '∮', - copf: '𝕔', - coprod: '∐', - copy: '©', - copysr: '℗', - crarr: '↵', - cross: '✗', - cscr: '𝒸', - csub: '⫏', - csube: '⫑', - csup: '⫐', - csupe: '⫒', - ctdot: '⋯', - cudarrl: '⤸', - cudarrr: '⤵', - cuepr: '⋞', - cuesc: '⋟', - cularr: '↶', - cularrp: '⤽', - cup: '∪', - cupbrcap: '⩈', - cupcap: '⩆', - cupcup: '⩊', - cupdot: '⊍', - cupor: '⩅', - cups: '∪︀', - curarr: '↷', - curarrm: '⤼', - curlyeqprec: '⋞', - curlyeqsucc: '⋟', - curlyvee: '⋎', - curlywedge: '⋏', - curren: '¤', - curvearrowleft: '↶', - curvearrowright: '↷', - cuvee: '⋎', - cuwed: '⋏', - cwconint: '∲', - cwint: '∱', - cylcty: '⌭', - dArr: '⇓', - dHar: '⥥', - dagger: '†', - daleth: 'ℸ', - darr: '↓', - dash: '‐', - dashv: '⊣', - dbkarow: '⤏', - dblac: '˝', - dcaron: 'ď', - dcy: 'д', - dd: 'ⅆ', - ddagger: '‡', - ddarr: '⇊', - ddotseq: '⩷', - deg: '°', - delta: 'δ', - demptyv: '⦱', - dfisht: '⥿', - dfr: '𝔡', - dharl: '⇃', - dharr: '⇂', - diam: '⋄', - diamond: '⋄', - diamondsuit: '♦', - diams: '♦', - die: '¨', - digamma: 'ϝ', - disin: '⋲', - div: '÷', - divide: '÷', - divideontimes: '⋇', - divonx: '⋇', - djcy: 'ђ', - dlcorn: '⌞', - dlcrop: '⌍', - dollar: '$', - dopf: '𝕕', - dot: '˙', - doteq: '≐', - doteqdot: '≑', - dotminus: '∸', - dotplus: '∔', - dotsquare: '⊡', - doublebarwedge: '⌆', - downarrow: '↓', - downdownarrows: '⇊', - downharpoonleft: '⇃', - downharpoonright: '⇂', - drbkarow: '⤐', - drcorn: '⌟', - drcrop: '⌌', - dscr: '𝒹', - dscy: 'ѕ', - dsol: '⧶', - dstrok: 'đ', - dtdot: '⋱', - dtri: '▿', - dtrif: '▾', - duarr: '⇵', - duhar: '⥯', - dwangle: '⦦', - dzcy: 'џ', - dzigrarr: '⟿', - eDDot: '⩷', - eDot: '≑', - eacute: 'é', - easter: '⩮', - ecaron: 'ě', - ecir: '≖', - ecirc: 'ê', - ecolon: '≕', - ecy: 'э', - edot: 'ė', - ee: 'ⅇ', - efDot: '≒', - efr: '𝔢', - eg: '⪚', - egrave: 'è', - egs: '⪖', - egsdot: '⪘', - el: '⪙', - elinters: '⏧', - ell: 'ℓ', - els: '⪕', - elsdot: '⪗', - emacr: 'ē', - empty: '∅', - emptyset: '∅', - emptyv: '∅', - emsp13: ' ', - emsp14: ' ', - emsp: ' ', - eng: 'ŋ', - ensp: ' ', - eogon: 'ę', - eopf: '𝕖', - epar: '⋕', - eparsl: '⧣', - eplus: '⩱', - epsi: 'ε', - epsilon: 'ε', - epsiv: 'ϵ', - eqcirc: '≖', - eqcolon: '≕', - eqsim: '≂', - eqslantgtr: '⪖', - eqslantless: '⪕', - equals: '=', - equest: '≟', - equiv: '≡', - equivDD: '⩸', - eqvparsl: '⧥', - erDot: '≓', - erarr: '⥱', - escr: 'ℯ', - esdot: '≐', - esim: '≂', - eta: 'η', - eth: 'ð', - euml: 'ë', - euro: '€', - excl: '!', - exist: '∃', - expectation: 'ℰ', - exponentiale: 'ⅇ', - fallingdotseq: '≒', - fcy: 'ф', - female: '♀', - ffilig: 'ffi', - fflig: 'ff', - ffllig: 'ffl', - ffr: '𝔣', - filig: 'fi', - fjlig: 'fj', - flat: '♭', - fllig: 'fl', - fltns: '▱', - fnof: 'ƒ', - fopf: '𝕗', - forall: '∀', - fork: '⋔', - forkv: '⫙', - fpartint: '⨍', - frac12: '½', - frac13: '⅓', - frac14: '¼', - frac15: '⅕', - frac16: '⅙', - frac18: '⅛', - frac23: '⅔', - frac25: '⅖', - frac34: '¾', - frac35: '⅗', - frac38: '⅜', - frac45: '⅘', - frac56: '⅚', - frac58: '⅝', - frac78: '⅞', - frasl: '⁄', - frown: '⌢', - fscr: '𝒻', - gE: '≧', - gEl: '⪌', - gacute: 'ǵ', - gamma: 'γ', - gammad: 'ϝ', - gap: '⪆', - gbreve: 'ğ', - gcirc: 'ĝ', - gcy: 'г', - gdot: 'ġ', - ge: '≥', - gel: '⋛', - geq: '≥', - geqq: '≧', - geqslant: '⩾', - ges: '⩾', - gescc: '⪩', - gesdot: '⪀', - gesdoto: '⪂', - gesdotol: '⪄', - gesl: '⋛︀', - gesles: '⪔', - gfr: '𝔤', - gg: '≫', - ggg: '⋙', - gimel: 'ℷ', - gjcy: 'ѓ', - gl: '≷', - glE: '⪒', - gla: '⪥', - glj: '⪤', - gnE: '≩', - gnap: '⪊', - gnapprox: '⪊', - gne: '⪈', - gneq: '⪈', - gneqq: '≩', - gnsim: '⋧', - gopf: '𝕘', - grave: '`', - gscr: 'ℊ', - gsim: '≳', - gsime: '⪎', - gsiml: '⪐', - gt: '>', - gtcc: '⪧', - gtcir: '⩺', - gtdot: '⋗', - gtlPar: '⦕', - gtquest: '⩼', - gtrapprox: '⪆', - gtrarr: '⥸', - gtrdot: '⋗', - gtreqless: '⋛', - gtreqqless: '⪌', - gtrless: '≷', - gtrsim: '≳', - gvertneqq: '≩︀', - gvnE: '≩︀', - hArr: '⇔', - hairsp: ' ', - half: '½', - hamilt: 'ℋ', - hardcy: 'ъ', - harr: '↔', - harrcir: '⥈', - harrw: '↭', - hbar: 'ℏ', - hcirc: 'ĥ', - hearts: '♥', - heartsuit: '♥', - hellip: '…', - hercon: '⊹', - hfr: '𝔥', - hksearow: '⤥', - hkswarow: '⤦', - hoarr: '⇿', - homtht: '∻', - hookleftarrow: '↩', - hookrightarrow: '↪', - hopf: '𝕙', - horbar: '―', - hscr: '𝒽', - hslash: 'ℏ', - hstrok: 'ħ', - hybull: '⁃', - hyphen: '‐', - iacute: 'í', - ic: '⁣', - icirc: 'î', - icy: 'и', - iecy: 'е', - iexcl: '¡', - iff: '⇔', - ifr: '𝔦', - igrave: 'ì', - ii: 'ⅈ', - iiiint: '⨌', - iiint: '∭', - iinfin: '⧜', - iiota: '℩', - ijlig: 'ij', - imacr: 'ī', - image: 'ℑ', - imagline: 'ℐ', - imagpart: 'ℑ', - imath: 'ı', - imof: '⊷', - imped: 'Ƶ', - in: '∈', - incare: '℅', - infin: '∞', - infintie: '⧝', - inodot: 'ı', - int: '∫', - intcal: '⊺', - integers: 'ℤ', - intercal: '⊺', - intlarhk: '⨗', - intprod: '⨼', - iocy: 'ё', - iogon: 'į', - iopf: '𝕚', - iota: 'ι', - iprod: '⨼', - iquest: '¿', - iscr: '𝒾', - isin: '∈', - isinE: '⋹', - isindot: '⋵', - isins: '⋴', - isinsv: '⋳', - isinv: '∈', - it: '⁢', - itilde: 'ĩ', - iukcy: 'і', - iuml: 'ï', - jcirc: 'ĵ', - jcy: 'й', - jfr: '𝔧', - jmath: 'ȷ', - jopf: '𝕛', - jscr: '𝒿', - jsercy: 'ј', - jukcy: 'є', - kappa: 'κ', - kappav: 'ϰ', - kcedil: 'ķ', - kcy: 'к', - kfr: '𝔨', - kgreen: 'ĸ', - khcy: 'х', - kjcy: 'ќ', - kopf: '𝕜', - kscr: '𝓀', - lAarr: '⇚', - lArr: '⇐', - lAtail: '⤛', - lBarr: '⤎', - lE: '≦', - lEg: '⪋', - lHar: '⥢', - lacute: 'ĺ', - laemptyv: '⦴', - lagran: 'ℒ', - lambda: 'λ', - lang: '⟨', - langd: '⦑', - langle: '⟨', - lap: '⪅', - laquo: '«', - larr: '←', - larrb: '⇤', - larrbfs: '⤟', - larrfs: '⤝', - larrhk: '↩', - larrlp: '↫', - larrpl: '⤹', - larrsim: '⥳', - larrtl: '↢', - lat: '⪫', - latail: '⤙', - late: '⪭', - lates: '⪭︀', - lbarr: '⤌', - lbbrk: '❲', - lbrace: '{', - lbrack: '[', - lbrke: '⦋', - lbrksld: '⦏', - lbrkslu: '⦍', - lcaron: 'ľ', - lcedil: 'ļ', - lceil: '⌈', - lcub: '{', - lcy: 'л', - ldca: '⤶', - ldquo: '“', - ldquor: '„', - ldrdhar: '⥧', - ldrushar: '⥋', - ldsh: '↲', - le: '≤', - leftarrow: '←', - leftarrowtail: '↢', - leftharpoondown: '↽', - leftharpoonup: '↼', - leftleftarrows: '⇇', - leftrightarrow: '↔', - leftrightarrows: '⇆', - leftrightharpoons: '⇋', - leftrightsquigarrow: '↭', - leftthreetimes: '⋋', - leg: '⋚', - leq: '≤', - leqq: '≦', - leqslant: '⩽', - les: '⩽', - lescc: '⪨', - lesdot: '⩿', - lesdoto: '⪁', - lesdotor: '⪃', - lesg: '⋚︀', - lesges: '⪓', - lessapprox: '⪅', - lessdot: '⋖', - lesseqgtr: '⋚', - lesseqqgtr: '⪋', - lessgtr: '≶', - lesssim: '≲', - lfisht: '⥼', - lfloor: '⌊', - lfr: '𝔩', - lg: '≶', - lgE: '⪑', - lhard: '↽', - lharu: '↼', - lharul: '⥪', - lhblk: '▄', - ljcy: 'љ', - ll: '≪', - llarr: '⇇', - llcorner: '⌞', - llhard: '⥫', - lltri: '◺', - lmidot: 'ŀ', - lmoust: '⎰', - lmoustache: '⎰', - lnE: '≨', - lnap: '⪉', - lnapprox: '⪉', - lne: '⪇', - lneq: '⪇', - lneqq: '≨', - lnsim: '⋦', - loang: '⟬', - loarr: '⇽', - lobrk: '⟦', - longleftarrow: '⟵', - longleftrightarrow: '⟷', - longmapsto: '⟼', - longrightarrow: '⟶', - looparrowleft: '↫', - looparrowright: '↬', - lopar: '⦅', - lopf: '𝕝', - loplus: '⨭', - lotimes: '⨴', - lowast: '∗', - lowbar: '_', - loz: '◊', - lozenge: '◊', - lozf: '⧫', - lpar: '(', - lparlt: '⦓', - lrarr: '⇆', - lrcorner: '⌟', - lrhar: '⇋', - lrhard: '⥭', - lrm: '‎', - lrtri: '⊿', - lsaquo: '‹', - lscr: '𝓁', - lsh: '↰', - lsim: '≲', - lsime: '⪍', - lsimg: '⪏', - lsqb: '[', - lsquo: '‘', - lsquor: '‚', - lstrok: 'ł', - lt: '<', - ltcc: '⪦', - ltcir: '⩹', - ltdot: '⋖', - lthree: '⋋', - ltimes: '⋉', - ltlarr: '⥶', - ltquest: '⩻', - ltrPar: '⦖', - ltri: '◃', - ltrie: '⊴', - ltrif: '◂', - lurdshar: '⥊', - luruhar: '⥦', - lvertneqq: '≨︀', - lvnE: '≨︀', - mDDot: '∺', - macr: '¯', - male: '♂', - malt: '✠', - maltese: '✠', - map: '↦', - mapsto: '↦', - mapstodown: '↧', - mapstoleft: '↤', - mapstoup: '↥', - marker: '▮', - mcomma: '⨩', - mcy: 'м', - mdash: '—', - measuredangle: '∡', - mfr: '𝔪', - mho: '℧', - micro: 'µ', - mid: '∣', - midast: '*', - midcir: '⫰', - middot: '·', - minus: '−', - minusb: '⊟', - minusd: '∸', - minusdu: '⨪', - mlcp: '⫛', - mldr: '…', - mnplus: '∓', - models: '⊧', - mopf: '𝕞', - mp: '∓', - mscr: '𝓂', - mstpos: '∾', - mu: 'μ', - multimap: '⊸', - mumap: '⊸', - nGg: '⋙̸', - nGt: '≫⃒', - nGtv: '≫̸', - nLeftarrow: '⇍', - nLeftrightarrow: '⇎', - nLl: '⋘̸', - nLt: '≪⃒', - nLtv: '≪̸', - nRightarrow: '⇏', - nVDash: '⊯', - nVdash: '⊮', - nabla: '∇', - nacute: 'ń', - nang: '∠⃒', - nap: '≉', - napE: '⩰̸', - napid: '≋̸', - napos: 'ʼn', - napprox: '≉', - natur: '♮', - natural: '♮', - naturals: 'ℕ', - nbsp: ' ', - nbump: '≎̸', - nbumpe: '≏̸', - ncap: '⩃', - ncaron: 'ň', - ncedil: 'ņ', - ncong: '≇', - ncongdot: '⩭̸', - ncup: '⩂', - ncy: 'н', - ndash: '–', - ne: '≠', - neArr: '⇗', - nearhk: '⤤', - nearr: '↗', - nearrow: '↗', - nedot: '≐̸', - nequiv: '≢', - nesear: '⤨', - nesim: '≂̸', - nexist: '∄', - nexists: '∄', - nfr: '𝔫', - ngE: '≧̸', - nge: '≱', - ngeq: '≱', - ngeqq: '≧̸', - ngeqslant: '⩾̸', - nges: '⩾̸', - ngsim: '≵', - ngt: '≯', - ngtr: '≯', - nhArr: '⇎', - nharr: '↮', - nhpar: '⫲', - ni: '∋', - nis: '⋼', - nisd: '⋺', - niv: '∋', - njcy: 'њ', - nlArr: '⇍', - nlE: '≦̸', - nlarr: '↚', - nldr: '‥', - nle: '≰', - nleftarrow: '↚', - nleftrightarrow: '↮', - nleq: '≰', - nleqq: '≦̸', - nleqslant: '⩽̸', - nles: '⩽̸', - nless: '≮', - nlsim: '≴', - nlt: '≮', - nltri: '⋪', - nltrie: '⋬', - nmid: '∤', - nopf: '𝕟', - not: '¬', - notin: '∉', - notinE: '⋹̸', - notindot: '⋵̸', - notinva: '∉', - notinvb: '⋷', - notinvc: '⋶', - notni: '∌', - notniva: '∌', - notnivb: '⋾', - notnivc: '⋽', - npar: '∦', - nparallel: '∦', - nparsl: '⫽⃥', - npart: '∂̸', - npolint: '⨔', - npr: '⊀', - nprcue: '⋠', - npre: '⪯̸', - nprec: '⊀', - npreceq: '⪯̸', - nrArr: '⇏', - nrarr: '↛', - nrarrc: '⤳̸', - nrarrw: '↝̸', - nrightarrow: '↛', - nrtri: '⋫', - nrtrie: '⋭', - nsc: '⊁', - nsccue: '⋡', - nsce: '⪰̸', - nscr: '𝓃', - nshortmid: '∤', - nshortparallel: '∦', - nsim: '≁', - nsime: '≄', - nsimeq: '≄', - nsmid: '∤', - nspar: '∦', - nsqsube: '⋢', - nsqsupe: '⋣', - nsub: '⊄', - nsubE: '⫅̸', - nsube: '⊈', - nsubset: '⊂⃒', - nsubseteq: '⊈', - nsubseteqq: '⫅̸', - nsucc: '⊁', - nsucceq: '⪰̸', - nsup: '⊅', - nsupE: '⫆̸', - nsupe: '⊉', - nsupset: '⊃⃒', - nsupseteq: '⊉', - nsupseteqq: '⫆̸', - ntgl: '≹', - ntilde: 'ñ', - ntlg: '≸', - ntriangleleft: '⋪', - ntrianglelefteq: '⋬', - ntriangleright: '⋫', - ntrianglerighteq: '⋭', - nu: 'ν', - num: '#', - numero: '№', - numsp: ' ', - nvDash: '⊭', - nvHarr: '⤄', - nvap: '≍⃒', - nvdash: '⊬', - nvge: '≥⃒', - nvgt: '>⃒', - nvinfin: '⧞', - nvlArr: '⤂', - nvle: '≤⃒', - nvlt: '<⃒', - nvltrie: '⊴⃒', - nvrArr: '⤃', - nvrtrie: '⊵⃒', - nvsim: '∼⃒', - nwArr: '⇖', - nwarhk: '⤣', - nwarr: '↖', - nwarrow: '↖', - nwnear: '⤧', - oS: 'Ⓢ', - oacute: 'ó', - oast: '⊛', - ocir: '⊚', - ocirc: 'ô', - ocy: 'о', - odash: '⊝', - odblac: 'ő', - odiv: '⨸', - odot: '⊙', - odsold: '⦼', - oelig: 'œ', - ofcir: '⦿', - ofr: '𝔬', - ogon: '˛', - ograve: 'ò', - ogt: '⧁', - ohbar: '⦵', - ohm: 'Ω', - oint: '∮', - olarr: '↺', - olcir: '⦾', - olcross: '⦻', - oline: '‾', - olt: '⧀', - omacr: 'ō', - omega: 'ω', - omicron: 'ο', - omid: '⦶', - ominus: '⊖', - oopf: '𝕠', - opar: '⦷', - operp: '⦹', - oplus: '⊕', - or: '∨', - orarr: '↻', - ord: '⩝', - order: 'ℴ', - orderof: 'ℴ', - ordf: 'ª', - ordm: 'º', - origof: '⊶', - oror: '⩖', - orslope: '⩗', - orv: '⩛', - oscr: 'ℴ', - oslash: 'ø', - osol: '⊘', - otilde: 'õ', - otimes: '⊗', - otimesas: '⨶', - ouml: 'ö', - ovbar: '⌽', - par: '∥', - para: '¶', - parallel: '∥', - parsim: '⫳', - parsl: '⫽', - part: '∂', - pcy: 'п', - percnt: '%', - period: '.', - permil: '‰', - perp: '⊥', - pertenk: '‱', - pfr: '𝔭', - phi: 'φ', - phiv: 'ϕ', - phmmat: 'ℳ', - phone: '☎', - pi: 'π', - pitchfork: '⋔', - piv: 'ϖ', - planck: 'ℏ', - planckh: 'ℎ', - plankv: 'ℏ', - plus: '+', - plusacir: '⨣', - plusb: '⊞', - pluscir: '⨢', - plusdo: '∔', - plusdu: '⨥', - pluse: '⩲', - plusmn: '±', - plussim: '⨦', - plustwo: '⨧', - pm: '±', - pointint: '⨕', - popf: '𝕡', - pound: '£', - pr: '≺', - prE: '⪳', - prap: '⪷', - prcue: '≼', - pre: '⪯', - prec: '≺', - precapprox: '⪷', - preccurlyeq: '≼', - preceq: '⪯', - precnapprox: '⪹', - precneqq: '⪵', - precnsim: '⋨', - precsim: '≾', - prime: '′', - primes: 'ℙ', - prnE: '⪵', - prnap: '⪹', - prnsim: '⋨', - prod: '∏', - profalar: '⌮', - profline: '⌒', - profsurf: '⌓', - prop: '∝', - propto: '∝', - prsim: '≾', - prurel: '⊰', - pscr: '𝓅', - psi: 'ψ', - puncsp: ' ', - qfr: '𝔮', - qint: '⨌', - qopf: '𝕢', - qprime: '⁗', - qscr: '𝓆', - quaternions: 'ℍ', - quatint: '⨖', - quest: '?', - questeq: '≟', - quot: '"', - rAarr: '⇛', - rArr: '⇒', - rAtail: '⤜', - rBarr: '⤏', - rHar: '⥤', - race: '∽̱', - racute: 'ŕ', - radic: '√', - raemptyv: '⦳', - rang: '⟩', - rangd: '⦒', - range: '⦥', - rangle: '⟩', - raquo: '»', - rarr: '→', - rarrap: '⥵', - rarrb: '⇥', - rarrbfs: '⤠', - rarrc: '⤳', - rarrfs: '⤞', - rarrhk: '↪', - rarrlp: '↬', - rarrpl: '⥅', - rarrsim: '⥴', - rarrtl: '↣', - rarrw: '↝', - ratail: '⤚', - ratio: '∶', - rationals: 'ℚ', - rbarr: '⤍', - rbbrk: '❳', - rbrace: '}', - rbrack: ']', - rbrke: '⦌', - rbrksld: '⦎', - rbrkslu: '⦐', - rcaron: 'ř', - rcedil: 'ŗ', - rceil: '⌉', - rcub: '}', - rcy: 'р', - rdca: '⤷', - rdldhar: '⥩', - rdquo: '”', - rdquor: '”', - rdsh: '↳', - real: 'ℜ', - realine: 'ℛ', - realpart: 'ℜ', - reals: 'ℝ', - rect: '▭', - reg: '®', - rfisht: '⥽', - rfloor: '⌋', - rfr: '𝔯', - rhard: '⇁', - rharu: '⇀', - rharul: '⥬', - rho: 'ρ', - rhov: 'ϱ', - rightarrow: '→', - rightarrowtail: '↣', - rightharpoondown: '⇁', - rightharpoonup: '⇀', - rightleftarrows: '⇄', - rightleftharpoons: '⇌', - rightrightarrows: '⇉', - rightsquigarrow: '↝', - rightthreetimes: '⋌', - ring: '˚', - risingdotseq: '≓', - rlarr: '⇄', - rlhar: '⇌', - rlm: '‏', - rmoust: '⎱', - rmoustache: '⎱', - rnmid: '⫮', - roang: '⟭', - roarr: '⇾', - robrk: '⟧', - ropar: '⦆', - ropf: '𝕣', - roplus: '⨮', - rotimes: '⨵', - rpar: ')', - rpargt: '⦔', - rppolint: '⨒', - rrarr: '⇉', - rsaquo: '›', - rscr: '𝓇', - rsh: '↱', - rsqb: ']', - rsquo: '’', - rsquor: '’', - rthree: '⋌', - rtimes: '⋊', - rtri: '▹', - rtrie: '⊵', - rtrif: '▸', - rtriltri: '⧎', - ruluhar: '⥨', - rx: '℞', - sacute: 'ś', - sbquo: '‚', - sc: '≻', - scE: '⪴', - scap: '⪸', - scaron: 'š', - sccue: '≽', - sce: '⪰', - scedil: 'ş', - scirc: 'ŝ', - scnE: '⪶', - scnap: '⪺', - scnsim: '⋩', - scpolint: '⨓', - scsim: '≿', - scy: 'с', - sdot: '⋅', - sdotb: '⊡', - sdote: '⩦', - seArr: '⇘', - searhk: '⤥', - searr: '↘', - searrow: '↘', - sect: '§', - semi: ';', - seswar: '⤩', - setminus: '∖', - setmn: '∖', - sext: '✶', - sfr: '𝔰', - sfrown: '⌢', - sharp: '♯', - shchcy: 'щ', - shcy: 'ш', - shortmid: '∣', - shortparallel: '∥', - shy: '­', - sigma: 'σ', - sigmaf: 'ς', - sigmav: 'ς', - sim: '∼', - simdot: '⩪', - sime: '≃', - simeq: '≃', - simg: '⪞', - simgE: '⪠', - siml: '⪝', - simlE: '⪟', - simne: '≆', - simplus: '⨤', - simrarr: '⥲', - slarr: '←', - smallsetminus: '∖', - smashp: '⨳', - smeparsl: '⧤', - smid: '∣', - smile: '⌣', - smt: '⪪', - smte: '⪬', - smtes: '⪬︀', - softcy: 'ь', - sol: '/', - solb: '⧄', - solbar: '⌿', - sopf: '𝕤', - spades: '♠', - spadesuit: '♠', - spar: '∥', - sqcap: '⊓', - sqcaps: '⊓︀', - sqcup: '⊔', - sqcups: '⊔︀', - sqsub: '⊏', - sqsube: '⊑', - sqsubset: '⊏', - sqsubseteq: '⊑', - sqsup: '⊐', - sqsupe: '⊒', - sqsupset: '⊐', - sqsupseteq: '⊒', - squ: '□', - square: '□', - squarf: '▪', - squf: '▪', - srarr: '→', - sscr: '𝓈', - ssetmn: '∖', - ssmile: '⌣', - sstarf: '⋆', - star: '☆', - starf: '★', - straightepsilon: 'ϵ', - straightphi: 'ϕ', - strns: '¯', - sub: '⊂', - subE: '⫅', - subdot: '⪽', - sube: '⊆', - subedot: '⫃', - submult: '⫁', - subnE: '⫋', - subne: '⊊', - subplus: '⪿', - subrarr: '⥹', - subset: '⊂', - subseteq: '⊆', - subseteqq: '⫅', - subsetneq: '⊊', - subsetneqq: '⫋', - subsim: '⫇', - subsub: '⫕', - subsup: '⫓', - succ: '≻', - succapprox: '⪸', - succcurlyeq: '≽', - succeq: '⪰', - succnapprox: '⪺', - succneqq: '⪶', - succnsim: '⋩', - succsim: '≿', - sum: '∑', - sung: '♪', - sup1: '¹', - sup2: '²', - sup3: '³', - sup: '⊃', - supE: '⫆', - supdot: '⪾', - supdsub: '⫘', - supe: '⊇', - supedot: '⫄', - suphsol: '⟉', - suphsub: '⫗', - suplarr: '⥻', - supmult: '⫂', - supnE: '⫌', - supne: '⊋', - supplus: '⫀', - supset: '⊃', - supseteq: '⊇', - supseteqq: '⫆', - supsetneq: '⊋', - supsetneqq: '⫌', - supsim: '⫈', - supsub: '⫔', - supsup: '⫖', - swArr: '⇙', - swarhk: '⤦', - swarr: '↙', - swarrow: '↙', - swnwar: '⤪', - szlig: 'ß', - target: '⌖', - tau: 'τ', - tbrk: '⎴', - tcaron: 'ť', - tcedil: 'ţ', - tcy: 'т', - tdot: '⃛', - telrec: '⌕', - tfr: '𝔱', - there4: '∴', - therefore: '∴', - theta: 'θ', - thetasym: 'ϑ', - thetav: 'ϑ', - thickapprox: '≈', - thicksim: '∼', - thinsp: ' ', - thkap: '≈', - thksim: '∼', - thorn: 'þ', - tilde: '˜', - times: '×', - timesb: '⊠', - timesbar: '⨱', - timesd: '⨰', - tint: '∭', - toea: '⤨', - top: '⊤', - topbot: '⌶', - topcir: '⫱', - topf: '𝕥', - topfork: '⫚', - tosa: '⤩', - tprime: '‴', - trade: '™', - triangle: '▵', - triangledown: '▿', - triangleleft: '◃', - trianglelefteq: '⊴', - triangleq: '≜', - triangleright: '▹', - trianglerighteq: '⊵', - tridot: '◬', - trie: '≜', - triminus: '⨺', - triplus: '⨹', - trisb: '⧍', - tritime: '⨻', - trpezium: '⏢', - tscr: '𝓉', - tscy: 'ц', - tshcy: 'ћ', - tstrok: 'ŧ', - twixt: '≬', - twoheadleftarrow: '↞', - twoheadrightarrow: '↠', - uArr: '⇑', - uHar: '⥣', - uacute: 'ú', - uarr: '↑', - ubrcy: 'ў', - ubreve: 'ŭ', - ucirc: 'û', - ucy: 'у', - udarr: '⇅', - udblac: 'ű', - udhar: '⥮', - ufisht: '⥾', - ufr: '𝔲', - ugrave: 'ù', - uharl: '↿', - uharr: '↾', - uhblk: '▀', - ulcorn: '⌜', - ulcorner: '⌜', - ulcrop: '⌏', - ultri: '◸', - umacr: 'ū', - uml: '¨', - uogon: 'ų', - uopf: '𝕦', - uparrow: '↑', - updownarrow: '↕', - upharpoonleft: '↿', - upharpoonright: '↾', - uplus: '⊎', - upsi: 'υ', - upsih: 'ϒ', - upsilon: 'υ', - upuparrows: '⇈', - urcorn: '⌝', - urcorner: '⌝', - urcrop: '⌎', - uring: 'ů', - urtri: '◹', - uscr: '𝓊', - utdot: '⋰', - utilde: 'ũ', - utri: '▵', - utrif: '▴', - uuarr: '⇈', - uuml: 'ü', - uwangle: '⦧', - vArr: '⇕', - vBar: '⫨', - vBarv: '⫩', - vDash: '⊨', - vangrt: '⦜', - varepsilon: 'ϵ', - varkappa: 'ϰ', - varnothing: '∅', - varphi: 'ϕ', - varpi: 'ϖ', - varpropto: '∝', - varr: '↕', - varrho: 'ϱ', - varsigma: 'ς', - varsubsetneq: '⊊︀', - varsubsetneqq: '⫋︀', - varsupsetneq: '⊋︀', - varsupsetneqq: '⫌︀', - vartheta: 'ϑ', - vartriangleleft: '⊲', - vartriangleright: '⊳', - vcy: 'в', - vdash: '⊢', - vee: '∨', - veebar: '⊻', - veeeq: '≚', - vellip: '⋮', - verbar: '|', - vert: '|', - vfr: '𝔳', - vltri: '⊲', - vnsub: '⊂⃒', - vnsup: '⊃⃒', - vopf: '𝕧', - vprop: '∝', - vrtri: '⊳', - vscr: '𝓋', - vsubnE: '⫋︀', - vsubne: '⊊︀', - vsupnE: '⫌︀', - vsupne: '⊋︀', - vzigzag: '⦚', - wcirc: 'ŵ', - wedbar: '⩟', - wedge: '∧', - wedgeq: '≙', - weierp: '℘', - wfr: '𝔴', - wopf: '𝕨', - wp: '℘', - wr: '≀', - wreath: '≀', - wscr: '𝓌', - xcap: '⋂', - xcirc: '◯', - xcup: '⋃', - xdtri: '▽', - xfr: '𝔵', - xhArr: '⟺', - xharr: '⟷', - xi: 'ξ', - xlArr: '⟸', - xlarr: '⟵', - xmap: '⟼', - xnis: '⋻', - xodot: '⨀', - xopf: '𝕩', - xoplus: '⨁', - xotime: '⨂', - xrArr: '⟹', - xrarr: '⟶', - xscr: '𝓍', - xsqcup: '⨆', - xuplus: '⨄', - xutri: '△', - xvee: '⋁', - xwedge: '⋀', - yacute: 'ý', - yacy: 'я', - ycirc: 'ŷ', - ycy: 'ы', - yen: '¥', - yfr: '𝔶', - yicy: 'ї', - yopf: '𝕪', - yscr: '𝓎', - yucy: 'ю', - yuml: 'ÿ', - zacute: 'ź', - zcaron: 'ž', - zcy: 'з', - zdot: 'ż', - zeetrf: 'ℨ', - zeta: 'ζ', - zfr: '𝔷', - zhcy: 'ж', - zigrarr: '⇝', - zopf: '𝕫', - zscr: '𝓏', - zwj: '‍', - zwnj: '‌' -}; - -const own$4 = {}.hasOwnProperty; -function decodeNamedCharacterReference(value) { - return own$4.call(characterEntities, value) ? characterEntities[value] : false -} - -function splice(list, start, remove, items) { - const end = list.length; - let chunkStart = 0; - let parameters; - if (start < 0) { - start = -start > end ? 0 : end + start; - } else { - start = start > end ? end : start; - } - remove = remove > 0 ? remove : 0; - if (items.length < 10000) { - parameters = Array.from(items); - parameters.unshift(start, remove); - list.splice(...parameters); - } else { - if (remove) list.splice(start, remove); - while (chunkStart < items.length) { - parameters = items.slice(chunkStart, chunkStart + 10000); - parameters.unshift(start, 0); - list.splice(...parameters); - chunkStart += 10000; - start += 10000; - } - } -} -function push(list, items) { - if (list.length > 0) { - splice(list, list.length, 0, items); - return list - } - return items -} - -const hasOwnProperty = {}.hasOwnProperty; -function combineExtensions(extensions) { - const all = {}; - let index = -1; - while (++index < extensions.length) { - syntaxExtension(all, extensions[index]); - } - return all -} -function syntaxExtension(all, extension) { - let hook; - for (hook in extension) { - const maybe = hasOwnProperty.call(all, hook) ? all[hook] : undefined; - const left = maybe || (all[hook] = {}); - const right = extension[hook]; - let code; - if (right) { - for (code in right) { - if (!hasOwnProperty.call(left, code)) left[code] = []; - const value = right[code]; - constructs( - left[code], - Array.isArray(value) ? value : value ? [value] : [] - ); - } - } - } -} -function constructs(existing, list) { - let index = -1; - const before = []; - while (++index < list.length) { -(list[index].add === 'after' ? existing : before).push(list[index]); - } - splice(existing, 0, 0, before); -} - -function decodeNumericCharacterReference(value, base) { - const code = Number.parseInt(value, base); - if ( - code < 9 || code === 11 || code > 13 && code < 32 || - code > 126 && code < 160 || - code > 55_295 && code < 57_344 || - code > 64_975 && code < 65_008 || - (code & 65_535) === 65_535 || (code & 65_535) === 65_534 || - code > 1_114_111) { - return "\uFFFD"; - } - return String.fromCodePoint(code); -} - -function normalizeIdentifier(value) { - return ( - value - .replace(/[\t\n\r ]+/g, ' ') - .replace(/^ | $/g, '') - .toLowerCase() - .toUpperCase() - ) -} - -const asciiAlpha = regexCheck(/[A-Za-z]/); -const asciiAlphanumeric = regexCheck(/[\dA-Za-z]/); -const asciiAtext = regexCheck(/[#-'*+\--9=?A-Z^-~]/); -function asciiControl(code) { - return ( - code !== null && (code < 32 || code === 127) - ); -} -const asciiDigit = regexCheck(/\d/); -const asciiHexDigit = regexCheck(/[\dA-Fa-f]/); -const asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/); -function markdownLineEnding(code) { - return code !== null && code < -2; -} -function markdownLineEndingOrSpace(code) { - return code !== null && (code < 0 || code === 32); -} -function markdownSpace(code) { - return code === -2 || code === -1 || code === 32; -} -const unicodePunctuation = regexCheck(/\p{P}|\p{S}/u); -const unicodeWhitespace = regexCheck(/\s/); -function regexCheck(regex) { - return check; - function check(code) { - return code !== null && code > -1 && regex.test(String.fromCharCode(code)); - } -} - -function factorySpace(effects, ok, type, max) { - const limit = max ? max - 1 : Number.POSITIVE_INFINITY; - let size = 0; - return start - function start(code) { - if (markdownSpace(code)) { - effects.enter(type); - return prefix(code) - } - return ok(code) - } - function prefix(code) { - if (markdownSpace(code) && size++ < limit) { - effects.consume(code); - return prefix - } - effects.exit(type); - return ok(code) - } -} - -const content$1 = { - tokenize: initializeContent -}; -function initializeContent(effects) { - const contentStart = effects.attempt( - this.parser.constructs.contentInitial, - afterContentStartConstruct, - paragraphInitial - ); - let previous; - return contentStart - function afterContentStartConstruct(code) { - if (code === null) { - effects.consume(code); - return - } - effects.enter('lineEnding'); - effects.consume(code); - effects.exit('lineEnding'); - return factorySpace(effects, contentStart, 'linePrefix') - } - function paragraphInitial(code) { - effects.enter('paragraph'); - return lineStart(code) - } - function lineStart(code) { - const token = effects.enter('chunkText', { - contentType: 'text', - previous - }); - if (previous) { - previous.next = token; - } - previous = token; - return data(code) - } - function data(code) { - if (code === null) { - effects.exit('chunkText'); - effects.exit('paragraph'); - effects.consume(code); - return - } - if (markdownLineEnding(code)) { - effects.consume(code); - effects.exit('chunkText'); - return lineStart - } - effects.consume(code); - return data - } -} - -const document$1 = { - tokenize: initializeDocument -}; -const containerConstruct = { - tokenize: tokenizeContainer -}; -function initializeDocument(effects) { - const self = this; - const stack = []; - let continued = 0; - let childFlow; - let childToken; - let lineStartOffset; - return start - function start(code) { - if (continued < stack.length) { - const item = stack[continued]; - self.containerState = item[1]; - return effects.attempt( - item[0].continuation, - documentContinue, - checkNewContainers - )(code) - } - return checkNewContainers(code) - } - function documentContinue(code) { - continued++; - if (self.containerState._closeFlow) { - self.containerState._closeFlow = undefined; - if (childFlow) { - closeFlow(); - } - const indexBeforeExits = self.events.length; - let indexBeforeFlow = indexBeforeExits; - let point; - while (indexBeforeFlow--) { - if ( - self.events[indexBeforeFlow][0] === 'exit' && - self.events[indexBeforeFlow][1].type === 'chunkFlow' - ) { - point = self.events[indexBeforeFlow][1].end; - break - } - } - exitContainers(continued); - let index = indexBeforeExits; - while (index < self.events.length) { - self.events[index][1].end = Object.assign({}, point); - index++; - } - splice( - self.events, - indexBeforeFlow + 1, - 0, - self.events.slice(indexBeforeExits) - ); - self.events.length = index; - return checkNewContainers(code) - } - return start(code) - } - function checkNewContainers(code) { - if (continued === stack.length) { - if (!childFlow) { - return documentContinued(code) - } - if (childFlow.currentConstruct && childFlow.currentConstruct.concrete) { - return flowStart(code) - } - self.interrupt = Boolean( - childFlow.currentConstruct && !childFlow._gfmTableDynamicInterruptHack - ); - } - self.containerState = {}; - return effects.check( - containerConstruct, - thereIsANewContainer, - thereIsNoNewContainer - )(code) - } - function thereIsANewContainer(code) { - if (childFlow) closeFlow(); - exitContainers(continued); - return documentContinued(code) - } - function thereIsNoNewContainer(code) { - self.parser.lazy[self.now().line] = continued !== stack.length; - lineStartOffset = self.now().offset; - return flowStart(code) - } - function documentContinued(code) { - self.containerState = {}; - return effects.attempt( - containerConstruct, - containerContinue, - flowStart - )(code) - } - function containerContinue(code) { - continued++; - stack.push([self.currentConstruct, self.containerState]); - return documentContinued(code) - } - function flowStart(code) { - if (code === null) { - if (childFlow) closeFlow(); - exitContainers(0); - effects.consume(code); - return - } - childFlow = childFlow || self.parser.flow(self.now()); - effects.enter('chunkFlow', { - contentType: 'flow', - previous: childToken, - _tokenizer: childFlow - }); - return flowContinue(code) - } - function flowContinue(code) { - if (code === null) { - writeToChild(effects.exit('chunkFlow'), true); - exitContainers(0); - effects.consume(code); - return - } - if (markdownLineEnding(code)) { - effects.consume(code); - writeToChild(effects.exit('chunkFlow')); - continued = 0; - self.interrupt = undefined; - return start - } - effects.consume(code); - return flowContinue - } - function writeToChild(token, eof) { - const stream = self.sliceStream(token); - if (eof) stream.push(null); - token.previous = childToken; - if (childToken) childToken.next = token; - childToken = token; - childFlow.defineSkip(token.start); - childFlow.write(stream); - if (self.parser.lazy[token.start.line]) { - let index = childFlow.events.length; - while (index--) { - if ( - childFlow.events[index][1].start.offset < lineStartOffset && - (!childFlow.events[index][1].end || - childFlow.events[index][1].end.offset > lineStartOffset) - ) { - return - } - } - const indexBeforeExits = self.events.length; - let indexBeforeFlow = indexBeforeExits; - let seen; - let point; - while (indexBeforeFlow--) { - if ( - self.events[indexBeforeFlow][0] === 'exit' && - self.events[indexBeforeFlow][1].type === 'chunkFlow' - ) { - if (seen) { - point = self.events[indexBeforeFlow][1].end; - break - } - seen = true; - } - } - exitContainers(continued); - index = indexBeforeExits; - while (index < self.events.length) { - self.events[index][1].end = Object.assign({}, point); - index++; - } - splice( - self.events, - indexBeforeFlow + 1, - 0, - self.events.slice(indexBeforeExits) - ); - self.events.length = index; - } - } - function exitContainers(size) { - let index = stack.length; - while (index-- > size) { - const entry = stack[index]; - self.containerState = entry[1]; - entry[0].exit.call(self, effects); - } - stack.length = size; - } - function closeFlow() { - childFlow.write([null]); - childToken = undefined; - childFlow = undefined; - self.containerState._closeFlow = undefined; - } -} -function tokenizeContainer(effects, ok, nok) { - return factorySpace( - effects, - effects.attempt(this.parser.constructs.document, ok, nok), - 'linePrefix', - this.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4 - ) -} - -function classifyCharacter(code) { - if ( - code === null || - markdownLineEndingOrSpace(code) || - unicodeWhitespace(code) - ) { - return 1 - } - if (unicodePunctuation(code)) { - return 2 - } -} - -function resolveAll(constructs, events, context) { - const called = []; - let index = -1; - while (++index < constructs.length) { - const resolve = constructs[index].resolveAll; - if (resolve && !called.includes(resolve)) { - events = resolve(events, context); - called.push(resolve); - } - } - return events -} - -const attention = { - name: 'attention', - tokenize: tokenizeAttention, - resolveAll: resolveAllAttention -}; -function resolveAllAttention(events, context) { - let index = -1; - let open; - let group; - let text; - let openingSequence; - let closingSequence; - let use; - let nextEvents; - let offset; - while (++index < events.length) { - if (events[index][0] === 'enter' && events[index][1].type === 'attentionSequence' && events[index][1]._close) { - open = index; - while (open--) { - if (events[open][0] === 'exit' && events[open][1].type === 'attentionSequence' && events[open][1]._open && - context.sliceSerialize(events[open][1]).charCodeAt(0) === context.sliceSerialize(events[index][1]).charCodeAt(0)) { - if ((events[open][1]._close || events[index][1]._open) && (events[index][1].end.offset - events[index][1].start.offset) % 3 && !((events[open][1].end.offset - events[open][1].start.offset + events[index][1].end.offset - events[index][1].start.offset) % 3)) { - continue; - } - use = events[open][1].end.offset - events[open][1].start.offset > 1 && events[index][1].end.offset - events[index][1].start.offset > 1 ? 2 : 1; - const start = Object.assign({}, events[open][1].end); - const end = Object.assign({}, events[index][1].start); - movePoint(start, -use); - movePoint(end, use); - openingSequence = { - type: use > 1 ? "strongSequence" : "emphasisSequence", - start, - end: Object.assign({}, events[open][1].end) - }; - closingSequence = { - type: use > 1 ? "strongSequence" : "emphasisSequence", - start: Object.assign({}, events[index][1].start), - end - }; - text = { - type: use > 1 ? "strongText" : "emphasisText", - start: Object.assign({}, events[open][1].end), - end: Object.assign({}, events[index][1].start) - }; - group = { - type: use > 1 ? "strong" : "emphasis", - start: Object.assign({}, openingSequence.start), - end: Object.assign({}, closingSequence.end) - }; - events[open][1].end = Object.assign({}, openingSequence.start); - events[index][1].start = Object.assign({}, closingSequence.end); - nextEvents = []; - if (events[open][1].end.offset - events[open][1].start.offset) { - nextEvents = push(nextEvents, [['enter', events[open][1], context], ['exit', events[open][1], context]]); - } - nextEvents = push(nextEvents, [['enter', group, context], ['enter', openingSequence, context], ['exit', openingSequence, context], ['enter', text, context]]); - nextEvents = push(nextEvents, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open + 1, index), context)); - nextEvents = push(nextEvents, [['exit', text, context], ['enter', closingSequence, context], ['exit', closingSequence, context], ['exit', group, context]]); - if (events[index][1].end.offset - events[index][1].start.offset) { - offset = 2; - nextEvents = push(nextEvents, [['enter', events[index][1], context], ['exit', events[index][1], context]]); - } else { - offset = 0; - } - splice(events, open - 1, index - open + 3, nextEvents); - index = open + nextEvents.length - offset - 2; - break; - } - } - } - } - index = -1; - while (++index < events.length) { - if (events[index][1].type === 'attentionSequence') { - events[index][1].type = 'data'; - } - } - return events; -} -function tokenizeAttention(effects, ok) { - const attentionMarkers = this.parser.constructs.attentionMarkers.null; - const previous = this.previous; - const before = classifyCharacter(previous); - let marker; - return start; - function start(code) { - marker = code; - effects.enter('attentionSequence'); - return inside(code); - } - function inside(code) { - if (code === marker) { - effects.consume(code); - return inside; - } - const token = effects.exit('attentionSequence'); - const after = classifyCharacter(code); - const open = !after || after === 2 && before || attentionMarkers.includes(code); - const close = !before || before === 2 && after || attentionMarkers.includes(previous); - token._open = Boolean(marker === 42 ? open : open && (before || !close)); - token._close = Boolean(marker === 42 ? close : close && (after || !open)); - return ok(code); - } -} -function movePoint(point, offset) { - point.column += offset; - point.offset += offset; - point._bufferIndex += offset; -} - -const autolink = { - name: 'autolink', - tokenize: tokenizeAutolink -}; -function tokenizeAutolink(effects, ok, nok) { - let size = 0; - return start; - function start(code) { - effects.enter("autolink"); - effects.enter("autolinkMarker"); - effects.consume(code); - effects.exit("autolinkMarker"); - effects.enter("autolinkProtocol"); - return open; - } - function open(code) { - if (asciiAlpha(code)) { - effects.consume(code); - return schemeOrEmailAtext; - } - if (code === 64) { - return nok(code); - } - return emailAtext(code); - } - function schemeOrEmailAtext(code) { - if (code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code)) { - size = 1; - return schemeInsideOrEmailAtext(code); - } - return emailAtext(code); - } - function schemeInsideOrEmailAtext(code) { - if (code === 58) { - effects.consume(code); - size = 0; - return urlInside; - } - if ((code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code)) && size++ < 32) { - effects.consume(code); - return schemeInsideOrEmailAtext; - } - size = 0; - return emailAtext(code); - } - function urlInside(code) { - if (code === 62) { - effects.exit("autolinkProtocol"); - effects.enter("autolinkMarker"); - effects.consume(code); - effects.exit("autolinkMarker"); - effects.exit("autolink"); - return ok; - } - if (code === null || code === 32 || code === 60 || asciiControl(code)) { - return nok(code); - } - effects.consume(code); - return urlInside; - } - function emailAtext(code) { - if (code === 64) { - effects.consume(code); - return emailAtSignOrDot; - } - if (asciiAtext(code)) { - effects.consume(code); - return emailAtext; - } - return nok(code); - } - function emailAtSignOrDot(code) { - return asciiAlphanumeric(code) ? emailLabel(code) : nok(code); - } - function emailLabel(code) { - if (code === 46) { - effects.consume(code); - size = 0; - return emailAtSignOrDot; - } - if (code === 62) { - effects.exit("autolinkProtocol").type = "autolinkEmail"; - effects.enter("autolinkMarker"); - effects.consume(code); - effects.exit("autolinkMarker"); - effects.exit("autolink"); - return ok; - } - return emailValue(code); - } - function emailValue(code) { - if ((code === 45 || asciiAlphanumeric(code)) && size++ < 63) { - const next = code === 45 ? emailValue : emailLabel; - effects.consume(code); - return next; - } - return nok(code); - } -} - -const blankLine = { - tokenize: tokenizeBlankLine, - partial: true -}; -function tokenizeBlankLine(effects, ok, nok) { - return start; - function start(code) { - return markdownSpace(code) ? factorySpace(effects, after, "linePrefix")(code) : after(code); - } - function after(code) { - return code === null || markdownLineEnding(code) ? ok(code) : nok(code); - } -} - -const blockQuote = { - name: 'blockQuote', - tokenize: tokenizeBlockQuoteStart, - continuation: { - tokenize: tokenizeBlockQuoteContinuation - }, - exit: exit$1 -}; -function tokenizeBlockQuoteStart(effects, ok, nok) { - const self = this; - return start; - function start(code) { - if (code === 62) { - const state = self.containerState; - if (!state.open) { - effects.enter("blockQuote", { - _container: true - }); - state.open = true; - } - effects.enter("blockQuotePrefix"); - effects.enter("blockQuoteMarker"); - effects.consume(code); - effects.exit("blockQuoteMarker"); - return after; - } - return nok(code); - } - function after(code) { - if (markdownSpace(code)) { - effects.enter("blockQuotePrefixWhitespace"); - effects.consume(code); - effects.exit("blockQuotePrefixWhitespace"); - effects.exit("blockQuotePrefix"); - return ok; - } - effects.exit("blockQuotePrefix"); - return ok(code); - } -} -function tokenizeBlockQuoteContinuation(effects, ok, nok) { - const self = this; - return contStart; - function contStart(code) { - if (markdownSpace(code)) { - return factorySpace(effects, contBefore, "linePrefix", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4)(code); - } - return contBefore(code); - } - function contBefore(code) { - return effects.attempt(blockQuote, ok, nok)(code); - } -} -function exit$1(effects) { - effects.exit("blockQuote"); -} - -const characterEscape = { - name: 'characterEscape', - tokenize: tokenizeCharacterEscape -}; -function tokenizeCharacterEscape(effects, ok, nok) { - return start; - function start(code) { - effects.enter("characterEscape"); - effects.enter("escapeMarker"); - effects.consume(code); - effects.exit("escapeMarker"); - return inside; - } - function inside(code) { - if (asciiPunctuation(code)) { - effects.enter("characterEscapeValue"); - effects.consume(code); - effects.exit("characterEscapeValue"); - effects.exit("characterEscape"); - return ok; - } - return nok(code); - } -} - -const characterReference = { - name: 'characterReference', - tokenize: tokenizeCharacterReference -}; -function tokenizeCharacterReference(effects, ok, nok) { - const self = this; - let size = 0; - let max; - let test; - return start; - function start(code) { - effects.enter("characterReference"); - effects.enter("characterReferenceMarker"); - effects.consume(code); - effects.exit("characterReferenceMarker"); - return open; - } - function open(code) { - if (code === 35) { - effects.enter("characterReferenceMarkerNumeric"); - effects.consume(code); - effects.exit("characterReferenceMarkerNumeric"); - return numeric; - } - effects.enter("characterReferenceValue"); - max = 31; - test = asciiAlphanumeric; - return value(code); - } - function numeric(code) { - if (code === 88 || code === 120) { - effects.enter("characterReferenceMarkerHexadecimal"); - effects.consume(code); - effects.exit("characterReferenceMarkerHexadecimal"); - effects.enter("characterReferenceValue"); - max = 6; - test = asciiHexDigit; - return value; - } - effects.enter("characterReferenceValue"); - max = 7; - test = asciiDigit; - return value(code); - } - function value(code) { - if (code === 59 && size) { - const token = effects.exit("characterReferenceValue"); - if (test === asciiAlphanumeric && !decodeNamedCharacterReference(self.sliceSerialize(token))) { - return nok(code); - } - effects.enter("characterReferenceMarker"); - effects.consume(code); - effects.exit("characterReferenceMarker"); - effects.exit("characterReference"); - return ok; - } - if (test(code) && size++ < max) { - effects.consume(code); - return value; - } - return nok(code); - } -} - -const nonLazyContinuation = { - tokenize: tokenizeNonLazyContinuation, - partial: true -}; -const codeFenced = { - name: 'codeFenced', - tokenize: tokenizeCodeFenced, - concrete: true -}; -function tokenizeCodeFenced(effects, ok, nok) { - const self = this; - const closeStart = { - tokenize: tokenizeCloseStart, - partial: true - }; - let initialPrefix = 0; - let sizeOpen = 0; - let marker; - return start; - function start(code) { - return beforeSequenceOpen(code); - } - function beforeSequenceOpen(code) { - const tail = self.events[self.events.length - 1]; - initialPrefix = tail && tail[1].type === "linePrefix" ? tail[2].sliceSerialize(tail[1], true).length : 0; - marker = code; - effects.enter("codeFenced"); - effects.enter("codeFencedFence"); - effects.enter("codeFencedFenceSequence"); - return sequenceOpen(code); - } - function sequenceOpen(code) { - if (code === marker) { - sizeOpen++; - effects.consume(code); - return sequenceOpen; - } - if (sizeOpen < 3) { - return nok(code); - } - effects.exit("codeFencedFenceSequence"); - return markdownSpace(code) ? factorySpace(effects, infoBefore, "whitespace")(code) : infoBefore(code); - } - function infoBefore(code) { - if (code === null || markdownLineEnding(code)) { - effects.exit("codeFencedFence"); - return self.interrupt ? ok(code) : effects.check(nonLazyContinuation, atNonLazyBreak, after)(code); - } - effects.enter("codeFencedFenceInfo"); - effects.enter("chunkString", { - contentType: "string" - }); - return info(code); - } - function info(code) { - if (code === null || markdownLineEnding(code)) { - effects.exit("chunkString"); - effects.exit("codeFencedFenceInfo"); - return infoBefore(code); - } - if (markdownSpace(code)) { - effects.exit("chunkString"); - effects.exit("codeFencedFenceInfo"); - return factorySpace(effects, metaBefore, "whitespace")(code); - } - if (code === 96 && code === marker) { - return nok(code); - } - effects.consume(code); - return info; - } - function metaBefore(code) { - if (code === null || markdownLineEnding(code)) { - return infoBefore(code); - } - effects.enter("codeFencedFenceMeta"); - effects.enter("chunkString", { - contentType: "string" - }); - return meta(code); - } - function meta(code) { - if (code === null || markdownLineEnding(code)) { - effects.exit("chunkString"); - effects.exit("codeFencedFenceMeta"); - return infoBefore(code); - } - if (code === 96 && code === marker) { - return nok(code); - } - effects.consume(code); - return meta; - } - function atNonLazyBreak(code) { - return effects.attempt(closeStart, after, contentBefore)(code); - } - function contentBefore(code) { - effects.enter("lineEnding"); - effects.consume(code); - effects.exit("lineEnding"); - return contentStart; - } - function contentStart(code) { - return initialPrefix > 0 && markdownSpace(code) ? factorySpace(effects, beforeContentChunk, "linePrefix", initialPrefix + 1)(code) : beforeContentChunk(code); - } - function beforeContentChunk(code) { - if (code === null || markdownLineEnding(code)) { - return effects.check(nonLazyContinuation, atNonLazyBreak, after)(code); - } - effects.enter("codeFlowValue"); - return contentChunk(code); - } - function contentChunk(code) { - if (code === null || markdownLineEnding(code)) { - effects.exit("codeFlowValue"); - return beforeContentChunk(code); - } - effects.consume(code); - return contentChunk; - } - function after(code) { - effects.exit("codeFenced"); - return ok(code); - } - function tokenizeCloseStart(effects, ok, nok) { - let size = 0; - return startBefore; - function startBefore(code) { - effects.enter("lineEnding"); - effects.consume(code); - effects.exit("lineEnding"); - return start; - } - function start(code) { - effects.enter("codeFencedFence"); - return markdownSpace(code) ? factorySpace(effects, beforeSequenceClose, "linePrefix", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4)(code) : beforeSequenceClose(code); - } - function beforeSequenceClose(code) { - if (code === marker) { - effects.enter("codeFencedFenceSequence"); - return sequenceClose(code); - } - return nok(code); - } - function sequenceClose(code) { - if (code === marker) { - size++; - effects.consume(code); - return sequenceClose; - } - if (size >= sizeOpen) { - effects.exit("codeFencedFenceSequence"); - return markdownSpace(code) ? factorySpace(effects, sequenceCloseAfter, "whitespace")(code) : sequenceCloseAfter(code); - } - return nok(code); - } - function sequenceCloseAfter(code) { - if (code === null || markdownLineEnding(code)) { - effects.exit("codeFencedFence"); - return ok(code); - } - return nok(code); - } - } -} -function tokenizeNonLazyContinuation(effects, ok, nok) { - const self = this; - return start; - function start(code) { - if (code === null) { - return nok(code); - } - effects.enter("lineEnding"); - effects.consume(code); - effects.exit("lineEnding"); - return lineStart; - } - function lineStart(code) { - return self.parser.lazy[self.now().line] ? nok(code) : ok(code); - } -} - -const codeIndented = { - name: 'codeIndented', - tokenize: tokenizeCodeIndented -}; -const furtherStart = { - tokenize: tokenizeFurtherStart, - partial: true -}; -function tokenizeCodeIndented(effects, ok, nok) { - const self = this; - return start; - function start(code) { - effects.enter("codeIndented"); - return factorySpace(effects, afterPrefix, "linePrefix", 4 + 1)(code); - } - function afterPrefix(code) { - const tail = self.events[self.events.length - 1]; - return tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4 ? atBreak(code) : nok(code); - } - function atBreak(code) { - if (code === null) { - return after(code); - } - if (markdownLineEnding(code)) { - return effects.attempt(furtherStart, atBreak, after)(code); - } - effects.enter("codeFlowValue"); - return inside(code); - } - function inside(code) { - if (code === null || markdownLineEnding(code)) { - effects.exit("codeFlowValue"); - return atBreak(code); - } - effects.consume(code); - return inside; - } - function after(code) { - effects.exit("codeIndented"); - return ok(code); - } -} -function tokenizeFurtherStart(effects, ok, nok) { - const self = this; - return furtherStart; - function furtherStart(code) { - if (self.parser.lazy[self.now().line]) { - return nok(code); - } - if (markdownLineEnding(code)) { - effects.enter("lineEnding"); - effects.consume(code); - effects.exit("lineEnding"); - return furtherStart; - } - return factorySpace(effects, afterPrefix, "linePrefix", 4 + 1)(code); - } - function afterPrefix(code) { - const tail = self.events[self.events.length - 1]; - return tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4 ? ok(code) : markdownLineEnding(code) ? furtherStart(code) : nok(code); - } -} - -const codeText = { - name: 'codeText', - tokenize: tokenizeCodeText, - resolve: resolveCodeText, - previous: previous$1 -}; -function resolveCodeText(events) { - let tailExitIndex = events.length - 4; - let headEnterIndex = 3; - let index; - let enter; - if ((events[headEnterIndex][1].type === "lineEnding" || events[headEnterIndex][1].type === 'space') && (events[tailExitIndex][1].type === "lineEnding" || events[tailExitIndex][1].type === 'space')) { - index = headEnterIndex; - while (++index < tailExitIndex) { - if (events[index][1].type === "codeTextData") { - events[headEnterIndex][1].type = "codeTextPadding"; - events[tailExitIndex][1].type = "codeTextPadding"; - headEnterIndex += 2; - tailExitIndex -= 2; - break; - } - } - } - index = headEnterIndex - 1; - tailExitIndex++; - while (++index <= tailExitIndex) { - if (enter === undefined) { - if (index !== tailExitIndex && events[index][1].type !== "lineEnding") { - enter = index; - } - } else if (index === tailExitIndex || events[index][1].type === "lineEnding") { - events[enter][1].type = "codeTextData"; - if (index !== enter + 2) { - events[enter][1].end = events[index - 1][1].end; - events.splice(enter + 2, index - enter - 2); - tailExitIndex -= index - enter - 2; - index = enter + 2; - } - enter = undefined; - } - } - return events; -} -function previous$1(code) { - return code !== 96 || this.events[this.events.length - 1][1].type === "characterEscape"; -} -function tokenizeCodeText(effects, ok, nok) { - let sizeOpen = 0; - let size; - let token; - return start; - function start(code) { - effects.enter("codeText"); - effects.enter("codeTextSequence"); - return sequenceOpen(code); - } - function sequenceOpen(code) { - if (code === 96) { - effects.consume(code); - sizeOpen++; - return sequenceOpen; - } - effects.exit("codeTextSequence"); - return between(code); - } - function between(code) { - if (code === null) { - return nok(code); - } - if (code === 32) { - effects.enter('space'); - effects.consume(code); - effects.exit('space'); - return between; - } - if (code === 96) { - token = effects.enter("codeTextSequence"); - size = 0; - return sequenceClose(code); - } - if (markdownLineEnding(code)) { - effects.enter("lineEnding"); - effects.consume(code); - effects.exit("lineEnding"); - return between; - } - effects.enter("codeTextData"); - return data(code); - } - function data(code) { - if (code === null || code === 32 || code === 96 || markdownLineEnding(code)) { - effects.exit("codeTextData"); - return between(code); - } - effects.consume(code); - return data; - } - function sequenceClose(code) { - if (code === 96) { - effects.consume(code); - size++; - return sequenceClose; - } - if (size === sizeOpen) { - effects.exit("codeTextSequence"); - effects.exit("codeText"); - return ok(code); - } - token.type = "codeTextData"; - return data(code); - } -} - -class SpliceBuffer { - constructor(initial) { - this.left = initial ? [...initial] : []; - this.right = []; - } - get(index) { - if (index < 0 || index >= this.left.length + this.right.length) { - throw new RangeError('Cannot access index `' + index + '` in a splice buffer of size `' + (this.left.length + this.right.length) + '`'); - } - if (index < this.left.length) return this.left[index]; - return this.right[this.right.length - index + this.left.length - 1]; - } - get length() { - return this.left.length + this.right.length; - } - shift() { - this.setCursor(0); - return this.right.pop(); - } - slice(start, end) { - const stop = end === null || end === undefined ? Number.POSITIVE_INFINITY : end; - if (stop < this.left.length) { - return this.left.slice(start, stop); - } - if (start > this.left.length) { - return this.right.slice(this.right.length - stop + this.left.length, this.right.length - start + this.left.length).reverse(); - } - return this.left.slice(start).concat(this.right.slice(this.right.length - stop + this.left.length).reverse()); - } - splice(start, deleteCount, items) { - const count = deleteCount || 0; - this.setCursor(Math.trunc(start)); - const removed = this.right.splice(this.right.length - count, Number.POSITIVE_INFINITY); - if (items) chunkedPush(this.left, items); - return removed.reverse(); - } - pop() { - this.setCursor(Number.POSITIVE_INFINITY); - return this.left.pop(); - } - push(item) { - this.setCursor(Number.POSITIVE_INFINITY); - this.left.push(item); - } - pushMany(items) { - this.setCursor(Number.POSITIVE_INFINITY); - chunkedPush(this.left, items); - } - unshift(item) { - this.setCursor(0); - this.right.push(item); - } - unshiftMany(items) { - this.setCursor(0); - chunkedPush(this.right, items.reverse()); - } - setCursor(n) { - if (n === this.left.length || n > this.left.length && this.right.length === 0 || n < 0 && this.left.length === 0) return; - if (n < this.left.length) { - const removed = this.left.splice(n, Number.POSITIVE_INFINITY); - chunkedPush(this.right, removed.reverse()); - } else { - const removed = this.right.splice(this.left.length + this.right.length - n, Number.POSITIVE_INFINITY); - chunkedPush(this.left, removed.reverse()); - } - } -} -function chunkedPush(list, right) { - let chunkStart = 0; - if (right.length < 10000) { - list.push(...right); - } else { - while (chunkStart < right.length) { - list.push(...right.slice(chunkStart, chunkStart + 10000)); - chunkStart += 10000; - } - } -} - -function subtokenize(eventsArray) { - const jumps = {}; - let index = -1; - let event; - let lineIndex; - let otherIndex; - let otherEvent; - let parameters; - let subevents; - let more; - const events = new SpliceBuffer(eventsArray); - while (++index < events.length) { - while (index in jumps) { - index = jumps[index]; - } - event = events.get(index); - if (index && event[1].type === "chunkFlow" && events.get(index - 1)[1].type === "listItemPrefix") { - subevents = event[1]._tokenizer.events; - otherIndex = 0; - if (otherIndex < subevents.length && subevents[otherIndex][1].type === "lineEndingBlank") { - otherIndex += 2; - } - if (otherIndex < subevents.length && subevents[otherIndex][1].type === "content") { - while (++otherIndex < subevents.length) { - if (subevents[otherIndex][1].type === "content") { - break; - } - if (subevents[otherIndex][1].type === "chunkText") { - subevents[otherIndex][1]._isInFirstContentOfListItem = true; - otherIndex++; - } - } - } - } - if (event[0] === 'enter') { - if (event[1].contentType) { - Object.assign(jumps, subcontent(events, index)); - index = jumps[index]; - more = true; - } - } - else if (event[1]._container) { - otherIndex = index; - lineIndex = undefined; - while (otherIndex--) { - otherEvent = events.get(otherIndex); - if (otherEvent[1].type === "lineEnding" || otherEvent[1].type === "lineEndingBlank") { - if (otherEvent[0] === 'enter') { - if (lineIndex) { - events.get(lineIndex)[1].type = "lineEndingBlank"; - } - otherEvent[1].type = "lineEnding"; - lineIndex = otherIndex; - } - } else { - break; - } - } - if (lineIndex) { - event[1].end = Object.assign({}, events.get(lineIndex)[1].start); - parameters = events.slice(lineIndex, index); - parameters.unshift(event); - events.splice(lineIndex, index - lineIndex + 1, parameters); - } - } - } - splice(eventsArray, 0, Number.POSITIVE_INFINITY, events.slice(0)); - return !more; -} -function subcontent(events, eventIndex) { - const token = events.get(eventIndex)[1]; - const context = events.get(eventIndex)[2]; - let startPosition = eventIndex - 1; - const startPositions = []; - const tokenizer = token._tokenizer || context.parser[token.contentType](token.start); - const childEvents = tokenizer.events; - const jumps = []; - const gaps = {}; - let stream; - let previous; - let index = -1; - let current = token; - let adjust = 0; - let start = 0; - const breaks = [start]; - while (current) { - while (events.get(++startPosition)[1] !== current) { - } - startPositions.push(startPosition); - if (!current._tokenizer) { - stream = context.sliceStream(current); - if (!current.next) { - stream.push(null); - } - if (previous) { - tokenizer.defineSkip(current.start); - } - if (current._isInFirstContentOfListItem) { - tokenizer._gfmTasklistFirstContentOfListItem = true; - } - tokenizer.write(stream); - if (current._isInFirstContentOfListItem) { - tokenizer._gfmTasklistFirstContentOfListItem = undefined; - } - } - previous = current; - current = current.next; - } - current = token; - while (++index < childEvents.length) { - if ( - childEvents[index][0] === 'exit' && childEvents[index - 1][0] === 'enter' && childEvents[index][1].type === childEvents[index - 1][1].type && childEvents[index][1].start.line !== childEvents[index][1].end.line) { - start = index + 1; - breaks.push(start); - current._tokenizer = undefined; - current.previous = undefined; - current = current.next; - } - } - tokenizer.events = []; - if (current) { - current._tokenizer = undefined; - current.previous = undefined; - } else { - breaks.pop(); - } - index = breaks.length; - while (index--) { - const slice = childEvents.slice(breaks[index], breaks[index + 1]); - const start = startPositions.pop(); - jumps.push([start, start + slice.length - 1]); - events.splice(start, 2, slice); - } - jumps.reverse(); - index = -1; - while (++index < jumps.length) { - gaps[adjust + jumps[index][0]] = adjust + jumps[index][1]; - adjust += jumps[index][1] - jumps[index][0] - 1; - } - return gaps; -} - -const content = { - tokenize: tokenizeContent, - resolve: resolveContent -}; -const continuationConstruct = { - tokenize: tokenizeContinuation, - partial: true -}; -function resolveContent(events) { - subtokenize(events); - return events; -} -function tokenizeContent(effects, ok) { - let previous; - return chunkStart; - function chunkStart(code) { - effects.enter("content"); - previous = effects.enter("chunkContent", { - contentType: "content" - }); - return chunkInside(code); - } - function chunkInside(code) { - if (code === null) { - return contentEnd(code); - } - if (markdownLineEnding(code)) { - return effects.check(continuationConstruct, contentContinue, contentEnd)(code); - } - effects.consume(code); - return chunkInside; - } - function contentEnd(code) { - effects.exit("chunkContent"); - effects.exit("content"); - return ok(code); - } - function contentContinue(code) { - effects.consume(code); - effects.exit("chunkContent"); - previous.next = effects.enter("chunkContent", { - contentType: "content", - previous - }); - previous = previous.next; - return chunkInside; - } -} -function tokenizeContinuation(effects, ok, nok) { - const self = this; - return startLookahead; - function startLookahead(code) { - effects.exit("chunkContent"); - effects.enter("lineEnding"); - effects.consume(code); - effects.exit("lineEnding"); - return factorySpace(effects, prefixed, "linePrefix"); - } - function prefixed(code) { - if (code === null || markdownLineEnding(code)) { - return nok(code); - } - const tail = self.events[self.events.length - 1]; - if (!self.parser.constructs.disable.null.includes('codeIndented') && tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4) { - return ok(code); - } - return effects.interrupt(self.parser.constructs.flow, nok, ok)(code); - } -} - -function factoryDestination( - effects, - ok, - nok, - type, - literalType, - literalMarkerType, - rawType, - stringType, - max -) { - const limit = max || Number.POSITIVE_INFINITY; - let balance = 0; - return start - function start(code) { - if (code === 60) { - effects.enter(type); - effects.enter(literalType); - effects.enter(literalMarkerType); - effects.consume(code); - effects.exit(literalMarkerType); - return enclosedBefore - } - if (code === null || code === 32 || code === 41 || asciiControl(code)) { - return nok(code) - } - effects.enter(type); - effects.enter(rawType); - effects.enter(stringType); - effects.enter('chunkString', { - contentType: 'string' - }); - return raw(code) - } - function enclosedBefore(code) { - if (code === 62) { - effects.enter(literalMarkerType); - effects.consume(code); - effects.exit(literalMarkerType); - effects.exit(literalType); - effects.exit(type); - return ok - } - effects.enter(stringType); - effects.enter('chunkString', { - contentType: 'string' - }); - return enclosed(code) - } - function enclosed(code) { - if (code === 62) { - effects.exit('chunkString'); - effects.exit(stringType); - return enclosedBefore(code) - } - if (code === null || code === 60 || markdownLineEnding(code)) { - return nok(code) - } - effects.consume(code); - return code === 92 ? enclosedEscape : enclosed - } - function enclosedEscape(code) { - if (code === 60 || code === 62 || code === 92) { - effects.consume(code); - return enclosed - } - return enclosed(code) - } - function raw(code) { - if ( - !balance && - (code === null || code === 41 || markdownLineEndingOrSpace(code)) - ) { - effects.exit('chunkString'); - effects.exit(stringType); - effects.exit(rawType); - effects.exit(type); - return ok(code) - } - if (balance < limit && code === 40) { - effects.consume(code); - balance++; - return raw - } - if (code === 41) { - effects.consume(code); - balance--; - return raw - } - if (code === null || code === 32 || code === 40 || asciiControl(code)) { - return nok(code) - } - effects.consume(code); - return code === 92 ? rawEscape : raw - } - function rawEscape(code) { - if (code === 40 || code === 41 || code === 92) { - effects.consume(code); - return raw - } - return raw(code) - } -} - -function factoryLabel(effects, ok, nok, type, markerType, stringType) { - const self = this; - let size = 0; - let seen; - return start - function start(code) { - effects.enter(type); - effects.enter(markerType); - effects.consume(code); - effects.exit(markerType); - effects.enter(stringType); - return atBreak - } - function atBreak(code) { - if ( - size > 999 || - code === null || - code === 91 || - (code === 93 && !seen) || - (code === 94 && - !size && - '_hiddenFootnoteSupport' in self.parser.constructs) - ) { - return nok(code) - } - if (code === 93) { - effects.exit(stringType); - effects.enter(markerType); - effects.consume(code); - effects.exit(markerType); - effects.exit(type); - return ok - } - if (markdownLineEnding(code)) { - effects.enter('lineEnding'); - effects.consume(code); - effects.exit('lineEnding'); - return atBreak - } - effects.enter('chunkString', { - contentType: 'string' - }); - return labelInside(code) - } - function labelInside(code) { - if ( - code === null || - code === 91 || - code === 93 || - markdownLineEnding(code) || - size++ > 999 - ) { - effects.exit('chunkString'); - return atBreak(code) - } - effects.consume(code); - if (!seen) seen = !markdownSpace(code); - return code === 92 ? labelEscape : labelInside - } - function labelEscape(code) { - if (code === 91 || code === 92 || code === 93) { - effects.consume(code); - size++; - return labelInside - } - return labelInside(code) - } -} - -function factoryTitle(effects, ok, nok, type, markerType, stringType) { - let marker; - return start - function start(code) { - if (code === 34 || code === 39 || code === 40) { - effects.enter(type); - effects.enter(markerType); - effects.consume(code); - effects.exit(markerType); - marker = code === 40 ? 41 : code; - return begin - } - return nok(code) - } - function begin(code) { - if (code === marker) { - effects.enter(markerType); - effects.consume(code); - effects.exit(markerType); - effects.exit(type); - return ok - } - effects.enter(stringType); - return atBreak(code) - } - function atBreak(code) { - if (code === marker) { - effects.exit(stringType); - return begin(marker) - } - if (code === null) { - return nok(code) - } - if (markdownLineEnding(code)) { - effects.enter('lineEnding'); - effects.consume(code); - effects.exit('lineEnding'); - return factorySpace(effects, atBreak, 'linePrefix') - } - effects.enter('chunkString', { - contentType: 'string' - }); - return inside(code) - } - function inside(code) { - if (code === marker || code === null || markdownLineEnding(code)) { - effects.exit('chunkString'); - return atBreak(code) - } - effects.consume(code); - return code === 92 ? escape : inside - } - function escape(code) { - if (code === marker || code === 92) { - effects.consume(code); - return inside - } - return inside(code) - } -} - -function factoryWhitespace(effects, ok) { - let seen; - return start - function start(code) { - if (markdownLineEnding(code)) { - effects.enter('lineEnding'); - effects.consume(code); - effects.exit('lineEnding'); - seen = true; - return start - } - if (markdownSpace(code)) { - return factorySpace( - effects, - start, - seen ? 'linePrefix' : 'lineSuffix' - )(code) - } - return ok(code) - } -} - -const definition$1 = { - name: 'definition', - tokenize: tokenizeDefinition -}; -const titleBefore = { - tokenize: tokenizeTitleBefore, - partial: true -}; -function tokenizeDefinition(effects, ok, nok) { - const self = this; - let identifier; - return start; - function start(code) { - effects.enter("definition"); - return before(code); - } - function before(code) { - return factoryLabel.call(self, effects, labelAfter, - nok, "definitionLabel", "definitionLabelMarker", "definitionLabelString")(code); - } - function labelAfter(code) { - identifier = normalizeIdentifier(self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1)); - if (code === 58) { - effects.enter("definitionMarker"); - effects.consume(code); - effects.exit("definitionMarker"); - return markerAfter; - } - return nok(code); - } - function markerAfter(code) { - return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, destinationBefore)(code) : destinationBefore(code); - } - function destinationBefore(code) { - return factoryDestination(effects, destinationAfter, - nok, "definitionDestination", "definitionDestinationLiteral", "definitionDestinationLiteralMarker", "definitionDestinationRaw", "definitionDestinationString")(code); - } - function destinationAfter(code) { - return effects.attempt(titleBefore, after, after)(code); - } - function after(code) { - return markdownSpace(code) ? factorySpace(effects, afterWhitespace, "whitespace")(code) : afterWhitespace(code); - } - function afterWhitespace(code) { - if (code === null || markdownLineEnding(code)) { - effects.exit("definition"); - self.parser.defined.push(identifier); - return ok(code); - } - return nok(code); - } -} -function tokenizeTitleBefore(effects, ok, nok) { - return titleBefore; - function titleBefore(code) { - return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, beforeMarker)(code) : nok(code); - } - function beforeMarker(code) { - return factoryTitle(effects, titleAfter, nok, "definitionTitle", "definitionTitleMarker", "definitionTitleString")(code); - } - function titleAfter(code) { - return markdownSpace(code) ? factorySpace(effects, titleAfterOptionalWhitespace, "whitespace")(code) : titleAfterOptionalWhitespace(code); - } - function titleAfterOptionalWhitespace(code) { - return code === null || markdownLineEnding(code) ? ok(code) : nok(code); - } -} - -const hardBreakEscape = { - name: 'hardBreakEscape', - tokenize: tokenizeHardBreakEscape -}; -function tokenizeHardBreakEscape(effects, ok, nok) { - return start; - function start(code) { - effects.enter("hardBreakEscape"); - effects.consume(code); - return after; - } - function after(code) { - if (markdownLineEnding(code)) { - effects.exit("hardBreakEscape"); - return ok(code); - } - return nok(code); - } -} - -const headingAtx = { - name: 'headingAtx', - tokenize: tokenizeHeadingAtx, - resolve: resolveHeadingAtx -}; -function resolveHeadingAtx(events, context) { - let contentEnd = events.length - 2; - let contentStart = 3; - let content; - let text; - if (events[contentStart][1].type === "whitespace") { - contentStart += 2; - } - if (contentEnd - 2 > contentStart && events[contentEnd][1].type === "whitespace") { - contentEnd -= 2; - } - if (events[contentEnd][1].type === "atxHeadingSequence" && (contentStart === contentEnd - 1 || contentEnd - 4 > contentStart && events[contentEnd - 2][1].type === "whitespace")) { - contentEnd -= contentStart + 1 === contentEnd ? 2 : 4; - } - if (contentEnd > contentStart) { - content = { - type: "atxHeadingText", - start: events[contentStart][1].start, - end: events[contentEnd][1].end - }; - text = { - type: "chunkText", - start: events[contentStart][1].start, - end: events[contentEnd][1].end, - contentType: "text" - }; - splice(events, contentStart, contentEnd - contentStart + 1, [['enter', content, context], ['enter', text, context], ['exit', text, context], ['exit', content, context]]); - } - return events; -} -function tokenizeHeadingAtx(effects, ok, nok) { - let size = 0; - return start; - function start(code) { - effects.enter("atxHeading"); - return before(code); - } - function before(code) { - effects.enter("atxHeadingSequence"); - return sequenceOpen(code); - } - function sequenceOpen(code) { - if (code === 35 && size++ < 6) { - effects.consume(code); - return sequenceOpen; - } - if (code === null || markdownLineEndingOrSpace(code)) { - effects.exit("atxHeadingSequence"); - return atBreak(code); - } - return nok(code); - } - function atBreak(code) { - if (code === 35) { - effects.enter("atxHeadingSequence"); - return sequenceFurther(code); - } - if (code === null || markdownLineEnding(code)) { - effects.exit("atxHeading"); - return ok(code); - } - if (markdownSpace(code)) { - return factorySpace(effects, atBreak, "whitespace")(code); - } - effects.enter("atxHeadingText"); - return data(code); - } - function sequenceFurther(code) { - if (code === 35) { - effects.consume(code); - return sequenceFurther; - } - effects.exit("atxHeadingSequence"); - return atBreak(code); - } - function data(code) { - if (code === null || code === 35 || markdownLineEndingOrSpace(code)) { - effects.exit("atxHeadingText"); - return atBreak(code); - } - effects.consume(code); - return data; - } -} - -const htmlBlockNames = [ - 'address', - 'article', - 'aside', - 'base', - 'basefont', - 'blockquote', - 'body', - 'caption', - 'center', - 'col', - 'colgroup', - 'dd', - 'details', - 'dialog', - 'dir', - 'div', - 'dl', - 'dt', - 'fieldset', - 'figcaption', - 'figure', - 'footer', - 'form', - 'frame', - 'frameset', - 'h1', - 'h2', - 'h3', - 'h4', - 'h5', - 'h6', - 'head', - 'header', - 'hr', - 'html', - 'iframe', - 'legend', - 'li', - 'link', - 'main', - 'menu', - 'menuitem', - 'nav', - 'noframes', - 'ol', - 'optgroup', - 'option', - 'p', - 'param', - 'search', - 'section', - 'summary', - 'table', - 'tbody', - 'td', - 'tfoot', - 'th', - 'thead', - 'title', - 'tr', - 'track', - 'ul' -]; -const htmlRawNames = ['pre', 'script', 'style', 'textarea']; - -const htmlFlow = { - name: 'htmlFlow', - tokenize: tokenizeHtmlFlow, - resolveTo: resolveToHtmlFlow, - concrete: true -}; -const blankLineBefore = { - tokenize: tokenizeBlankLineBefore, - partial: true -}; -const nonLazyContinuationStart = { - tokenize: tokenizeNonLazyContinuationStart, - partial: true -}; -function resolveToHtmlFlow(events) { - let index = events.length; - while (index--) { - if (events[index][0] === 'enter' && events[index][1].type === "htmlFlow") { - break; - } - } - if (index > 1 && events[index - 2][1].type === "linePrefix") { - events[index][1].start = events[index - 2][1].start; - events[index + 1][1].start = events[index - 2][1].start; - events.splice(index - 2, 2); - } - return events; -} -function tokenizeHtmlFlow(effects, ok, nok) { - const self = this; - let marker; - let closingTag; - let buffer; - let index; - let markerB; - return start; - function start(code) { - return before(code); - } - function before(code) { - effects.enter("htmlFlow"); - effects.enter("htmlFlowData"); - effects.consume(code); - return open; - } - function open(code) { - if (code === 33) { - effects.consume(code); - return declarationOpen; - } - if (code === 47) { - effects.consume(code); - closingTag = true; - return tagCloseStart; - } - if (code === 63) { - effects.consume(code); - marker = 3; - return self.interrupt ? ok : continuationDeclarationInside; - } - if (asciiAlpha(code)) { - effects.consume(code); - buffer = String.fromCharCode(code); - return tagName; - } - return nok(code); - } - function declarationOpen(code) { - if (code === 45) { - effects.consume(code); - marker = 2; - return commentOpenInside; - } - if (code === 91) { - effects.consume(code); - marker = 5; - index = 0; - return cdataOpenInside; - } - if (asciiAlpha(code)) { - effects.consume(code); - marker = 4; - return self.interrupt ? ok : continuationDeclarationInside; - } - return nok(code); - } - function commentOpenInside(code) { - if (code === 45) { - effects.consume(code); - return self.interrupt ? ok : continuationDeclarationInside; - } - return nok(code); - } - function cdataOpenInside(code) { - const value = "CDATA["; - if (code === value.charCodeAt(index++)) { - effects.consume(code); - if (index === value.length) { - return self.interrupt ? ok : continuation; - } - return cdataOpenInside; - } - return nok(code); - } - function tagCloseStart(code) { - if (asciiAlpha(code)) { - effects.consume(code); - buffer = String.fromCharCode(code); - return tagName; - } - return nok(code); - } - function tagName(code) { - if (code === null || code === 47 || code === 62 || markdownLineEndingOrSpace(code)) { - const slash = code === 47; - const name = buffer.toLowerCase(); - if (!slash && !closingTag && htmlRawNames.includes(name)) { - marker = 1; - return self.interrupt ? ok(code) : continuation(code); - } - if (htmlBlockNames.includes(buffer.toLowerCase())) { - marker = 6; - if (slash) { - effects.consume(code); - return basicSelfClosing; - } - return self.interrupt ? ok(code) : continuation(code); - } - marker = 7; - return self.interrupt && !self.parser.lazy[self.now().line] ? nok(code) : closingTag ? completeClosingTagAfter(code) : completeAttributeNameBefore(code); - } - if (code === 45 || asciiAlphanumeric(code)) { - effects.consume(code); - buffer += String.fromCharCode(code); - return tagName; - } - return nok(code); - } - function basicSelfClosing(code) { - if (code === 62) { - effects.consume(code); - return self.interrupt ? ok : continuation; - } - return nok(code); - } - function completeClosingTagAfter(code) { - if (markdownSpace(code)) { - effects.consume(code); - return completeClosingTagAfter; - } - return completeEnd(code); - } - function completeAttributeNameBefore(code) { - if (code === 47) { - effects.consume(code); - return completeEnd; - } - if (code === 58 || code === 95 || asciiAlpha(code)) { - effects.consume(code); - return completeAttributeName; - } - if (markdownSpace(code)) { - effects.consume(code); - return completeAttributeNameBefore; - } - return completeEnd(code); - } - function completeAttributeName(code) { - if (code === 45 || code === 46 || code === 58 || code === 95 || asciiAlphanumeric(code)) { - effects.consume(code); - return completeAttributeName; - } - return completeAttributeNameAfter(code); - } - function completeAttributeNameAfter(code) { - if (code === 61) { - effects.consume(code); - return completeAttributeValueBefore; - } - if (markdownSpace(code)) { - effects.consume(code); - return completeAttributeNameAfter; - } - return completeAttributeNameBefore(code); - } - function completeAttributeValueBefore(code) { - if (code === null || code === 60 || code === 61 || code === 62 || code === 96) { - return nok(code); - } - if (code === 34 || code === 39) { - effects.consume(code); - markerB = code; - return completeAttributeValueQuoted; - } - if (markdownSpace(code)) { - effects.consume(code); - return completeAttributeValueBefore; - } - return completeAttributeValueUnquoted(code); - } - function completeAttributeValueQuoted(code) { - if (code === markerB) { - effects.consume(code); - markerB = null; - return completeAttributeValueQuotedAfter; - } - if (code === null || markdownLineEnding(code)) { - return nok(code); - } - effects.consume(code); - return completeAttributeValueQuoted; - } - function completeAttributeValueUnquoted(code) { - if (code === null || code === 34 || code === 39 || code === 47 || code === 60 || code === 61 || code === 62 || code === 96 || markdownLineEndingOrSpace(code)) { - return completeAttributeNameAfter(code); - } - effects.consume(code); - return completeAttributeValueUnquoted; - } - function completeAttributeValueQuotedAfter(code) { - if (code === 47 || code === 62 || markdownSpace(code)) { - return completeAttributeNameBefore(code); - } - return nok(code); - } - function completeEnd(code) { - if (code === 62) { - effects.consume(code); - return completeAfter; - } - return nok(code); - } - function completeAfter(code) { - if (code === null || markdownLineEnding(code)) { - return continuation(code); - } - if (markdownSpace(code)) { - effects.consume(code); - return completeAfter; - } - return nok(code); - } - function continuation(code) { - if (code === 45 && marker === 2) { - effects.consume(code); - return continuationCommentInside; - } - if (code === 60 && marker === 1) { - effects.consume(code); - return continuationRawTagOpen; - } - if (code === 62 && marker === 4) { - effects.consume(code); - return continuationClose; - } - if (code === 63 && marker === 3) { - effects.consume(code); - return continuationDeclarationInside; - } - if (code === 93 && marker === 5) { - effects.consume(code); - return continuationCdataInside; - } - if (markdownLineEnding(code) && (marker === 6 || marker === 7)) { - effects.exit("htmlFlowData"); - return effects.check(blankLineBefore, continuationAfter, continuationStart)(code); - } - if (code === null || markdownLineEnding(code)) { - effects.exit("htmlFlowData"); - return continuationStart(code); - } - effects.consume(code); - return continuation; - } - function continuationStart(code) { - return effects.check(nonLazyContinuationStart, continuationStartNonLazy, continuationAfter)(code); - } - function continuationStartNonLazy(code) { - effects.enter("lineEnding"); - effects.consume(code); - effects.exit("lineEnding"); - return continuationBefore; - } - function continuationBefore(code) { - if (code === null || markdownLineEnding(code)) { - return continuationStart(code); - } - effects.enter("htmlFlowData"); - return continuation(code); - } - function continuationCommentInside(code) { - if (code === 45) { - effects.consume(code); - return continuationDeclarationInside; - } - return continuation(code); - } - function continuationRawTagOpen(code) { - if (code === 47) { - effects.consume(code); - buffer = ''; - return continuationRawEndTag; - } - return continuation(code); - } - function continuationRawEndTag(code) { - if (code === 62) { - const name = buffer.toLowerCase(); - if (htmlRawNames.includes(name)) { - effects.consume(code); - return continuationClose; - } - return continuation(code); - } - if (asciiAlpha(code) && buffer.length < 8) { - effects.consume(code); - buffer += String.fromCharCode(code); - return continuationRawEndTag; - } - return continuation(code); - } - function continuationCdataInside(code) { - if (code === 93) { - effects.consume(code); - return continuationDeclarationInside; - } - return continuation(code); - } - function continuationDeclarationInside(code) { - if (code === 62) { - effects.consume(code); - return continuationClose; - } - if (code === 45 && marker === 2) { - effects.consume(code); - return continuationDeclarationInside; - } - return continuation(code); - } - function continuationClose(code) { - if (code === null || markdownLineEnding(code)) { - effects.exit("htmlFlowData"); - return continuationAfter(code); - } - effects.consume(code); - return continuationClose; - } - function continuationAfter(code) { - effects.exit("htmlFlow"); - return ok(code); - } -} -function tokenizeNonLazyContinuationStart(effects, ok, nok) { - const self = this; - return start; - function start(code) { - if (markdownLineEnding(code)) { - effects.enter("lineEnding"); - effects.consume(code); - effects.exit("lineEnding"); - return after; - } - return nok(code); - } - function after(code) { - return self.parser.lazy[self.now().line] ? nok(code) : ok(code); - } -} -function tokenizeBlankLineBefore(effects, ok, nok) { - return start; - function start(code) { - effects.enter("lineEnding"); - effects.consume(code); - effects.exit("lineEnding"); - return effects.attempt(blankLine, ok, nok); - } -} - -const htmlText = { - name: 'htmlText', - tokenize: tokenizeHtmlText -}; -function tokenizeHtmlText(effects, ok, nok) { - const self = this; - let marker; - let index; - let returnState; - return start; - function start(code) { - effects.enter("htmlText"); - effects.enter("htmlTextData"); - effects.consume(code); - return open; - } - function open(code) { - if (code === 33) { - effects.consume(code); - return declarationOpen; - } - if (code === 47) { - effects.consume(code); - return tagCloseStart; - } - if (code === 63) { - effects.consume(code); - return instruction; - } - if (asciiAlpha(code)) { - effects.consume(code); - return tagOpen; - } - return nok(code); - } - function declarationOpen(code) { - if (code === 45) { - effects.consume(code); - return commentOpenInside; - } - if (code === 91) { - effects.consume(code); - index = 0; - return cdataOpenInside; - } - if (asciiAlpha(code)) { - effects.consume(code); - return declaration; - } - return nok(code); - } - function commentOpenInside(code) { - if (code === 45) { - effects.consume(code); - return commentEnd; - } - return nok(code); - } - function comment(code) { - if (code === null) { - return nok(code); - } - if (code === 45) { - effects.consume(code); - return commentClose; - } - if (markdownLineEnding(code)) { - returnState = comment; - return lineEndingBefore(code); - } - effects.consume(code); - return comment; - } - function commentClose(code) { - if (code === 45) { - effects.consume(code); - return commentEnd; - } - return comment(code); - } - function commentEnd(code) { - return code === 62 ? end(code) : code === 45 ? commentClose(code) : comment(code); - } - function cdataOpenInside(code) { - const value = "CDATA["; - if (code === value.charCodeAt(index++)) { - effects.consume(code); - return index === value.length ? cdata : cdataOpenInside; - } - return nok(code); - } - function cdata(code) { - if (code === null) { - return nok(code); - } - if (code === 93) { - effects.consume(code); - return cdataClose; - } - if (markdownLineEnding(code)) { - returnState = cdata; - return lineEndingBefore(code); - } - effects.consume(code); - return cdata; - } - function cdataClose(code) { - if (code === 93) { - effects.consume(code); - return cdataEnd; - } - return cdata(code); - } - function cdataEnd(code) { - if (code === 62) { - return end(code); - } - if (code === 93) { - effects.consume(code); - return cdataEnd; - } - return cdata(code); - } - function declaration(code) { - if (code === null || code === 62) { - return end(code); - } - if (markdownLineEnding(code)) { - returnState = declaration; - return lineEndingBefore(code); - } - effects.consume(code); - return declaration; - } - function instruction(code) { - if (code === null) { - return nok(code); - } - if (code === 63) { - effects.consume(code); - return instructionClose; - } - if (markdownLineEnding(code)) { - returnState = instruction; - return lineEndingBefore(code); - } - effects.consume(code); - return instruction; - } - function instructionClose(code) { - return code === 62 ? end(code) : instruction(code); - } - function tagCloseStart(code) { - if (asciiAlpha(code)) { - effects.consume(code); - return tagClose; - } - return nok(code); - } - function tagClose(code) { - if (code === 45 || asciiAlphanumeric(code)) { - effects.consume(code); - return tagClose; - } - return tagCloseBetween(code); - } - function tagCloseBetween(code) { - if (markdownLineEnding(code)) { - returnState = tagCloseBetween; - return lineEndingBefore(code); - } - if (markdownSpace(code)) { - effects.consume(code); - return tagCloseBetween; - } - return end(code); - } - function tagOpen(code) { - if (code === 45 || asciiAlphanumeric(code)) { - effects.consume(code); - return tagOpen; - } - if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) { - return tagOpenBetween(code); - } - return nok(code); - } - function tagOpenBetween(code) { - if (code === 47) { - effects.consume(code); - return end; - } - if (code === 58 || code === 95 || asciiAlpha(code)) { - effects.consume(code); - return tagOpenAttributeName; - } - if (markdownLineEnding(code)) { - returnState = tagOpenBetween; - return lineEndingBefore(code); - } - if (markdownSpace(code)) { - effects.consume(code); - return tagOpenBetween; - } - return end(code); - } - function tagOpenAttributeName(code) { - if (code === 45 || code === 46 || code === 58 || code === 95 || asciiAlphanumeric(code)) { - effects.consume(code); - return tagOpenAttributeName; - } - return tagOpenAttributeNameAfter(code); - } - function tagOpenAttributeNameAfter(code) { - if (code === 61) { - effects.consume(code); - return tagOpenAttributeValueBefore; - } - if (markdownLineEnding(code)) { - returnState = tagOpenAttributeNameAfter; - return lineEndingBefore(code); - } - if (markdownSpace(code)) { - effects.consume(code); - return tagOpenAttributeNameAfter; - } - return tagOpenBetween(code); - } - function tagOpenAttributeValueBefore(code) { - if (code === null || code === 60 || code === 61 || code === 62 || code === 96) { - return nok(code); - } - if (code === 34 || code === 39) { - effects.consume(code); - marker = code; - return tagOpenAttributeValueQuoted; - } - if (markdownLineEnding(code)) { - returnState = tagOpenAttributeValueBefore; - return lineEndingBefore(code); - } - if (markdownSpace(code)) { - effects.consume(code); - return tagOpenAttributeValueBefore; - } - effects.consume(code); - return tagOpenAttributeValueUnquoted; - } - function tagOpenAttributeValueQuoted(code) { - if (code === marker) { - effects.consume(code); - marker = undefined; - return tagOpenAttributeValueQuotedAfter; - } - if (code === null) { - return nok(code); - } - if (markdownLineEnding(code)) { - returnState = tagOpenAttributeValueQuoted; - return lineEndingBefore(code); - } - effects.consume(code); - return tagOpenAttributeValueQuoted; - } - function tagOpenAttributeValueUnquoted(code) { - if (code === null || code === 34 || code === 39 || code === 60 || code === 61 || code === 96) { - return nok(code); - } - if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) { - return tagOpenBetween(code); - } - effects.consume(code); - return tagOpenAttributeValueUnquoted; - } - function tagOpenAttributeValueQuotedAfter(code) { - if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) { - return tagOpenBetween(code); - } - return nok(code); - } - function end(code) { - if (code === 62) { - effects.consume(code); - effects.exit("htmlTextData"); - effects.exit("htmlText"); - return ok; - } - return nok(code); - } - function lineEndingBefore(code) { - effects.exit("htmlTextData"); - effects.enter("lineEnding"); - effects.consume(code); - effects.exit("lineEnding"); - return lineEndingAfter; - } - function lineEndingAfter(code) { - return markdownSpace(code) ? factorySpace(effects, lineEndingAfterPrefix, "linePrefix", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4)(code) : lineEndingAfterPrefix(code); - } - function lineEndingAfterPrefix(code) { - effects.enter("htmlTextData"); - return returnState(code); - } -} - -const labelEnd = { - name: 'labelEnd', - tokenize: tokenizeLabelEnd, - resolveTo: resolveToLabelEnd, - resolveAll: resolveAllLabelEnd -}; -const resourceConstruct = { - tokenize: tokenizeResource -}; -const referenceFullConstruct = { - tokenize: tokenizeReferenceFull -}; -const referenceCollapsedConstruct = { - tokenize: tokenizeReferenceCollapsed -}; -function resolveAllLabelEnd(events) { - let index = -1; - while (++index < events.length) { - const token = events[index][1]; - if (token.type === "labelImage" || token.type === "labelLink" || token.type === "labelEnd") { - events.splice(index + 1, token.type === "labelImage" ? 4 : 2); - token.type = "data"; - index++; - } - } - return events; -} -function resolveToLabelEnd(events, context) { - let index = events.length; - let offset = 0; - let token; - let open; - let close; - let media; - while (index--) { - token = events[index][1]; - if (open) { - if (token.type === "link" || token.type === "labelLink" && token._inactive) { - break; - } - if (events[index][0] === 'enter' && token.type === "labelLink") { - token._inactive = true; - } - } else if (close) { - if (events[index][0] === 'enter' && (token.type === "labelImage" || token.type === "labelLink") && !token._balanced) { - open = index; - if (token.type !== "labelLink") { - offset = 2; - break; - } - } - } else if (token.type === "labelEnd") { - close = index; - } - } - const group = { - type: events[open][1].type === "labelLink" ? "link" : "image", - start: Object.assign({}, events[open][1].start), - end: Object.assign({}, events[events.length - 1][1].end) - }; - const label = { - type: "label", - start: Object.assign({}, events[open][1].start), - end: Object.assign({}, events[close][1].end) - }; - const text = { - type: "labelText", - start: Object.assign({}, events[open + offset + 2][1].end), - end: Object.assign({}, events[close - 2][1].start) - }; - media = [['enter', group, context], ['enter', label, context]]; - media = push(media, events.slice(open + 1, open + offset + 3)); - media = push(media, [['enter', text, context]]); - media = push(media, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open + offset + 4, close - 3), context)); - media = push(media, [['exit', text, context], events[close - 2], events[close - 1], ['exit', label, context]]); - media = push(media, events.slice(close + 1)); - media = push(media, [['exit', group, context]]); - splice(events, open, events.length, media); - return events; -} -function tokenizeLabelEnd(effects, ok, nok) { - const self = this; - let index = self.events.length; - let labelStart; - let defined; - while (index--) { - if ((self.events[index][1].type === "labelImage" || self.events[index][1].type === "labelLink") && !self.events[index][1]._balanced) { - labelStart = self.events[index][1]; - break; - } - } - return start; - function start(code) { - if (!labelStart) { - return nok(code); - } - if (labelStart._inactive) { - return labelEndNok(code); - } - defined = self.parser.defined.includes(normalizeIdentifier(self.sliceSerialize({ - start: labelStart.end, - end: self.now() - }))); - effects.enter("labelEnd"); - effects.enter("labelMarker"); - effects.consume(code); - effects.exit("labelMarker"); - effects.exit("labelEnd"); - return after; - } - function after(code) { - if (code === 40) { - return effects.attempt(resourceConstruct, labelEndOk, defined ? labelEndOk : labelEndNok)(code); - } - if (code === 91) { - return effects.attempt(referenceFullConstruct, labelEndOk, defined ? referenceNotFull : labelEndNok)(code); - } - return defined ? labelEndOk(code) : labelEndNok(code); - } - function referenceNotFull(code) { - return effects.attempt(referenceCollapsedConstruct, labelEndOk, labelEndNok)(code); - } - function labelEndOk(code) { - return ok(code); - } - function labelEndNok(code) { - labelStart._balanced = true; - return nok(code); - } -} -function tokenizeResource(effects, ok, nok) { - return resourceStart; - function resourceStart(code) { - effects.enter("resource"); - effects.enter("resourceMarker"); - effects.consume(code); - effects.exit("resourceMarker"); - return resourceBefore; - } - function resourceBefore(code) { - return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, resourceOpen)(code) : resourceOpen(code); - } - function resourceOpen(code) { - if (code === 41) { - return resourceEnd(code); - } - return factoryDestination(effects, resourceDestinationAfter, resourceDestinationMissing, "resourceDestination", "resourceDestinationLiteral", "resourceDestinationLiteralMarker", "resourceDestinationRaw", "resourceDestinationString", 32)(code); - } - function resourceDestinationAfter(code) { - return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, resourceBetween)(code) : resourceEnd(code); - } - function resourceDestinationMissing(code) { - return nok(code); - } - function resourceBetween(code) { - if (code === 34 || code === 39 || code === 40) { - return factoryTitle(effects, resourceTitleAfter, nok, "resourceTitle", "resourceTitleMarker", "resourceTitleString")(code); - } - return resourceEnd(code); - } - function resourceTitleAfter(code) { - return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, resourceEnd)(code) : resourceEnd(code); - } - function resourceEnd(code) { - if (code === 41) { - effects.enter("resourceMarker"); - effects.consume(code); - effects.exit("resourceMarker"); - effects.exit("resource"); - return ok; - } - return nok(code); - } -} -function tokenizeReferenceFull(effects, ok, nok) { - const self = this; - return referenceFull; - function referenceFull(code) { - return factoryLabel.call(self, effects, referenceFullAfter, referenceFullMissing, "reference", "referenceMarker", "referenceString")(code); - } - function referenceFullAfter(code) { - return self.parser.defined.includes(normalizeIdentifier(self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1))) ? ok(code) : nok(code); - } - function referenceFullMissing(code) { - return nok(code); - } -} -function tokenizeReferenceCollapsed(effects, ok, nok) { - return referenceCollapsedStart; - function referenceCollapsedStart(code) { - effects.enter("reference"); - effects.enter("referenceMarker"); - effects.consume(code); - effects.exit("referenceMarker"); - return referenceCollapsedOpen; - } - function referenceCollapsedOpen(code) { - if (code === 93) { - effects.enter("referenceMarker"); - effects.consume(code); - effects.exit("referenceMarker"); - effects.exit("reference"); - return ok; - } - return nok(code); - } -} - -const labelStartImage = { - name: 'labelStartImage', - tokenize: tokenizeLabelStartImage, - resolveAll: labelEnd.resolveAll -}; -function tokenizeLabelStartImage(effects, ok, nok) { - const self = this; - return start; - function start(code) { - effects.enter("labelImage"); - effects.enter("labelImageMarker"); - effects.consume(code); - effects.exit("labelImageMarker"); - return open; - } - function open(code) { - if (code === 91) { - effects.enter("labelMarker"); - effects.consume(code); - effects.exit("labelMarker"); - effects.exit("labelImage"); - return after; - } - return nok(code); - } - function after(code) { - return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs ? nok(code) : ok(code); - } -} - -const labelStartLink = { - name: 'labelStartLink', - tokenize: tokenizeLabelStartLink, - resolveAll: labelEnd.resolveAll -}; -function tokenizeLabelStartLink(effects, ok, nok) { - const self = this; - return start; - function start(code) { - effects.enter("labelLink"); - effects.enter("labelMarker"); - effects.consume(code); - effects.exit("labelMarker"); - effects.exit("labelLink"); - return after; - } - function after(code) { - return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs ? nok(code) : ok(code); - } -} - -const lineEnding = { - name: 'lineEnding', - tokenize: tokenizeLineEnding -}; -function tokenizeLineEnding(effects, ok) { - return start; - function start(code) { - effects.enter("lineEnding"); - effects.consume(code); - effects.exit("lineEnding"); - return factorySpace(effects, ok, "linePrefix"); - } -} - -const thematicBreak$1 = { - name: 'thematicBreak', - tokenize: tokenizeThematicBreak -}; -function tokenizeThematicBreak(effects, ok, nok) { - let size = 0; - let marker; - return start; - function start(code) { - effects.enter("thematicBreak"); - return before(code); - } - function before(code) { - marker = code; - return atBreak(code); - } - function atBreak(code) { - if (code === marker) { - effects.enter("thematicBreakSequence"); - return sequence(code); - } - if (size >= 3 && (code === null || markdownLineEnding(code))) { - effects.exit("thematicBreak"); - return ok(code); - } - return nok(code); - } - function sequence(code) { - if (code === marker) { - effects.consume(code); - size++; - return sequence; - } - effects.exit("thematicBreakSequence"); - return markdownSpace(code) ? factorySpace(effects, atBreak, "whitespace")(code) : atBreak(code); - } -} - -const list$2 = { - name: 'list', - tokenize: tokenizeListStart, - continuation: { - tokenize: tokenizeListContinuation - }, - exit: tokenizeListEnd -}; -const listItemPrefixWhitespaceConstruct = { - tokenize: tokenizeListItemPrefixWhitespace, - partial: true -}; -const indentConstruct = { - tokenize: tokenizeIndent$1, - partial: true -}; -function tokenizeListStart(effects, ok, nok) { - const self = this; - const tail = self.events[self.events.length - 1]; - let initialSize = tail && tail[1].type === "linePrefix" ? tail[2].sliceSerialize(tail[1], true).length : 0; - let size = 0; - return start; - function start(code) { - const kind = self.containerState.type || (code === 42 || code === 43 || code === 45 ? "listUnordered" : "listOrdered"); - if (kind === "listUnordered" ? !self.containerState.marker || code === self.containerState.marker : asciiDigit(code)) { - if (!self.containerState.type) { - self.containerState.type = kind; - effects.enter(kind, { - _container: true - }); - } - if (kind === "listUnordered") { - effects.enter("listItemPrefix"); - return code === 42 || code === 45 ? effects.check(thematicBreak$1, nok, atMarker)(code) : atMarker(code); - } - if (!self.interrupt || code === 49) { - effects.enter("listItemPrefix"); - effects.enter("listItemValue"); - return inside(code); - } - } - return nok(code); - } - function inside(code) { - if (asciiDigit(code) && ++size < 10) { - effects.consume(code); - return inside; - } - if ((!self.interrupt || size < 2) && (self.containerState.marker ? code === self.containerState.marker : code === 41 || code === 46)) { - effects.exit("listItemValue"); - return atMarker(code); - } - return nok(code); - } - function atMarker(code) { - effects.enter("listItemMarker"); - effects.consume(code); - effects.exit("listItemMarker"); - self.containerState.marker = self.containerState.marker || code; - return effects.check(blankLine, - self.interrupt ? nok : onBlank, effects.attempt(listItemPrefixWhitespaceConstruct, endOfPrefix, otherPrefix)); - } - function onBlank(code) { - self.containerState.initialBlankLine = true; - initialSize++; - return endOfPrefix(code); - } - function otherPrefix(code) { - if (markdownSpace(code)) { - effects.enter("listItemPrefixWhitespace"); - effects.consume(code); - effects.exit("listItemPrefixWhitespace"); - return endOfPrefix; - } - return nok(code); - } - function endOfPrefix(code) { - self.containerState.size = initialSize + self.sliceSerialize(effects.exit("listItemPrefix"), true).length; - return ok(code); - } -} -function tokenizeListContinuation(effects, ok, nok) { - const self = this; - self.containerState._closeFlow = undefined; - return effects.check(blankLine, onBlank, notBlank); - function onBlank(code) { - self.containerState.furtherBlankLines = self.containerState.furtherBlankLines || self.containerState.initialBlankLine; - return factorySpace(effects, ok, "listItemIndent", self.containerState.size + 1)(code); - } - function notBlank(code) { - if (self.containerState.furtherBlankLines || !markdownSpace(code)) { - self.containerState.furtherBlankLines = undefined; - self.containerState.initialBlankLine = undefined; - return notInCurrentItem(code); - } - self.containerState.furtherBlankLines = undefined; - self.containerState.initialBlankLine = undefined; - return effects.attempt(indentConstruct, ok, notInCurrentItem)(code); - } - function notInCurrentItem(code) { - self.containerState._closeFlow = true; - self.interrupt = undefined; - return factorySpace(effects, effects.attempt(list$2, ok, nok), "linePrefix", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4)(code); - } -} -function tokenizeIndent$1(effects, ok, nok) { - const self = this; - return factorySpace(effects, afterPrefix, "listItemIndent", self.containerState.size + 1); - function afterPrefix(code) { - const tail = self.events[self.events.length - 1]; - return tail && tail[1].type === "listItemIndent" && tail[2].sliceSerialize(tail[1], true).length === self.containerState.size ? ok(code) : nok(code); - } -} -function tokenizeListEnd(effects) { - effects.exit(this.containerState.type); -} -function tokenizeListItemPrefixWhitespace(effects, ok, nok) { - const self = this; - return factorySpace(effects, afterPrefix, "listItemPrefixWhitespace", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4 + 1); - function afterPrefix(code) { - const tail = self.events[self.events.length - 1]; - return !markdownSpace(code) && tail && tail[1].type === "listItemPrefixWhitespace" ? ok(code) : nok(code); - } -} - -const setextUnderline = { - name: 'setextUnderline', - tokenize: tokenizeSetextUnderline, - resolveTo: resolveToSetextUnderline -}; -function resolveToSetextUnderline(events, context) { - let index = events.length; - let content; - let text; - let definition; - while (index--) { - if (events[index][0] === 'enter') { - if (events[index][1].type === "content") { - content = index; - break; - } - if (events[index][1].type === "paragraph") { - text = index; - } - } - else { - if (events[index][1].type === "content") { - events.splice(index, 1); - } - if (!definition && events[index][1].type === "definition") { - definition = index; - } - } - } - const heading = { - type: "setextHeading", - start: Object.assign({}, events[text][1].start), - end: Object.assign({}, events[events.length - 1][1].end) - }; - events[text][1].type = "setextHeadingText"; - if (definition) { - events.splice(text, 0, ['enter', heading, context]); - events.splice(definition + 1, 0, ['exit', events[content][1], context]); - events[content][1].end = Object.assign({}, events[definition][1].end); - } else { - events[content][1] = heading; - } - events.push(['exit', heading, context]); - return events; -} -function tokenizeSetextUnderline(effects, ok, nok) { - const self = this; - let marker; - return start; - function start(code) { - let index = self.events.length; - let paragraph; - while (index--) { - if (self.events[index][1].type !== "lineEnding" && self.events[index][1].type !== "linePrefix" && self.events[index][1].type !== "content") { - paragraph = self.events[index][1].type === "paragraph"; - break; - } - } - if (!self.parser.lazy[self.now().line] && (self.interrupt || paragraph)) { - effects.enter("setextHeadingLine"); - marker = code; - return before(code); - } - return nok(code); - } - function before(code) { - effects.enter("setextHeadingLineSequence"); - return inside(code); - } - function inside(code) { - if (code === marker) { - effects.consume(code); - return inside; - } - effects.exit("setextHeadingLineSequence"); - return markdownSpace(code) ? factorySpace(effects, after, "lineSuffix")(code) : after(code); - } - function after(code) { - if (code === null || markdownLineEnding(code)) { - effects.exit("setextHeadingLine"); - return ok(code); - } - return nok(code); - } -} - -const flow$1 = { - tokenize: initializeFlow -}; -function initializeFlow(effects) { - const self = this; - const initial = effects.attempt( - blankLine, - atBlankEnding, - effects.attempt( - this.parser.constructs.flowInitial, - afterConstruct, - factorySpace( - effects, - effects.attempt( - this.parser.constructs.flow, - afterConstruct, - effects.attempt(content, afterConstruct) - ), - 'linePrefix' - ) - ) - ); - return initial - function atBlankEnding(code) { - if (code === null) { - effects.consume(code); - return - } - effects.enter('lineEndingBlank'); - effects.consume(code); - effects.exit('lineEndingBlank'); - self.currentConstruct = undefined; - return initial - } - function afterConstruct(code) { - if (code === null) { - effects.consume(code); - return - } - effects.enter('lineEnding'); - effects.consume(code); - effects.exit('lineEnding'); - self.currentConstruct = undefined; - return initial - } -} - -const resolver = { - resolveAll: createResolver() -}; -const string$1 = initializeFactory('string'); -const text$3 = initializeFactory('text'); -function initializeFactory(field) { - return { - tokenize: initializeText, - resolveAll: createResolver( - field === 'text' ? resolveAllLineSuffixes : undefined - ) - } - function initializeText(effects) { - const self = this; - const constructs = this.parser.constructs[field]; - const text = effects.attempt(constructs, start, notText); - return start - function start(code) { - return atBreak(code) ? text(code) : notText(code) - } - function notText(code) { - if (code === null) { - effects.consume(code); - return - } - effects.enter('data'); - effects.consume(code); - return data - } - function data(code) { - if (atBreak(code)) { - effects.exit('data'); - return text(code) - } - effects.consume(code); - return data - } - function atBreak(code) { - if (code === null) { - return true - } - const list = constructs[code]; - let index = -1; - if (list) { - while (++index < list.length) { - const item = list[index]; - if (!item.previous || item.previous.call(self, self.previous)) { - return true - } - } - } - return false - } - } -} -function createResolver(extraResolver) { - return resolveAllText - function resolveAllText(events, context) { - let index = -1; - let enter; - while (++index <= events.length) { - if (enter === undefined) { - if (events[index] && events[index][1].type === 'data') { - enter = index; - index++; - } - } else if (!events[index] || events[index][1].type !== 'data') { - if (index !== enter + 2) { - events[enter][1].end = events[index - 1][1].end; - events.splice(enter + 2, index - enter - 2); - index = enter + 2; - } - enter = undefined; - } - } - return extraResolver ? extraResolver(events, context) : events - } -} -function resolveAllLineSuffixes(events, context) { - let eventIndex = 0; - while (++eventIndex <= events.length) { - if ( - (eventIndex === events.length || - events[eventIndex][1].type === 'lineEnding') && - events[eventIndex - 1][1].type === 'data' - ) { - const data = events[eventIndex - 1][1]; - const chunks = context.sliceStream(data); - let index = chunks.length; - let bufferIndex = -1; - let size = 0; - let tabs; - while (index--) { - const chunk = chunks[index]; - if (typeof chunk === 'string') { - bufferIndex = chunk.length; - while (chunk.charCodeAt(bufferIndex - 1) === 32) { - size++; - bufferIndex--; - } - if (bufferIndex) break - bufferIndex = -1; - } - else if (chunk === -2) { - tabs = true; - size++; - } else if (chunk === -1) ; else { - index++; - break - } - } - if (size) { - const token = { - type: - eventIndex === events.length || tabs || size < 2 - ? 'lineSuffix' - : 'hardBreakTrailing', - start: { - line: data.end.line, - column: data.end.column - size, - offset: data.end.offset - size, - _index: data.start._index + index, - _bufferIndex: index - ? bufferIndex - : data.start._bufferIndex + bufferIndex - }, - end: Object.assign({}, data.end) - }; - data.end = Object.assign({}, token.start); - if (data.start.offset === data.end.offset) { - Object.assign(data, token); - } else { - events.splice( - eventIndex, - 0, - ['enter', token, context], - ['exit', token, context] - ); - eventIndex += 2; - } - } - eventIndex++; - } - } - return events -} - -function createTokenizer(parser, initialize, from) { - let point = Object.assign( - from - ? Object.assign({}, from) - : { - line: 1, - column: 1, - offset: 0 - }, - { - _index: 0, - _bufferIndex: -1 - } - ); - const columnStart = {}; - const resolveAllConstructs = []; - let chunks = []; - let stack = []; - const effects = { - consume, - enter, - exit, - attempt: constructFactory(onsuccessfulconstruct), - check: constructFactory(onsuccessfulcheck), - interrupt: constructFactory(onsuccessfulcheck, { - interrupt: true - }) - }; - const context = { - previous: null, - code: null, - containerState: {}, - events: [], - parser, - sliceStream, - sliceSerialize, - now, - defineSkip, - write - }; - let state = initialize.tokenize.call(context, effects); - if (initialize.resolveAll) { - resolveAllConstructs.push(initialize); - } - return context - function write(slice) { - chunks = push(chunks, slice); - main(); - if (chunks[chunks.length - 1] !== null) { - return [] - } - addResult(initialize, 0); - context.events = resolveAll(resolveAllConstructs, context.events, context); - return context.events - } - function sliceSerialize(token, expandTabs) { - return serializeChunks(sliceStream(token), expandTabs) - } - function sliceStream(token) { - return sliceChunks(chunks, token) - } - function now() { - const {line, column, offset, _index, _bufferIndex} = point; - return { - line, - column, - offset, - _index, - _bufferIndex - } - } - function defineSkip(value) { - columnStart[value.line] = value.column; - accountForPotentialSkip(); - } - function main() { - let chunkIndex; - while (point._index < chunks.length) { - const chunk = chunks[point._index]; - if (typeof chunk === 'string') { - chunkIndex = point._index; - if (point._bufferIndex < 0) { - point._bufferIndex = 0; - } - while ( - point._index === chunkIndex && - point._bufferIndex < chunk.length - ) { - go(chunk.charCodeAt(point._bufferIndex)); - } - } else { - go(chunk); - } - } - } - function go(code) { - state = state(code); - } - function consume(code) { - if (markdownLineEnding(code)) { - point.line++; - point.column = 1; - point.offset += code === -3 ? 2 : 1; - accountForPotentialSkip(); - } else if (code !== -1) { - point.column++; - point.offset++; - } - if (point._bufferIndex < 0) { - point._index++; - } else { - point._bufferIndex++; - if (point._bufferIndex === chunks[point._index].length) { - point._bufferIndex = -1; - point._index++; - } - } - context.previous = code; - } - function enter(type, fields) { - const token = fields || {}; - token.type = type; - token.start = now(); - context.events.push(['enter', token, context]); - stack.push(token); - return token - } - function exit(type) { - const token = stack.pop(); - token.end = now(); - context.events.push(['exit', token, context]); - return token - } - function onsuccessfulconstruct(construct, info) { - addResult(construct, info.from); - } - function onsuccessfulcheck(_, info) { - info.restore(); - } - function constructFactory(onreturn, fields) { - return hook - function hook(constructs, returnState, bogusState) { - let listOfConstructs; - let constructIndex; - let currentConstruct; - let info; - return Array.isArray(constructs) - ? handleListOfConstructs(constructs) - : 'tokenize' in constructs - ? - handleListOfConstructs([constructs]) - : handleMapOfConstructs(constructs) - function handleMapOfConstructs(map) { - return start - function start(code) { - const def = code !== null && map[code]; - const all = code !== null && map.null; - const list = [ - ...(Array.isArray(def) ? def : def ? [def] : []), - ...(Array.isArray(all) ? all : all ? [all] : []) - ]; - return handleListOfConstructs(list)(code) - } - } - function handleListOfConstructs(list) { - listOfConstructs = list; - constructIndex = 0; - if (list.length === 0) { - return bogusState - } - return handleConstruct(list[constructIndex]) - } - function handleConstruct(construct) { - return start - function start(code) { - info = store(); - currentConstruct = construct; - if (!construct.partial) { - context.currentConstruct = construct; - } - if ( - construct.name && - context.parser.constructs.disable.null.includes(construct.name) - ) { - return nok() - } - return construct.tokenize.call( - fields ? Object.assign(Object.create(context), fields) : context, - effects, - ok, - nok - )(code) - } - } - function ok(code) { - onreturn(currentConstruct, info); - return returnState - } - function nok(code) { - info.restore(); - if (++constructIndex < listOfConstructs.length) { - return handleConstruct(listOfConstructs[constructIndex]) - } - return bogusState - } - } - } - function addResult(construct, from) { - if (construct.resolveAll && !resolveAllConstructs.includes(construct)) { - resolveAllConstructs.push(construct); - } - if (construct.resolve) { - splice( - context.events, - from, - context.events.length - from, - construct.resolve(context.events.slice(from), context) - ); - } - if (construct.resolveTo) { - context.events = construct.resolveTo(context.events, context); - } - } - function store() { - const startPoint = now(); - const startPrevious = context.previous; - const startCurrentConstruct = context.currentConstruct; - const startEventsIndex = context.events.length; - const startStack = Array.from(stack); - return { - restore, - from: startEventsIndex - } - function restore() { - point = startPoint; - context.previous = startPrevious; - context.currentConstruct = startCurrentConstruct; - context.events.length = startEventsIndex; - stack = startStack; - accountForPotentialSkip(); - } - } - function accountForPotentialSkip() { - if (point.line in columnStart && point.column < 2) { - point.column = columnStart[point.line]; - point.offset += columnStart[point.line] - 1; - } - } -} -function sliceChunks(chunks, token) { - const startIndex = token.start._index; - const startBufferIndex = token.start._bufferIndex; - const endIndex = token.end._index; - const endBufferIndex = token.end._bufferIndex; - let view; - if (startIndex === endIndex) { - view = [chunks[startIndex].slice(startBufferIndex, endBufferIndex)]; - } else { - view = chunks.slice(startIndex, endIndex); - if (startBufferIndex > -1) { - const head = view[0]; - if (typeof head === 'string') { - view[0] = head.slice(startBufferIndex); - } else { - view.shift(); - } - } - if (endBufferIndex > 0) { - view.push(chunks[endIndex].slice(0, endBufferIndex)); - } - } - return view -} -function serializeChunks(chunks, expandTabs) { - let index = -1; - const result = []; - let atTab; - while (++index < chunks.length) { - const chunk = chunks[index]; - let value; - if (typeof chunk === 'string') { - value = chunk; - } else - switch (chunk) { - case -5: { - value = '\r'; - break - } - case -4: { - value = '\n'; - break - } - case -3: { - value = '\r' + '\n'; - break - } - case -2: { - value = expandTabs ? ' ' : '\t'; - break - } - case -1: { - if (!expandTabs && atTab) continue - value = ' '; - break - } - default: { - value = String.fromCharCode(chunk); - } - } - atTab = chunk === -2; - result.push(value); - } - return result.join('') -} - -const document = { - [42]: list$2, - [43]: list$2, - [45]: list$2, - [48]: list$2, - [49]: list$2, - [50]: list$2, - [51]: list$2, - [52]: list$2, - [53]: list$2, - [54]: list$2, - [55]: list$2, - [56]: list$2, - [57]: list$2, - [62]: blockQuote -}; -const contentInitial = { - [91]: definition$1 -}; -const flowInitial = { - [-2]: codeIndented, - [-1]: codeIndented, - [32]: codeIndented -}; -const flow = { - [35]: headingAtx, - [42]: thematicBreak$1, - [45]: [setextUnderline, thematicBreak$1], - [60]: htmlFlow, - [61]: setextUnderline, - [95]: thematicBreak$1, - [96]: codeFenced, - [126]: codeFenced -}; -const string = { - [38]: characterReference, - [92]: characterEscape -}; -const text$2 = { - [-5]: lineEnding, - [-4]: lineEnding, - [-3]: lineEnding, - [33]: labelStartImage, - [38]: characterReference, - [42]: attention, - [60]: [autolink, htmlText], - [91]: labelStartLink, - [92]: [hardBreakEscape, characterEscape], - [93]: labelEnd, - [95]: attention, - [96]: codeText -}; -const insideSpan = { - null: [attention, resolver] -}; -const attentionMarkers = { - null: [42, 95] -}; -const disable = { - null: [] -}; - -var defaultConstructs = /*#__PURE__*/Object.freeze({ - __proto__: null, - attentionMarkers: attentionMarkers, - contentInitial: contentInitial, - disable: disable, - document: document, - flow: flow, - flowInitial: flowInitial, - insideSpan: insideSpan, - string: string, - text: text$2 -}); - -function parse$1(options) { - const settings = options || {}; - const constructs = - combineExtensions([defaultConstructs, ...(settings.extensions || [])]); - const parser = { - defined: [], - lazy: {}, - constructs, - content: create(content$1), - document: create(document$1), - flow: create(flow$1), - string: create(string$1), - text: create(text$3) - }; - return parser - function create(initial) { - return creator - function creator(from) { - return createTokenizer(parser, initial, from) - } - } -} - -function postprocess(events) { - while (!subtokenize(events)) { - } - return events -} - -const search = /[\0\t\n\r]/g; -function preprocess() { - let column = 1; - let buffer = ''; - let start = true; - let atCarriageReturn; - return preprocessor - function preprocessor(value, encoding, end) { - const chunks = []; - let match; - let next; - let startPosition; - let endPosition; - let code; - value = - buffer + - (typeof value === 'string' - ? value.toString() - : new TextDecoder(encoding || undefined).decode(value)); - startPosition = 0; - buffer = ''; - if (start) { - if (value.charCodeAt(0) === 65279) { - startPosition++; - } - start = undefined; - } - while (startPosition < value.length) { - search.lastIndex = startPosition; - match = search.exec(value); - endPosition = - match && match.index !== undefined ? match.index : value.length; - code = value.charCodeAt(endPosition); - if (!match) { - buffer = value.slice(startPosition); - break - } - if (code === 10 && startPosition === endPosition && atCarriageReturn) { - chunks.push(-3); - atCarriageReturn = undefined; - } else { - if (atCarriageReturn) { - chunks.push(-5); - atCarriageReturn = undefined; - } - if (startPosition < endPosition) { - chunks.push(value.slice(startPosition, endPosition)); - column += endPosition - startPosition; - } - switch (code) { - case 0: { - chunks.push(65533); - column++; - break - } - case 9: { - next = Math.ceil(column / 4) * 4; - chunks.push(-2); - while (column++ < next) chunks.push(-1); - break - } - case 10: { - chunks.push(-4); - column = 1; - break - } - default: { - atCarriageReturn = true; - column = 1; - } - } - } - startPosition = endPosition + 1; - } - if (end) { - if (atCarriageReturn) chunks.push(-5); - if (buffer) chunks.push(buffer); - chunks.push(null); - } - return chunks - } -} - -const characterEscapeOrReference = - /\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi; -function decodeString(value) { - return value.replace(characterEscapeOrReference, decode) -} -function decode($0, $1, $2) { - if ($1) { - return $1 - } - const head = $2.charCodeAt(0); - if (head === 35) { - const head = $2.charCodeAt(1); - const hex = head === 120 || head === 88; - return decodeNumericCharacterReference($2.slice(hex ? 2 : 1), hex ? 16 : 10) - } - return decodeNamedCharacterReference($2) || $0 -} - -const own$3 = {}.hasOwnProperty; -function fromMarkdown(value, encoding, options) { - if (typeof encoding !== 'string') { - options = encoding; - encoding = undefined; - } - return compiler(options)(postprocess(parse$1(options).document().write(preprocess()(value, encoding, true)))); -} -function compiler(options) { - const config = { - transforms: [], - canContainEols: ['emphasis', 'fragment', 'heading', 'paragraph', 'strong'], - enter: { - autolink: opener(link), - autolinkProtocol: onenterdata, - autolinkEmail: onenterdata, - atxHeading: opener(heading), - blockQuote: opener(blockQuote), - characterEscape: onenterdata, - characterReference: onenterdata, - codeFenced: opener(codeFlow), - codeFencedFenceInfo: buffer, - codeFencedFenceMeta: buffer, - codeIndented: opener(codeFlow, buffer), - codeText: opener(codeText, buffer), - codeTextData: onenterdata, - data: onenterdata, - codeFlowValue: onenterdata, - definition: opener(definition), - definitionDestinationString: buffer, - definitionLabelString: buffer, - definitionTitleString: buffer, - emphasis: opener(emphasis), - hardBreakEscape: opener(hardBreak), - hardBreakTrailing: opener(hardBreak), - htmlFlow: opener(html, buffer), - htmlFlowData: onenterdata, - htmlText: opener(html, buffer), - htmlTextData: onenterdata, - image: opener(image), - label: buffer, - link: opener(link), - listItem: opener(listItem), - listItemValue: onenterlistitemvalue, - listOrdered: opener(list, onenterlistordered), - listUnordered: opener(list), - paragraph: opener(paragraph), - reference: onenterreference, - referenceString: buffer, - resourceDestinationString: buffer, - resourceTitleString: buffer, - setextHeading: opener(heading), - strong: opener(strong), - thematicBreak: opener(thematicBreak) - }, - exit: { - atxHeading: closer(), - atxHeadingSequence: onexitatxheadingsequence, - autolink: closer(), - autolinkEmail: onexitautolinkemail, - autolinkProtocol: onexitautolinkprotocol, - blockQuote: closer(), - characterEscapeValue: onexitdata, - characterReferenceMarkerHexadecimal: onexitcharacterreferencemarker, - characterReferenceMarkerNumeric: onexitcharacterreferencemarker, - characterReferenceValue: onexitcharacterreferencevalue, - characterReference: onexitcharacterreference, - codeFenced: closer(onexitcodefenced), - codeFencedFence: onexitcodefencedfence, - codeFencedFenceInfo: onexitcodefencedfenceinfo, - codeFencedFenceMeta: onexitcodefencedfencemeta, - codeFlowValue: onexitdata, - codeIndented: closer(onexitcodeindented), - codeText: closer(onexitcodetext), - codeTextData: onexitdata, - data: onexitdata, - definition: closer(), - definitionDestinationString: onexitdefinitiondestinationstring, - definitionLabelString: onexitdefinitionlabelstring, - definitionTitleString: onexitdefinitiontitlestring, - emphasis: closer(), - hardBreakEscape: closer(onexithardbreak), - hardBreakTrailing: closer(onexithardbreak), - htmlFlow: closer(onexithtmlflow), - htmlFlowData: onexitdata, - htmlText: closer(onexithtmltext), - htmlTextData: onexitdata, - image: closer(onexitimage), - label: onexitlabel, - labelText: onexitlabeltext, - lineEnding: onexitlineending, - link: closer(onexitlink), - listItem: closer(), - listOrdered: closer(), - listUnordered: closer(), - paragraph: closer(), - referenceString: onexitreferencestring, - resourceDestinationString: onexitresourcedestinationstring, - resourceTitleString: onexitresourcetitlestring, - resource: onexitresource, - setextHeading: closer(onexitsetextheading), - setextHeadingLineSequence: onexitsetextheadinglinesequence, - setextHeadingText: onexitsetextheadingtext, - strong: closer(), - thematicBreak: closer() - } - }; - configure$1(config, (options || {}).mdastExtensions || []); - const data = {}; - return compile; - function compile(events) { - let tree = { - type: 'root', - children: [] - }; - const context = { - stack: [tree], - tokenStack: [], - config, - enter, - exit, - buffer, - resume, - data - }; - const listStack = []; - let index = -1; - while (++index < events.length) { - if (events[index][1].type === "listOrdered" || events[index][1].type === "listUnordered") { - if (events[index][0] === 'enter') { - listStack.push(index); - } else { - const tail = listStack.pop(); - index = prepareList(events, tail, index); - } - } - } - index = -1; - while (++index < events.length) { - const handler = config[events[index][0]]; - if (own$3.call(handler, events[index][1].type)) { - handler[events[index][1].type].call(Object.assign({ - sliceSerialize: events[index][2].sliceSerialize - }, context), events[index][1]); - } - } - if (context.tokenStack.length > 0) { - const tail = context.tokenStack[context.tokenStack.length - 1]; - const handler = tail[1] || defaultOnError; - handler.call(context, undefined, tail[0]); - } - tree.position = { - start: point$1(events.length > 0 ? events[0][1].start : { - line: 1, - column: 1, - offset: 0 - }), - end: point$1(events.length > 0 ? events[events.length - 2][1].end : { - line: 1, - column: 1, - offset: 0 - }) - }; - index = -1; - while (++index < config.transforms.length) { - tree = config.transforms[index](tree) || tree; - } - return tree; - } - function prepareList(events, start, length) { - let index = start - 1; - let containerBalance = -1; - let listSpread = false; - let listItem; - let lineIndex; - let firstBlankLineIndex; - let atMarker; - while (++index <= length) { - const event = events[index]; - switch (event[1].type) { - case "listUnordered": - case "listOrdered": - case "blockQuote": - { - if (event[0] === 'enter') { - containerBalance++; - } else { - containerBalance--; - } - atMarker = undefined; - break; - } - case "lineEndingBlank": - { - if (event[0] === 'enter') { - if (listItem && !atMarker && !containerBalance && !firstBlankLineIndex) { - firstBlankLineIndex = index; - } - atMarker = undefined; - } - break; - } - case "linePrefix": - case "listItemValue": - case "listItemMarker": - case "listItemPrefix": - case "listItemPrefixWhitespace": - { - break; - } - default: - { - atMarker = undefined; - } - } - if (!containerBalance && event[0] === 'enter' && event[1].type === "listItemPrefix" || containerBalance === -1 && event[0] === 'exit' && (event[1].type === "listUnordered" || event[1].type === "listOrdered")) { - if (listItem) { - let tailIndex = index; - lineIndex = undefined; - while (tailIndex--) { - const tailEvent = events[tailIndex]; - if (tailEvent[1].type === "lineEnding" || tailEvent[1].type === "lineEndingBlank") { - if (tailEvent[0] === 'exit') continue; - if (lineIndex) { - events[lineIndex][1].type = "lineEndingBlank"; - listSpread = true; - } - tailEvent[1].type = "lineEnding"; - lineIndex = tailIndex; - } else if (tailEvent[1].type === "linePrefix" || tailEvent[1].type === "blockQuotePrefix" || tailEvent[1].type === "blockQuotePrefixWhitespace" || tailEvent[1].type === "blockQuoteMarker" || tailEvent[1].type === "listItemIndent") ; else { - break; - } - } - if (firstBlankLineIndex && (!lineIndex || firstBlankLineIndex < lineIndex)) { - listItem._spread = true; - } - listItem.end = Object.assign({}, lineIndex ? events[lineIndex][1].start : event[1].end); - events.splice(lineIndex || index, 0, ['exit', listItem, event[2]]); - index++; - length++; - } - if (event[1].type === "listItemPrefix") { - const item = { - type: 'listItem', - _spread: false, - start: Object.assign({}, event[1].start), - end: undefined - }; - listItem = item; - events.splice(index, 0, ['enter', item, event[2]]); - index++; - length++; - firstBlankLineIndex = undefined; - atMarker = true; - } - } - } - events[start][1]._spread = listSpread; - return length; - } - function opener(create, and) { - return open; - function open(token) { - enter.call(this, create(token), token); - if (and) and.call(this, token); - } - } - function buffer() { - this.stack.push({ - type: 'fragment', - children: [] - }); - } - function enter(node, token, errorHandler) { - const parent = this.stack[this.stack.length - 1]; - const siblings = parent.children; - siblings.push(node); - this.stack.push(node); - this.tokenStack.push([token, errorHandler]); - node.position = { - start: point$1(token.start), - end: undefined - }; - } - function closer(and) { - return close; - function close(token) { - if (and) and.call(this, token); - exit.call(this, token); - } - } - function exit(token, onExitError) { - const node = this.stack.pop(); - const open = this.tokenStack.pop(); - if (!open) { - throw new Error('Cannot close `' + token.type + '` (' + stringifyPosition({ - start: token.start, - end: token.end - }) + '): it’s not open'); - } else if (open[0].type !== token.type) { - if (onExitError) { - onExitError.call(this, token, open[0]); - } else { - const handler = open[1] || defaultOnError; - handler.call(this, token, open[0]); - } - } - node.position.end = point$1(token.end); - } - function resume() { - return toString(this.stack.pop()); - } - function onenterlistordered() { - this.data.expectingFirstListItemValue = true; - } - function onenterlistitemvalue(token) { - if (this.data.expectingFirstListItemValue) { - const ancestor = this.stack[this.stack.length - 2]; - ancestor.start = Number.parseInt(this.sliceSerialize(token), 10); - this.data.expectingFirstListItemValue = undefined; - } - } - function onexitcodefencedfenceinfo() { - const data = this.resume(); - const node = this.stack[this.stack.length - 1]; - node.lang = data; - } - function onexitcodefencedfencemeta() { - const data = this.resume(); - const node = this.stack[this.stack.length - 1]; - node.meta = data; - } - function onexitcodefencedfence() { - if (this.data.flowCodeInside) return; - this.buffer(); - this.data.flowCodeInside = true; - } - function onexitcodefenced() { - const data = this.resume(); - const node = this.stack[this.stack.length - 1]; - node.value = data.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g, ''); - this.data.flowCodeInside = undefined; - } - function onexitcodeindented() { - const data = this.resume(); - const node = this.stack[this.stack.length - 1]; - node.value = data.replace(/(\r?\n|\r)$/g, ''); - } - function onexitdefinitionlabelstring(token) { - const label = this.resume(); - const node = this.stack[this.stack.length - 1]; - node.label = label; - node.identifier = normalizeIdentifier(this.sliceSerialize(token)).toLowerCase(); - } - function onexitdefinitiontitlestring() { - const data = this.resume(); - const node = this.stack[this.stack.length - 1]; - node.title = data; - } - function onexitdefinitiondestinationstring() { - const data = this.resume(); - const node = this.stack[this.stack.length - 1]; - node.url = data; - } - function onexitatxheadingsequence(token) { - const node = this.stack[this.stack.length - 1]; - if (!node.depth) { - const depth = this.sliceSerialize(token).length; - node.depth = depth; - } - } - function onexitsetextheadingtext() { - this.data.setextHeadingSlurpLineEnding = true; - } - function onexitsetextheadinglinesequence(token) { - const node = this.stack[this.stack.length - 1]; - node.depth = this.sliceSerialize(token).codePointAt(0) === 61 ? 1 : 2; - } - function onexitsetextheading() { - this.data.setextHeadingSlurpLineEnding = undefined; - } - function onenterdata(token) { - const node = this.stack[this.stack.length - 1]; - const siblings = node.children; - let tail = siblings[siblings.length - 1]; - if (!tail || tail.type !== 'text') { - tail = text(); - tail.position = { - start: point$1(token.start), - end: undefined - }; - siblings.push(tail); - } - this.stack.push(tail); - } - function onexitdata(token) { - const tail = this.stack.pop(); - tail.value += this.sliceSerialize(token); - tail.position.end = point$1(token.end); - } - function onexitlineending(token) { - const context = this.stack[this.stack.length - 1]; - if (this.data.atHardBreak) { - const tail = context.children[context.children.length - 1]; - tail.position.end = point$1(token.end); - this.data.atHardBreak = undefined; - return; - } - if (!this.data.setextHeadingSlurpLineEnding && config.canContainEols.includes(context.type)) { - onenterdata.call(this, token); - onexitdata.call(this, token); - } - } - function onexithardbreak() { - this.data.atHardBreak = true; - } - function onexithtmlflow() { - const data = this.resume(); - const node = this.stack[this.stack.length - 1]; - node.value = data; - } - function onexithtmltext() { - const data = this.resume(); - const node = this.stack[this.stack.length - 1]; - node.value = data; - } - function onexitcodetext() { - const data = this.resume(); - const node = this.stack[this.stack.length - 1]; - node.value = data; - } - function onexitlink() { - const node = this.stack[this.stack.length - 1]; - if (this.data.inReference) { - const referenceType = this.data.referenceType || 'shortcut'; - node.type += 'Reference'; - node.referenceType = referenceType; - delete node.url; - delete node.title; - } else { - delete node.identifier; - delete node.label; - } - this.data.referenceType = undefined; - } - function onexitimage() { - const node = this.stack[this.stack.length - 1]; - if (this.data.inReference) { - const referenceType = this.data.referenceType || 'shortcut'; - node.type += 'Reference'; - node.referenceType = referenceType; - delete node.url; - delete node.title; - } else { - delete node.identifier; - delete node.label; - } - this.data.referenceType = undefined; - } - function onexitlabeltext(token) { - const string = this.sliceSerialize(token); - const ancestor = this.stack[this.stack.length - 2]; - ancestor.label = decodeString(string); - ancestor.identifier = normalizeIdentifier(string).toLowerCase(); - } - function onexitlabel() { - const fragment = this.stack[this.stack.length - 1]; - const value = this.resume(); - const node = this.stack[this.stack.length - 1]; - this.data.inReference = true; - if (node.type === 'link') { - const children = fragment.children; - node.children = children; - } else { - node.alt = value; - } - } - function onexitresourcedestinationstring() { - const data = this.resume(); - const node = this.stack[this.stack.length - 1]; - node.url = data; - } - function onexitresourcetitlestring() { - const data = this.resume(); - const node = this.stack[this.stack.length - 1]; - node.title = data; - } - function onexitresource() { - this.data.inReference = undefined; - } - function onenterreference() { - this.data.referenceType = 'collapsed'; - } - function onexitreferencestring(token) { - const label = this.resume(); - const node = this.stack[this.stack.length - 1]; - node.label = label; - node.identifier = normalizeIdentifier(this.sliceSerialize(token)).toLowerCase(); - this.data.referenceType = 'full'; - } - function onexitcharacterreferencemarker(token) { - this.data.characterReferenceType = token.type; - } - function onexitcharacterreferencevalue(token) { - const data = this.sliceSerialize(token); - const type = this.data.characterReferenceType; - let value; - if (type) { - value = decodeNumericCharacterReference(data, type === "characterReferenceMarkerNumeric" ? 10 : 16); - this.data.characterReferenceType = undefined; - } else { - const result = decodeNamedCharacterReference(data); - value = result; - } - const tail = this.stack[this.stack.length - 1]; - tail.value += value; - } - function onexitcharacterreference(token) { - const tail = this.stack.pop(); - tail.position.end = point$1(token.end); - } - function onexitautolinkprotocol(token) { - onexitdata.call(this, token); - const node = this.stack[this.stack.length - 1]; - node.url = this.sliceSerialize(token); - } - function onexitautolinkemail(token) { - onexitdata.call(this, token); - const node = this.stack[this.stack.length - 1]; - node.url = 'mailto:' + this.sliceSerialize(token); - } - function blockQuote() { - return { - type: 'blockquote', - children: [] - }; - } - function codeFlow() { - return { - type: 'code', - lang: null, - meta: null, - value: '' - }; - } - function codeText() { - return { - type: 'inlineCode', - value: '' - }; - } - function definition() { - return { - type: 'definition', - identifier: '', - label: null, - title: null, - url: '' - }; - } - function emphasis() { - return { - type: 'emphasis', - children: [] - }; - } - function heading() { - return { - type: 'heading', - depth: 0, - children: [] - }; - } - function hardBreak() { - return { - type: 'break' - }; - } - function html() { - return { - type: 'html', - value: '' - }; - } - function image() { - return { - type: 'image', - title: null, - url: '', - alt: null - }; - } - function link() { - return { - type: 'link', - title: null, - url: '', - children: [] - }; - } - function list(token) { - return { - type: 'list', - ordered: token.type === 'listOrdered', - start: null, - spread: token._spread, - children: [] - }; - } - function listItem(token) { - return { - type: 'listItem', - spread: token._spread, - checked: null, - children: [] - }; - } - function paragraph() { - return { - type: 'paragraph', - children: [] - }; - } - function strong() { - return { - type: 'strong', - children: [] - }; - } - function text() { - return { - type: 'text', - value: '' - }; - } - function thematicBreak() { - return { - type: 'thematicBreak' - }; - } -} -function point$1(d) { - return { - line: d.line, - column: d.column, - offset: d.offset - }; -} -function configure$1(combined, extensions) { - let index = -1; - while (++index < extensions.length) { - const value = extensions[index]; - if (Array.isArray(value)) { - configure$1(combined, value); - } else { - extension(combined, value); - } - } -} -function extension(combined, extension) { - let key; - for (key in extension) { - if (own$3.call(extension, key)) { - switch (key) { - case 'canContainEols': - { - const right = extension[key]; - if (right) { - combined[key].push(...right); - } - break; - } - case 'transforms': - { - const right = extension[key]; - if (right) { - combined[key].push(...right); - } - break; - } - case 'enter': - case 'exit': - { - const right = extension[key]; - if (right) { - Object.assign(combined[key], right); - } - break; - } - } - } - } -} -function defaultOnError(left, right) { - if (left) { - throw new Error('Cannot close `' + left.type + '` (' + stringifyPosition({ - start: left.start, - end: left.end - }) + '): a different token (`' + right.type + '`, ' + stringifyPosition({ - start: right.start, - end: right.end - }) + ') is open'); - } else { - throw new Error('Cannot close document, a token (`' + right.type + '`, ' + stringifyPosition({ - start: right.start, - end: right.end - }) + ') is still open'); - } -} - -function remarkParse(options) { - const self = this; - self.parser = parser; - function parser(doc) { - return fromMarkdown(doc, { - ...self.data('settings'), - ...options, - extensions: self.data('micromarkExtensions') || [], - mdastExtensions: self.data('fromMarkdownExtensions') || [] - }) - } -} - -const own$2 = {}.hasOwnProperty; -function zwitch(key, options) { - const settings = options || {}; - function one(value, ...parameters) { - let fn = one.invalid; - const handlers = one.handlers; - if (value && own$2.call(value, key)) { - const id = String(value[key]); - fn = own$2.call(handlers, id) ? handlers[id] : one.unknown; - } - if (fn) { - return fn.call(this, value, ...parameters) - } - } - one.handlers = settings.handlers || {}; - one.invalid = settings.invalid; - one.unknown = settings.unknown; - return one -} - -const own$1 = {}.hasOwnProperty; -function configure(base, extension) { - let index = -1; - let key; - if (extension.extensions) { - while (++index < extension.extensions.length) { - configure(base, extension.extensions[index]); - } - } - for (key in extension) { - if (own$1.call(extension, key)) { - switch (key) { - case 'extensions': { - break - } - case 'unsafe': { - list$1(base[key], extension[key]); - break - } - case 'join': { - list$1(base[key], extension[key]); - break - } - case 'handlers': { - map$4(base[key], extension[key]); - break - } - default: { - base.options[key] = extension[key]; - } - } - } - } - return base -} -function list$1(left, right) { - if (right) { - left.push(...right); - } -} -function map$4(left, right) { - if (right) { - Object.assign(left, right); - } -} - -function blockquote(node, _, state, info) { - const exit = state.enter('blockquote'); - const tracker = state.createTracker(info); - tracker.move('> '); - tracker.shift(2); - const value = state.indentLines( - state.containerFlow(node, tracker.current()), - map$3 - ); - exit(); - return value -} -function map$3(line, _, blank) { - return '>' + (blank ? '' : ' ') + line -} - -function patternInScope(stack, pattern) { - return ( - listInScope(stack, pattern.inConstruct, true) && - !listInScope(stack, pattern.notInConstruct, false) - ) -} -function listInScope(stack, list, none) { - if (typeof list === 'string') { - list = [list]; - } - if (!list || list.length === 0) { - return none - } - let index = -1; - while (++index < list.length) { - if (stack.includes(list[index])) { - return true - } - } - return false -} - -function hardBreak(_, _1, state, info) { - let index = -1; - while (++index < state.unsafe.length) { - if ( - state.unsafe[index].character === '\n' && - patternInScope(state.stack, state.unsafe[index]) - ) { - return /[ \t]/.test(info.before) ? '' : ' ' - } - } - return '\\\n' -} - -function longestStreak(value, substring) { - const source = String(value); - let index = source.indexOf(substring); - let expected = index; - let count = 0; - let max = 0; - if (typeof substring !== 'string') { - throw new TypeError('Expected substring') - } - while (index !== -1) { - if (index === expected) { - if (++count > max) { - max = count; - } - } else { - count = 1; - } - expected = index + substring.length; - index = source.indexOf(substring, expected); - } - return max -} - -function formatCodeAsIndented(node, state) { - return Boolean( - state.options.fences === false && - node.value && - !node.lang && - /[^ \r\n]/.test(node.value) && - !/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(node.value) - ) -} - -function checkFence(state) { - const marker = state.options.fence || '`'; - if (marker !== '`' && marker !== '~') { - throw new Error( - 'Cannot serialize code with `' + - marker + - '` for `options.fence`, expected `` ` `` or `~`' - ) - } - return marker -} - -function code$1(node, _, state, info) { - const marker = checkFence(state); - const raw = node.value || ''; - const suffix = marker === '`' ? 'GraveAccent' : 'Tilde'; - if (formatCodeAsIndented(node, state)) { - const exit = state.enter('codeIndented'); - const value = state.indentLines(raw, map$2); - exit(); - return value - } - const tracker = state.createTracker(info); - const sequence = marker.repeat(Math.max(longestStreak(raw, marker) + 1, 3)); - const exit = state.enter('codeFenced'); - let value = tracker.move(sequence); - if (node.lang) { - const subexit = state.enter(`codeFencedLang${suffix}`); - value += tracker.move( - state.safe(node.lang, { - before: value, - after: ' ', - encode: ['`'], - ...tracker.current() - }) - ); - subexit(); - } - if (node.lang && node.meta) { - const subexit = state.enter(`codeFencedMeta${suffix}`); - value += tracker.move(' '); - value += tracker.move( - state.safe(node.meta, { - before: value, - after: '\n', - encode: ['`'], - ...tracker.current() - }) - ); - subexit(); - } - value += tracker.move('\n'); - if (raw) { - value += tracker.move(raw + '\n'); - } - value += tracker.move(sequence); - exit(); - return value -} -function map$2(line, _, blank) { - return (blank ? '' : ' ') + line -} - -function checkQuote(state) { - const marker = state.options.quote || '"'; - if (marker !== '"' && marker !== "'") { - throw new Error( - 'Cannot serialize title with `' + - marker + - '` for `options.quote`, expected `"`, or `\'`' - ) - } - return marker -} - -function definition(node, _, state, info) { - const quote = checkQuote(state); - const suffix = quote === '"' ? 'Quote' : 'Apostrophe'; - const exit = state.enter('definition'); - let subexit = state.enter('label'); - const tracker = state.createTracker(info); - let value = tracker.move('['); - value += tracker.move( - state.safe(state.associationId(node), { - before: value, - after: ']', - ...tracker.current() - }) - ); - value += tracker.move(']: '); - subexit(); - if ( - !node.url || - /[\0- \u007F]/.test(node.url) - ) { - subexit = state.enter('destinationLiteral'); - value += tracker.move('<'); - value += tracker.move( - state.safe(node.url, {before: value, after: '>', ...tracker.current()}) - ); - value += tracker.move('>'); - } else { - subexit = state.enter('destinationRaw'); - value += tracker.move( - state.safe(node.url, { - before: value, - after: node.title ? ' ' : '\n', - ...tracker.current() - }) - ); - } - subexit(); - if (node.title) { - subexit = state.enter(`title${suffix}`); - value += tracker.move(' ' + quote); - value += tracker.move( - state.safe(node.title, { - before: value, - after: quote, - ...tracker.current() - }) - ); - value += tracker.move(quote); - subexit(); - } - exit(); - return value -} - -function checkEmphasis(state) { - const marker = state.options.emphasis || '*'; - if (marker !== '*' && marker !== '_') { - throw new Error( - 'Cannot serialize emphasis with `' + - marker + - '` for `options.emphasis`, expected `*`, or `_`' - ) - } - return marker -} - -emphasis.peek = emphasisPeek; -function emphasis(node, _, state, info) { - const marker = checkEmphasis(state); - const exit = state.enter('emphasis'); - const tracker = state.createTracker(info); - let value = tracker.move(marker); - value += tracker.move( - state.containerPhrasing(node, { - before: value, - after: marker, - ...tracker.current() - }) - ); - value += tracker.move(marker); - exit(); - return value -} -function emphasisPeek(_, _1, state) { - return state.options.emphasis || '*' -} - -const convert = - ( - function (test) { - if (test === null || test === undefined) { - return ok - } - if (typeof test === 'function') { - return castFactory(test) - } - if (typeof test === 'object') { - return Array.isArray(test) ? anyFactory(test) : propsFactory(test) - } - if (typeof test === 'string') { - return typeFactory(test) - } - throw new Error('Expected function, string, or object as test') - } - ); -function anyFactory(tests) { - const checks = []; - let index = -1; - while (++index < tests.length) { - checks[index] = convert(tests[index]); - } - return castFactory(any) - function any(...parameters) { - let index = -1; - while (++index < checks.length) { - if (checks[index].apply(this, parameters)) return true - } - return false - } -} -function propsFactory(check) { - const checkAsRecord = (check); - return castFactory(all) - function all(node) { - const nodeAsRecord = ( - (node) - ); - let key; - for (key in check) { - if (nodeAsRecord[key] !== checkAsRecord[key]) return false - } - return true - } -} -function typeFactory(check) { - return castFactory(type) - function type(node) { - return node && node.type === check - } -} -function castFactory(testFunction) { - return check - function check(value, index, parent) { - return Boolean( - looksLikeANode(value) && - testFunction.call( - this, - value, - typeof index === 'number' ? index : undefined, - parent || undefined - ) - ) - } -} -function ok() { - return true -} -function looksLikeANode(value) { - return value !== null && typeof value === 'object' && 'type' in value -} - -function color$1(d) { - return '\u001B[33m' + d + '\u001B[39m' -} - -const empty$1 = []; -const CONTINUE = true; -const EXIT = false; -const SKIP = 'skip'; -function visitParents(tree, test, visitor, reverse) { - let check; - if (typeof test === 'function' && typeof visitor !== 'function') { - reverse = visitor; - visitor = test; - } else { - check = test; - } - const is = convert(check); - const step = reverse ? -1 : 1; - factory(tree, undefined, [])(); - function factory(node, index, parents) { - const value = ( - node && typeof node === 'object' ? node : {} - ); - if (typeof value.type === 'string') { - const name = - typeof value.tagName === 'string' - ? value.tagName - : - typeof value.name === 'string' - ? value.name - : undefined; - Object.defineProperty(visit, 'name', { - value: - 'node (' + color$1(node.type + (name ? '<' + name + '>' : '')) + ')' - }); - } - return visit - function visit() { - let result = empty$1; - let subresult; - let offset; - let grandparents; - if (!test || is(node, index, parents[parents.length - 1] || undefined)) { - result = toResult(visitor(node, parents)); - if (result[0] === EXIT) { - return result - } - } - if ('children' in node && node.children) { - const nodeAsParent = (node); - if (nodeAsParent.children && result[0] !== SKIP) { - offset = (reverse ? nodeAsParent.children.length : -1) + step; - grandparents = parents.concat(nodeAsParent); - while (offset > -1 && offset < nodeAsParent.children.length) { - const child = nodeAsParent.children[offset]; - subresult = factory(child, offset, grandparents)(); - if (subresult[0] === EXIT) { - return subresult - } - offset = - typeof subresult[1] === 'number' ? subresult[1] : offset + step; - } - } - } - return result - } - } -} -function toResult(value) { - if (Array.isArray(value)) { - return value - } - if (typeof value === 'number') { - return [CONTINUE, value] - } - return value === null || value === undefined ? empty$1 : [value] -} - -function visit(tree, testOrVisitor, visitorOrReverse, maybeReverse) { - let reverse; - let test; - let visitor; - if ( - typeof testOrVisitor === 'function' && - typeof visitorOrReverse !== 'function' - ) { - test = undefined; - visitor = testOrVisitor; - reverse = visitorOrReverse; - } else { - test = testOrVisitor; - visitor = visitorOrReverse; - reverse = maybeReverse; - } - visitParents(tree, test, overload, reverse); - function overload(node, parents) { - const parent = parents[parents.length - 1]; - const index = parent ? parent.children.indexOf(node) : undefined; - return visitor(node, index, parent) - } -} - -function formatHeadingAsSetext(node, state) { - let literalWithBreak = false; - visit(node, function (node) { - if ( - ('value' in node && /\r?\n|\r/.test(node.value)) || - node.type === 'break' - ) { - literalWithBreak = true; - return EXIT - } - }); - return Boolean( - (!node.depth || node.depth < 3) && - toString(node) && - (state.options.setext || literalWithBreak) - ) -} - -function heading(node, _, state, info) { - const rank = Math.max(Math.min(6, node.depth || 1), 1); - const tracker = state.createTracker(info); - if (formatHeadingAsSetext(node, state)) { - const exit = state.enter('headingSetext'); - const subexit = state.enter('phrasing'); - const value = state.containerPhrasing(node, { - ...tracker.current(), - before: '\n', - after: '\n' - }); - subexit(); - exit(); - return ( - value + - '\n' + - (rank === 1 ? '=' : '-').repeat( - value.length - - (Math.max(value.lastIndexOf('\r'), value.lastIndexOf('\n')) + 1) - ) - ) - } - const sequence = '#'.repeat(rank); - const exit = state.enter('headingAtx'); - const subexit = state.enter('phrasing'); - tracker.move(sequence + ' '); - let value = state.containerPhrasing(node, { - before: '# ', - after: '\n', - ...tracker.current() - }); - if (/^[\t ]/.test(value)) { - value = - '&#x' + - value.charCodeAt(0).toString(16).toUpperCase() + - ';' + - value.slice(1); - } - value = value ? sequence + ' ' + value : sequence; - if (state.options.closeAtx) { - value += ' ' + sequence; - } - subexit(); - exit(); - return value -} - -html$1.peek = htmlPeek; -function html$1(node) { - return node.value || '' -} -function htmlPeek() { - return '<' -} - -image.peek = imagePeek; -function image(node, _, state, info) { - const quote = checkQuote(state); - const suffix = quote === '"' ? 'Quote' : 'Apostrophe'; - const exit = state.enter('image'); - let subexit = state.enter('label'); - const tracker = state.createTracker(info); - let value = tracker.move('!['); - value += tracker.move( - state.safe(node.alt, {before: value, after: ']', ...tracker.current()}) - ); - value += tracker.move(']('); - subexit(); - if ( - (!node.url && node.title) || - /[\0- \u007F]/.test(node.url) - ) { - subexit = state.enter('destinationLiteral'); - value += tracker.move('<'); - value += tracker.move( - state.safe(node.url, {before: value, after: '>', ...tracker.current()}) - ); - value += tracker.move('>'); - } else { - subexit = state.enter('destinationRaw'); - value += tracker.move( - state.safe(node.url, { - before: value, - after: node.title ? ' ' : ')', - ...tracker.current() - }) - ); - } - subexit(); - if (node.title) { - subexit = state.enter(`title${suffix}`); - value += tracker.move(' ' + quote); - value += tracker.move( - state.safe(node.title, { - before: value, - after: quote, - ...tracker.current() - }) - ); - value += tracker.move(quote); - subexit(); - } - value += tracker.move(')'); - exit(); - return value -} -function imagePeek() { - return '!' -} - -imageReference.peek = imageReferencePeek; -function imageReference(node, _, state, info) { - const type = node.referenceType; - const exit = state.enter('imageReference'); - let subexit = state.enter('label'); - const tracker = state.createTracker(info); - let value = tracker.move('!['); - const alt = state.safe(node.alt, { - before: value, - after: ']', - ...tracker.current() - }); - value += tracker.move(alt + ']['); - subexit(); - const stack = state.stack; - state.stack = []; - subexit = state.enter('reference'); - const reference = state.safe(state.associationId(node), { - before: value, - after: ']', - ...tracker.current() - }); - subexit(); - state.stack = stack; - exit(); - if (type === 'full' || !alt || alt !== reference) { - value += tracker.move(reference + ']'); - } else if (type === 'shortcut') { - value = value.slice(0, -1); - } else { - value += tracker.move(']'); - } - return value -} -function imageReferencePeek() { - return '!' -} - -inlineCode.peek = inlineCodePeek; -function inlineCode(node, _, state) { - let value = node.value || ''; - let sequence = '`'; - let index = -1; - while (new RegExp('(^|[^`])' + sequence + '([^`]|$)').test(value)) { - sequence += '`'; - } - if ( - /[^ \r\n]/.test(value) && - ((/^[ \r\n]/.test(value) && /[ \r\n]$/.test(value)) || /^`|`$/.test(value)) - ) { - value = ' ' + value + ' '; - } - while (++index < state.unsafe.length) { - const pattern = state.unsafe[index]; - const expression = state.compilePattern(pattern); - let match; - if (!pattern.atBreak) continue - while ((match = expression.exec(value))) { - let position = match.index; - if ( - value.charCodeAt(position) === 10 && - value.charCodeAt(position - 1) === 13 - ) { - position--; - } - value = value.slice(0, position) + ' ' + value.slice(match.index + 1); - } - } - return sequence + value + sequence -} -function inlineCodePeek() { - return '`' -} - -function formatLinkAsAutolink(node, state) { - const raw = toString(node); - return Boolean( - !state.options.resourceLink && - node.url && - !node.title && - node.children && - node.children.length === 1 && - node.children[0].type === 'text' && - (raw === node.url || 'mailto:' + raw === node.url) && - /^[a-z][a-z+.-]+:/i.test(node.url) && - !/[\0- <>\u007F]/.test(node.url) - ) -} - -link.peek = linkPeek; -function link(node, _, state, info) { - const quote = checkQuote(state); - const suffix = quote === '"' ? 'Quote' : 'Apostrophe'; - const tracker = state.createTracker(info); - let exit; - let subexit; - if (formatLinkAsAutolink(node, state)) { - const stack = state.stack; - state.stack = []; - exit = state.enter('autolink'); - let value = tracker.move('<'); - value += tracker.move( - state.containerPhrasing(node, { - before: value, - after: '>', - ...tracker.current() - }) - ); - value += tracker.move('>'); - exit(); - state.stack = stack; - return value - } - exit = state.enter('link'); - subexit = state.enter('label'); - let value = tracker.move('['); - value += tracker.move( - state.containerPhrasing(node, { - before: value, - after: '](', - ...tracker.current() - }) - ); - value += tracker.move(']('); - subexit(); - if ( - (!node.url && node.title) || - /[\0- \u007F]/.test(node.url) - ) { - subexit = state.enter('destinationLiteral'); - value += tracker.move('<'); - value += tracker.move( - state.safe(node.url, {before: value, after: '>', ...tracker.current()}) - ); - value += tracker.move('>'); - } else { - subexit = state.enter('destinationRaw'); - value += tracker.move( - state.safe(node.url, { - before: value, - after: node.title ? ' ' : ')', - ...tracker.current() - }) - ); - } - subexit(); - if (node.title) { - subexit = state.enter(`title${suffix}`); - value += tracker.move(' ' + quote); - value += tracker.move( - state.safe(node.title, { - before: value, - after: quote, - ...tracker.current() - }) - ); - value += tracker.move(quote); - subexit(); - } - value += tracker.move(')'); - exit(); - return value -} -function linkPeek(node, _, state) { - return formatLinkAsAutolink(node, state) ? '<' : '[' -} - -linkReference.peek = linkReferencePeek; -function linkReference(node, _, state, info) { - const type = node.referenceType; - const exit = state.enter('linkReference'); - let subexit = state.enter('label'); - const tracker = state.createTracker(info); - let value = tracker.move('['); - const text = state.containerPhrasing(node, { - before: value, - after: ']', - ...tracker.current() - }); - value += tracker.move(text + ']['); - subexit(); - const stack = state.stack; - state.stack = []; - subexit = state.enter('reference'); - const reference = state.safe(state.associationId(node), { - before: value, - after: ']', - ...tracker.current() - }); - subexit(); - state.stack = stack; - exit(); - if (type === 'full' || !text || text !== reference) { - value += tracker.move(reference + ']'); - } else if (type === 'shortcut') { - value = value.slice(0, -1); - } else { - value += tracker.move(']'); - } - return value -} -function linkReferencePeek() { - return '[' -} - -function checkBullet(state) { - const marker = state.options.bullet || '*'; - if (marker !== '*' && marker !== '+' && marker !== '-') { - throw new Error( - 'Cannot serialize items with `' + - marker + - '` for `options.bullet`, expected `*`, `+`, or `-`' - ) - } - return marker -} - -function checkBulletOther(state) { - const bullet = checkBullet(state); - const bulletOther = state.options.bulletOther; - if (!bulletOther) { - return bullet === '*' ? '-' : '*' - } - if (bulletOther !== '*' && bulletOther !== '+' && bulletOther !== '-') { - throw new Error( - 'Cannot serialize items with `' + - bulletOther + - '` for `options.bulletOther`, expected `*`, `+`, or `-`' - ) - } - if (bulletOther === bullet) { - throw new Error( - 'Expected `bullet` (`' + - bullet + - '`) and `bulletOther` (`' + - bulletOther + - '`) to be different' - ) - } - return bulletOther -} - -function checkBulletOrdered(state) { - const marker = state.options.bulletOrdered || '.'; - if (marker !== '.' && marker !== ')') { - throw new Error( - 'Cannot serialize items with `' + - marker + - '` for `options.bulletOrdered`, expected `.` or `)`' - ) - } - return marker -} - -function checkRule(state) { - const marker = state.options.rule || '*'; - if (marker !== '*' && marker !== '-' && marker !== '_') { - throw new Error( - 'Cannot serialize rules with `' + - marker + - '` for `options.rule`, expected `*`, `-`, or `_`' - ) - } - return marker -} - -function list(node, parent, state, info) { - const exit = state.enter('list'); - const bulletCurrent = state.bulletCurrent; - let bullet = node.ordered ? checkBulletOrdered(state) : checkBullet(state); - const bulletOther = node.ordered - ? bullet === '.' - ? ')' - : '.' - : checkBulletOther(state); - let useDifferentMarker = - parent && state.bulletLastUsed ? bullet === state.bulletLastUsed : false; - if (!node.ordered) { - const firstListItem = node.children ? node.children[0] : undefined; - if ( - (bullet === '*' || bullet === '-') && - firstListItem && - (!firstListItem.children || !firstListItem.children[0]) && - state.stack[state.stack.length - 1] === 'list' && - state.stack[state.stack.length - 2] === 'listItem' && - state.stack[state.stack.length - 3] === 'list' && - state.stack[state.stack.length - 4] === 'listItem' && - state.indexStack[state.indexStack.length - 1] === 0 && - state.indexStack[state.indexStack.length - 2] === 0 && - state.indexStack[state.indexStack.length - 3] === 0 - ) { - useDifferentMarker = true; - } - if (checkRule(state) === bullet && firstListItem) { - let index = -1; - while (++index < node.children.length) { - const item = node.children[index]; - if ( - item && - item.type === 'listItem' && - item.children && - item.children[0] && - item.children[0].type === 'thematicBreak' - ) { - useDifferentMarker = true; - break - } - } - } - } - if (useDifferentMarker) { - bullet = bulletOther; - } - state.bulletCurrent = bullet; - const value = state.containerFlow(node, info); - state.bulletLastUsed = bullet; - state.bulletCurrent = bulletCurrent; - exit(); - return value -} - -function checkListItemIndent(state) { - const style = state.options.listItemIndent || 'one'; - if (style !== 'tab' && style !== 'one' && style !== 'mixed') { - throw new Error( - 'Cannot serialize items with `' + - style + - '` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`' - ) - } - return style -} - -function listItem(node, parent, state, info) { - const listItemIndent = checkListItemIndent(state); - let bullet = state.bulletCurrent || checkBullet(state); - if (parent && parent.type === 'list' && parent.ordered) { - bullet = - (typeof parent.start === 'number' && parent.start > -1 - ? parent.start - : 1) + - (state.options.incrementListMarker === false - ? 0 - : parent.children.indexOf(node)) + - bullet; - } - let size = bullet.length + 1; - if ( - listItemIndent === 'tab' || - (listItemIndent === 'mixed' && - ((parent && parent.type === 'list' && parent.spread) || node.spread)) - ) { - size = Math.ceil(size / 4) * 4; - } - const tracker = state.createTracker(info); - tracker.move(bullet + ' '.repeat(size - bullet.length)); - tracker.shift(size); - const exit = state.enter('listItem'); - const value = state.indentLines( - state.containerFlow(node, tracker.current()), - map - ); - exit(); - return value - function map(line, index, blank) { - if (index) { - return (blank ? '' : ' '.repeat(size)) + line - } - return (blank ? bullet : bullet + ' '.repeat(size - bullet.length)) + line - } -} - -function paragraph(node, _, state, info) { - const exit = state.enter('paragraph'); - const subexit = state.enter('phrasing'); - const value = state.containerPhrasing(node, info); - subexit(); - exit(); - return value -} - -const phrasing = - ( - convert([ - 'break', - 'delete', - 'emphasis', - 'footnote', - 'footnoteReference', - 'image', - 'imageReference', - 'inlineCode', - 'inlineMath', - 'link', - 'linkReference', - 'mdxJsxTextElement', - 'mdxTextExpression', - 'strong', - 'text', - 'textDirective' - ]) - ); - -function root(node, _, state, info) { - const hasPhrasing = node.children.some(function (d) { - return phrasing(d) - }); - const fn = hasPhrasing ? state.containerPhrasing : state.containerFlow; - return fn.call(state, node, info) -} - -function checkStrong(state) { - const marker = state.options.strong || '*'; - if (marker !== '*' && marker !== '_') { - throw new Error( - 'Cannot serialize strong with `' + - marker + - '` for `options.strong`, expected `*`, or `_`' - ) - } - return marker -} - -strong.peek = strongPeek; -function strong(node, _, state, info) { - const marker = checkStrong(state); - const exit = state.enter('strong'); - const tracker = state.createTracker(info); - let value = tracker.move(marker + marker); - value += tracker.move( - state.containerPhrasing(node, { - before: value, - after: marker, - ...tracker.current() - }) - ); - value += tracker.move(marker + marker); - exit(); - return value -} -function strongPeek(_, _1, state) { - return state.options.strong || '*' -} - -function text$1(node, _, state, info) { - return state.safe(node.value, info) -} - -function checkRuleRepetition(state) { - const repetition = state.options.ruleRepetition || 3; - if (repetition < 3) { - throw new Error( - 'Cannot serialize rules with repetition `' + - repetition + - '` for `options.ruleRepetition`, expected `3` or more' - ) - } - return repetition -} - -function thematicBreak(_, _1, state) { - const value = ( - checkRule(state) + (state.options.ruleSpaces ? ' ' : '') - ).repeat(checkRuleRepetition(state)); - return state.options.ruleSpaces ? value.slice(0, -1) : value -} - -const handle = { - blockquote, - break: hardBreak, - code: code$1, - definition, - emphasis, - hardBreak, - heading, - html: html$1, - image, - imageReference, - inlineCode, - link, - linkReference, - list, - listItem, - paragraph, - root, - strong, - text: text$1, - thematicBreak -}; - -const join = [joinDefaults]; -function joinDefaults(left, right, parent, state) { - if ( - right.type === 'code' && - formatCodeAsIndented(right, state) && - (left.type === 'list' || - (left.type === right.type && formatCodeAsIndented(left, state))) - ) { - return false - } - if ('spread' in parent && typeof parent.spread === 'boolean') { - if ( - left.type === 'paragraph' && - (left.type === right.type || - right.type === 'definition' || - (right.type === 'heading' && formatHeadingAsSetext(right, state))) - ) { - return - } - return parent.spread ? 1 : 0 - } -} - -const fullPhrasingSpans = [ - 'autolink', - 'destinationLiteral', - 'destinationRaw', - 'reference', - 'titleQuote', - 'titleApostrophe' -]; -const unsafe = [ - {character: '\t', after: '[\\r\\n]', inConstruct: 'phrasing'}, - {character: '\t', before: '[\\r\\n]', inConstruct: 'phrasing'}, - { - character: '\t', - inConstruct: ['codeFencedLangGraveAccent', 'codeFencedLangTilde'] - }, - { - character: '\r', - inConstruct: [ - 'codeFencedLangGraveAccent', - 'codeFencedLangTilde', - 'codeFencedMetaGraveAccent', - 'codeFencedMetaTilde', - 'destinationLiteral', - 'headingAtx' - ] - }, - { - character: '\n', - inConstruct: [ - 'codeFencedLangGraveAccent', - 'codeFencedLangTilde', - 'codeFencedMetaGraveAccent', - 'codeFencedMetaTilde', - 'destinationLiteral', - 'headingAtx' - ] - }, - {character: ' ', after: '[\\r\\n]', inConstruct: 'phrasing'}, - {character: ' ', before: '[\\r\\n]', inConstruct: 'phrasing'}, - { - character: ' ', - inConstruct: ['codeFencedLangGraveAccent', 'codeFencedLangTilde'] - }, - { - character: '!', - after: '\\[', - inConstruct: 'phrasing', - notInConstruct: fullPhrasingSpans - }, - {character: '"', inConstruct: 'titleQuote'}, - {atBreak: true, character: '#'}, - {character: '#', inConstruct: 'headingAtx', after: '(?:[\r\n]|$)'}, - {character: '&', after: '[#A-Za-z]', inConstruct: 'phrasing'}, - {character: "'", inConstruct: 'titleApostrophe'}, - {character: '(', inConstruct: 'destinationRaw'}, - { - before: '\\]', - character: '(', - inConstruct: 'phrasing', - notInConstruct: fullPhrasingSpans - }, - {atBreak: true, before: '\\d+', character: ')'}, - {character: ')', inConstruct: 'destinationRaw'}, - {atBreak: true, character: '*', after: '(?:[ \t\r\n*])'}, - {character: '*', inConstruct: 'phrasing', notInConstruct: fullPhrasingSpans}, - {atBreak: true, character: '+', after: '(?:[ \t\r\n])'}, - {atBreak: true, character: '-', after: '(?:[ \t\r\n-])'}, - {atBreak: true, before: '\\d+', character: '.', after: '(?:[ \t\r\n]|$)'}, - {atBreak: true, character: '<', after: '[!/?A-Za-z]'}, - { - character: '<', - after: '[!/?A-Za-z]', - inConstruct: 'phrasing', - notInConstruct: fullPhrasingSpans - }, - {character: '<', inConstruct: 'destinationLiteral'}, - {atBreak: true, character: '='}, - {atBreak: true, character: '>'}, - {character: '>', inConstruct: 'destinationLiteral'}, - {atBreak: true, character: '['}, - {character: '[', inConstruct: 'phrasing', notInConstruct: fullPhrasingSpans}, - {character: '[', inConstruct: ['label', 'reference']}, - {character: '\\', after: '[\\r\\n]', inConstruct: 'phrasing'}, - {character: ']', inConstruct: ['label', 'reference']}, - {atBreak: true, character: '_'}, - {character: '_', inConstruct: 'phrasing', notInConstruct: fullPhrasingSpans}, - {atBreak: true, character: '`'}, - { - character: '`', - inConstruct: ['codeFencedLangGraveAccent', 'codeFencedMetaGraveAccent'] - }, - {character: '`', inConstruct: 'phrasing', notInConstruct: fullPhrasingSpans}, - {atBreak: true, character: '~'} -]; - -function association(node) { - if (node.label || !node.identifier) { - return node.label || '' - } - return decodeString(node.identifier) -} - -function compilePattern(pattern) { - if (!pattern._compiled) { - const before = - (pattern.atBreak ? '[\\r\\n][\\t ]*' : '') + - (pattern.before ? '(?:' + pattern.before + ')' : ''); - pattern._compiled = new RegExp( - (before ? '(' + before + ')' : '') + - (/[|\\{}()[\]^$+*?.-]/.test(pattern.character) ? '\\' : '') + - pattern.character + - (pattern.after ? '(?:' + pattern.after + ')' : ''), - 'g' - ); - } - return pattern._compiled -} - -function containerPhrasing(parent, state, info) { - const indexStack = state.indexStack; - const children = parent.children || []; - const results = []; - let index = -1; - let before = info.before; - indexStack.push(-1); - let tracker = state.createTracker(info); - while (++index < children.length) { - const child = children[index]; - let after; - indexStack[indexStack.length - 1] = index; - if (index + 1 < children.length) { - let handle = state.handle.handlers[children[index + 1].type]; - if (handle && handle.peek) handle = handle.peek; - after = handle - ? handle(children[index + 1], parent, state, { - before: '', - after: '', - ...tracker.current() - }).charAt(0) - : ''; - } else { - after = info.after; - } - if ( - results.length > 0 && - (before === '\r' || before === '\n') && - child.type === 'html' - ) { - results[results.length - 1] = results[results.length - 1].replace( - /(\r?\n|\r)$/, - ' ' - ); - before = ' '; - tracker = state.createTracker(info); - tracker.move(results.join('')); - } - results.push( - tracker.move( - state.handle(child, parent, state, { - ...tracker.current(), - before, - after - }) - ) - ); - before = results[results.length - 1].slice(-1); - } - indexStack.pop(); - return results.join('') -} - -function containerFlow(parent, state, info) { - const indexStack = state.indexStack; - const children = parent.children || []; - const tracker = state.createTracker(info); - const results = []; - let index = -1; - indexStack.push(-1); - while (++index < children.length) { - const child = children[index]; - indexStack[indexStack.length - 1] = index; - results.push( - tracker.move( - state.handle(child, parent, state, { - before: '\n', - after: '\n', - ...tracker.current() - }) - ) - ); - if (child.type !== 'list') { - state.bulletLastUsed = undefined; - } - if (index < children.length - 1) { - results.push( - tracker.move(between(child, children[index + 1], parent, state)) - ); - } - } - indexStack.pop(); - return results.join('') -} -function between(left, right, parent, state) { - let index = state.join.length; - while (index--) { - const result = state.join[index](left, right, parent, state); - if (result === true || result === 1) { - break - } - if (typeof result === 'number') { - return '\n'.repeat(1 + result) - } - if (result === false) { - return '\n\n\n\n' - } - } - return '\n\n' -} - -const eol$1 = /\r?\n|\r/g; -function indentLines(value, map) { - const result = []; - let start = 0; - let line = 0; - let match; - while ((match = eol$1.exec(value))) { - one(value.slice(start, match.index)); - result.push(match[0]); - start = match.index + match[0].length; - line++; - } - one(value.slice(start)); - return result.join('') - function one(value) { - result.push(map(value, line, !value)); - } -} - -function safe(state, input, config) { - const value = (config.before || '') + (input || '') + (config.after || ''); - const positions = []; - const result = []; - const infos = {}; - let index = -1; - while (++index < state.unsafe.length) { - const pattern = state.unsafe[index]; - if (!patternInScope(state.stack, pattern)) { - continue - } - const expression = state.compilePattern(pattern); - let match; - while ((match = expression.exec(value))) { - const before = 'before' in pattern || Boolean(pattern.atBreak); - const after = 'after' in pattern; - const position = match.index + (before ? match[1].length : 0); - if (positions.includes(position)) { - if (infos[position].before && !before) { - infos[position].before = false; - } - if (infos[position].after && !after) { - infos[position].after = false; - } - } else { - positions.push(position); - infos[position] = {before, after}; - } - } - } - positions.sort(numerical); - let start = config.before ? config.before.length : 0; - const end = value.length - (config.after ? config.after.length : 0); - index = -1; - while (++index < positions.length) { - const position = positions[index]; - if (position < start || position >= end) { - continue - } - if ( - (position + 1 < end && - positions[index + 1] === position + 1 && - infos[position].after && - !infos[position + 1].before && - !infos[position + 1].after) || - (positions[index - 1] === position - 1 && - infos[position].before && - !infos[position - 1].before && - !infos[position - 1].after) - ) { - continue - } - if (start !== position) { - result.push(escapeBackslashes(value.slice(start, position), '\\')); - } - start = position; - if ( - /[!-/:-@[-`{-~]/.test(value.charAt(position)) && - (!config.encode || !config.encode.includes(value.charAt(position))) - ) { - result.push('\\'); - } else { - result.push( - '&#x' + value.charCodeAt(position).toString(16).toUpperCase() + ';' - ); - start++; - } - } - result.push(escapeBackslashes(value.slice(start, end), config.after)); - return result.join('') -} -function numerical(a, b) { - return a - b -} -function escapeBackslashes(value, after) { - const expression = /\\(?=[!-/:-@[-`{-~])/g; - const positions = []; - const results = []; - const whole = value + after; - let index = -1; - let start = 0; - let match; - while ((match = expression.exec(whole))) { - positions.push(match.index); - } - while (++index < positions.length) { - if (start !== positions[index]) { - results.push(value.slice(start, positions[index])); - } - results.push('\\'); - start = positions[index]; - } - results.push(value.slice(start)); - return results.join('') -} - -function track(config) { - const options = config || {}; - const now = options.now || {}; - let lineShift = options.lineShift || 0; - let line = now.line || 1; - let column = now.column || 1; - return {move, current, shift} - function current() { - return {now: {line, column}, lineShift} - } - function shift(value) { - lineShift += value; - } - function move(input) { - const value = input || ''; - const chunks = value.split(/\r?\n|\r/g); - const tail = chunks[chunks.length - 1]; - line += chunks.length - 1; - column = - chunks.length === 1 ? column + tail.length : 1 + tail.length + lineShift; - return value - } -} - -function toMarkdown(tree, options = {}) { - const state = { - enter, - indentLines, - associationId: association, - containerPhrasing: containerPhrasingBound, - containerFlow: containerFlowBound, - createTracker: track, - compilePattern, - safe: safeBound, - stack: [], - unsafe: [...unsafe], - join: [...join], - handlers: {...handle}, - options: {}, - indexStack: [], - handle: undefined - }; - configure(state, options); - if (state.options.tightDefinitions) { - state.join.push(joinDefinition); - } - state.handle = zwitch('type', { - invalid, - unknown, - handlers: state.handlers - }); - let result = state.handle(tree, undefined, state, { - before: '\n', - after: '\n', - now: {line: 1, column: 1}, - lineShift: 0 - }); - if ( - result && - result.charCodeAt(result.length - 1) !== 10 && - result.charCodeAt(result.length - 1) !== 13 - ) { - result += '\n'; - } - return result - function enter(name) { - state.stack.push(name); - return exit - function exit() { - state.stack.pop(); - } - } -} -function invalid(value) { - throw new Error('Cannot handle value `' + value + '`, expected node') -} -function unknown(value) { - const node = (value); - throw new Error('Cannot handle unknown node `' + node.type + '`') -} -function joinDefinition(left, right) { - if (left.type === 'definition' && left.type === right.type) { - return 0 - } -} -function containerPhrasingBound(parent, info) { - return containerPhrasing(parent, this, info) -} -function containerFlowBound(parent, info) { - return containerFlow(parent, this, info) -} -function safeBound(value, config) { - return safe(this, value, config) -} - -function remarkStringify(options) { - const self = this; - self.compiler = compiler; - function compiler(tree) { - return toMarkdown(tree, { - ...self.data('settings'), - ...options, - extensions: self.data('toMarkdownExtensions') || [] - }) - } -} - -function ccount(value, character) { - const source = String(value); - if (typeof character !== 'string') { - throw new TypeError('Expected character') - } - let count = 0; - let index = source.indexOf(character); - while (index !== -1) { - count++; - index = source.indexOf(character, index + character.length); - } - return count -} - -function escapeStringRegexp(string) { - if (typeof string !== 'string') { - throw new TypeError('Expected a string'); - } - return string - .replace(/[|\\{}()[\]^$+*?.]/g, '\\$&') - .replace(/-/g, '\\x2d'); -} - -function findAndReplace(tree, list, options) { - const settings = options || {}; - const ignored = convert(settings.ignore || []); - const pairs = toPairs(list); - let pairIndex = -1; - while (++pairIndex < pairs.length) { - visitParents(tree, 'text', visitor); - } - function visitor(node, parents) { - let index = -1; - let grandparent; - while (++index < parents.length) { - const parent = parents[index]; - const siblings = grandparent ? grandparent.children : undefined; - if ( - ignored( - parent, - siblings ? siblings.indexOf(parent) : undefined, - grandparent - ) - ) { - return - } - grandparent = parent; - } - if (grandparent) { - return handler(node, parents) - } - } - function handler(node, parents) { - const parent = parents[parents.length - 1]; - const find = pairs[pairIndex][0]; - const replace = pairs[pairIndex][1]; - let start = 0; - const siblings = parent.children; - const index = siblings.indexOf(node); - let change = false; - let nodes = []; - find.lastIndex = 0; - let match = find.exec(node.value); - while (match) { - const position = match.index; - const matchObject = { - index: match.index, - input: match.input, - stack: [...parents, node] - }; - let value = replace(...match, matchObject); - if (typeof value === 'string') { - value = value.length > 0 ? {type: 'text', value} : undefined; - } - if (value === false) { - find.lastIndex = position + 1; - } else { - if (start !== position) { - nodes.push({ - type: 'text', - value: node.value.slice(start, position) - }); - } - if (Array.isArray(value)) { - nodes.push(...value); - } else if (value) { - nodes.push(value); - } - start = position + match[0].length; - change = true; - } - if (!find.global) { - break - } - match = find.exec(node.value); - } - if (change) { - if (start < node.value.length) { - nodes.push({type: 'text', value: node.value.slice(start)}); - } - parent.children.splice(index, 1, ...nodes); - } else { - nodes = [node]; - } - return index + nodes.length - } -} -function toPairs(tupleOrList) { - const result = []; - if (!Array.isArray(tupleOrList)) { - throw new TypeError('Expected find and replace tuple or list of tuples') - } - const list = - !tupleOrList[0] || Array.isArray(tupleOrList[0]) - ? tupleOrList - : [tupleOrList]; - let index = -1; - while (++index < list.length) { - const tuple = list[index]; - result.push([toExpression(tuple[0]), toFunction(tuple[1])]); - } - return result -} -function toExpression(find) { - return typeof find === 'string' ? new RegExp(escapeStringRegexp(find), 'g') : find -} -function toFunction(replace) { - return typeof replace === 'function' - ? replace - : function () { - return replace - } -} - -const inConstruct = 'phrasing'; -const notInConstruct = ['autolink', 'link', 'image', 'label']; -function gfmAutolinkLiteralFromMarkdown() { - return { - transforms: [transformGfmAutolinkLiterals], - enter: { - literalAutolink: enterLiteralAutolink, - literalAutolinkEmail: enterLiteralAutolinkValue, - literalAutolinkHttp: enterLiteralAutolinkValue, - literalAutolinkWww: enterLiteralAutolinkValue - }, - exit: { - literalAutolink: exitLiteralAutolink, - literalAutolinkEmail: exitLiteralAutolinkEmail, - literalAutolinkHttp: exitLiteralAutolinkHttp, - literalAutolinkWww: exitLiteralAutolinkWww - } - } -} -function gfmAutolinkLiteralToMarkdown() { - return { - unsafe: [ - { - character: '@', - before: '[+\\-.\\w]', - after: '[\\-.\\w]', - inConstruct, - notInConstruct - }, - { - character: '.', - before: '[Ww]', - after: '[\\-.\\w]', - inConstruct, - notInConstruct - }, - { - character: ':', - before: '[ps]', - after: '\\/', - inConstruct, - notInConstruct - } - ] - } -} -function enterLiteralAutolink(token) { - this.enter({type: 'link', title: null, url: '', children: []}, token); -} -function enterLiteralAutolinkValue(token) { - this.config.enter.autolinkProtocol.call(this, token); -} -function exitLiteralAutolinkHttp(token) { - this.config.exit.autolinkProtocol.call(this, token); -} -function exitLiteralAutolinkWww(token) { - this.config.exit.data.call(this, token); - const node = this.stack[this.stack.length - 1]; - ok$1(node.type === 'link'); - node.url = 'http://' + this.sliceSerialize(token); -} -function exitLiteralAutolinkEmail(token) { - this.config.exit.autolinkEmail.call(this, token); -} -function exitLiteralAutolink(token) { - this.exit(token); -} -function transformGfmAutolinkLiterals(tree) { - findAndReplace( - tree, - [ - [/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi, findUrl], - [/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu, findEmail] - ], - {ignore: ['link', 'linkReference']} - ); -} -function findUrl(_, protocol, domain, path, match) { - let prefix = ''; - if (!previous(match)) { - return false - } - if (/^w/i.test(protocol)) { - domain = protocol + domain; - protocol = ''; - prefix = 'http://'; - } - if (!isCorrectDomain(domain)) { - return false - } - const parts = splitUrl(domain + path); - if (!parts[0]) return false - const result = { - type: 'link', - title: null, - url: prefix + protocol + parts[0], - children: [{type: 'text', value: protocol + parts[0]}] - }; - if (parts[1]) { - return [result, {type: 'text', value: parts[1]}] - } - return result -} -function findEmail(_, atext, label, match) { - if ( - !previous(match, true) || - /[-\d_]$/.test(label) - ) { - return false - } - return { - type: 'link', - title: null, - url: 'mailto:' + atext + '@' + label, - children: [{type: 'text', value: atext + '@' + label}] - } -} -function isCorrectDomain(domain) { - const parts = domain.split('.'); - if ( - parts.length < 2 || - (parts[parts.length - 1] && - (/_/.test(parts[parts.length - 1]) || - !/[a-zA-Z\d]/.test(parts[parts.length - 1]))) || - (parts[parts.length - 2] && - (/_/.test(parts[parts.length - 2]) || - !/[a-zA-Z\d]/.test(parts[parts.length - 2]))) - ) { - return false - } - return true -} -function splitUrl(url) { - const trailExec = /[!"&'),.:;<>?\]}]+$/.exec(url); - if (!trailExec) { - return [url, undefined] - } - url = url.slice(0, trailExec.index); - let trail = trailExec[0]; - let closingParenIndex = trail.indexOf(')'); - const openingParens = ccount(url, '('); - let closingParens = ccount(url, ')'); - while (closingParenIndex !== -1 && openingParens > closingParens) { - url += trail.slice(0, closingParenIndex + 1); - trail = trail.slice(closingParenIndex + 1); - closingParenIndex = trail.indexOf(')'); - closingParens++; - } - return [url, trail] -} -function previous(match, email) { - const code = match.input.charCodeAt(match.index - 1); - return ( - (match.index === 0 || - unicodeWhitespace(code) || - unicodePunctuation(code)) && - (!email || code !== 47) - ) -} - -footnoteReference.peek = footnoteReferencePeek; -function gfmFootnoteFromMarkdown() { - return { - enter: { - gfmFootnoteDefinition: enterFootnoteDefinition, - gfmFootnoteDefinitionLabelString: enterFootnoteDefinitionLabelString, - gfmFootnoteCall: enterFootnoteCall, - gfmFootnoteCallString: enterFootnoteCallString - }, - exit: { - gfmFootnoteDefinition: exitFootnoteDefinition, - gfmFootnoteDefinitionLabelString: exitFootnoteDefinitionLabelString, - gfmFootnoteCall: exitFootnoteCall, - gfmFootnoteCallString: exitFootnoteCallString - } - } -} -function gfmFootnoteToMarkdown() { - return { - unsafe: [{character: '[', inConstruct: ['phrasing', 'label', 'reference']}], - handlers: {footnoteDefinition, footnoteReference} - } -} -function enterFootnoteDefinition(token) { - this.enter( - {type: 'footnoteDefinition', identifier: '', label: '', children: []}, - token - ); -} -function enterFootnoteDefinitionLabelString() { - this.buffer(); -} -function exitFootnoteDefinitionLabelString(token) { - const label = this.resume(); - const node = this.stack[this.stack.length - 1]; - ok$1(node.type === 'footnoteDefinition'); - node.label = label; - node.identifier = normalizeIdentifier( - this.sliceSerialize(token) - ).toLowerCase(); -} -function exitFootnoteDefinition(token) { - this.exit(token); -} -function enterFootnoteCall(token) { - this.enter({type: 'footnoteReference', identifier: '', label: ''}, token); -} -function enterFootnoteCallString() { - this.buffer(); -} -function exitFootnoteCallString(token) { - const label = this.resume(); - const node = this.stack[this.stack.length - 1]; - ok$1(node.type === 'footnoteReference'); - node.label = label; - node.identifier = normalizeIdentifier( - this.sliceSerialize(token) - ).toLowerCase(); -} -function exitFootnoteCall(token) { - this.exit(token); -} -function footnoteReference(node, _, state, info) { - const tracker = state.createTracker(info); - let value = tracker.move('[^'); - const exit = state.enter('footnoteReference'); - const subexit = state.enter('reference'); - value += tracker.move( - state.safe(state.associationId(node), { - ...tracker.current(), - before: value, - after: ']' - }) - ); - subexit(); - exit(); - value += tracker.move(']'); - return value -} -function footnoteReferencePeek() { - return '[' -} -function footnoteDefinition(node, _, state, info) { - const tracker = state.createTracker(info); - let value = tracker.move('[^'); - const exit = state.enter('footnoteDefinition'); - const subexit = state.enter('label'); - value += tracker.move( - state.safe(state.associationId(node), { - ...tracker.current(), - before: value, - after: ']' - }) - ); - subexit(); - value += tracker.move( - ']:' + (node.children && node.children.length > 0 ? ' ' : '') - ); - tracker.shift(4); - value += tracker.move( - state.indentLines(state.containerFlow(node, tracker.current()), map$1) - ); - exit(); - return value -} -function map$1(line, index, blank) { - if (index === 0) { - return line - } - return (blank ? '' : ' ') + line -} - -const constructsWithoutStrikethrough = [ - 'autolink', - 'destinationLiteral', - 'destinationRaw', - 'reference', - 'titleQuote', - 'titleApostrophe' -]; -handleDelete.peek = peekDelete; -function gfmStrikethroughFromMarkdown() { - return { - canContainEols: ['delete'], - enter: {strikethrough: enterStrikethrough}, - exit: {strikethrough: exitStrikethrough} - } -} -function gfmStrikethroughToMarkdown() { - return { - unsafe: [ - { - character: '~', - inConstruct: 'phrasing', - notInConstruct: constructsWithoutStrikethrough - } - ], - handlers: {delete: handleDelete} - } -} -function enterStrikethrough(token) { - this.enter({type: 'delete', children: []}, token); -} -function exitStrikethrough(token) { - this.exit(token); -} -function handleDelete(node, _, state, info) { - const tracker = state.createTracker(info); - const exit = state.enter('strikethrough'); - let value = tracker.move('~~'); - value += state.containerPhrasing(node, { - ...tracker.current(), - before: value, - after: '~' - }); - value += tracker.move('~~'); - exit(); - return value -} -function peekDelete() { - return '~' -} - -function markdownTable(table, options = {}) { - const align = (options.align || []).concat(); - const stringLength = options.stringLength || defaultStringLength; - const alignments = []; - const cellMatrix = []; - const sizeMatrix = []; - const longestCellByColumn = []; - let mostCellsPerRow = 0; - let rowIndex = -1; - while (++rowIndex < table.length) { - const row = []; - const sizes = []; - let columnIndex = -1; - if (table[rowIndex].length > mostCellsPerRow) { - mostCellsPerRow = table[rowIndex].length; - } - while (++columnIndex < table[rowIndex].length) { - const cell = serialize(table[rowIndex][columnIndex]); - if (options.alignDelimiters !== false) { - const size = stringLength(cell); - sizes[columnIndex] = size; - if ( - longestCellByColumn[columnIndex] === undefined || - size > longestCellByColumn[columnIndex] - ) { - longestCellByColumn[columnIndex] = size; - } - } - row.push(cell); - } - cellMatrix[rowIndex] = row; - sizeMatrix[rowIndex] = sizes; - } - let columnIndex = -1; - if (typeof align === 'object' && 'length' in align) { - while (++columnIndex < mostCellsPerRow) { - alignments[columnIndex] = toAlignment(align[columnIndex]); - } - } else { - const code = toAlignment(align); - while (++columnIndex < mostCellsPerRow) { - alignments[columnIndex] = code; - } - } - columnIndex = -1; - const row = []; - const sizes = []; - while (++columnIndex < mostCellsPerRow) { - const code = alignments[columnIndex]; - let before = ''; - let after = ''; - if (code === 99 ) { - before = ':'; - after = ':'; - } else if (code === 108 ) { - before = ':'; - } else if (code === 114 ) { - after = ':'; - } - let size = - options.alignDelimiters === false - ? 1 - : Math.max( - 1, - longestCellByColumn[columnIndex] - before.length - after.length - ); - const cell = before + '-'.repeat(size) + after; - if (options.alignDelimiters !== false) { - size = before.length + size + after.length; - if (size > longestCellByColumn[columnIndex]) { - longestCellByColumn[columnIndex] = size; - } - sizes[columnIndex] = size; - } - row[columnIndex] = cell; - } - cellMatrix.splice(1, 0, row); - sizeMatrix.splice(1, 0, sizes); - rowIndex = -1; - const lines = []; - while (++rowIndex < cellMatrix.length) { - const row = cellMatrix[rowIndex]; - const sizes = sizeMatrix[rowIndex]; - columnIndex = -1; - const line = []; - while (++columnIndex < mostCellsPerRow) { - const cell = row[columnIndex] || ''; - let before = ''; - let after = ''; - if (options.alignDelimiters !== false) { - const size = - longestCellByColumn[columnIndex] - (sizes[columnIndex] || 0); - const code = alignments[columnIndex]; - if (code === 114 ) { - before = ' '.repeat(size); - } else if (code === 99 ) { - if (size % 2) { - before = ' '.repeat(size / 2 + 0.5); - after = ' '.repeat(size / 2 - 0.5); - } else { - before = ' '.repeat(size / 2); - after = before; - } - } else { - after = ' '.repeat(size); - } - } - if (options.delimiterStart !== false && !columnIndex) { - line.push('|'); - } - if ( - options.padding !== false && - !(options.alignDelimiters === false && cell === '') && - (options.delimiterStart !== false || columnIndex) - ) { - line.push(' '); - } - if (options.alignDelimiters !== false) { - line.push(before); - } - line.push(cell); - if (options.alignDelimiters !== false) { - line.push(after); - } - if (options.padding !== false) { - line.push(' '); - } - if ( - options.delimiterEnd !== false || - columnIndex !== mostCellsPerRow - 1 - ) { - line.push('|'); - } - } - lines.push( - options.delimiterEnd === false - ? line.join('').replace(/ +$/, '') - : line.join('') - ); - } - return lines.join('\n') -} -function serialize(value) { - return value === null || value === undefined ? '' : String(value) -} -function defaultStringLength(value) { - return value.length -} -function toAlignment(value) { - const code = typeof value === 'string' ? value.codePointAt(0) : 0; - return code === 67 || code === 99 - ? 99 - : code === 76 || code === 108 - ? 108 - : code === 82 || code === 114 - ? 114 - : 0 -} - -function gfmTableFromMarkdown() { - return { - enter: { - table: enterTable, - tableData: enterCell, - tableHeader: enterCell, - tableRow: enterRow - }, - exit: { - codeText: exitCodeText, - table: exitTable, - tableData: exit, - tableHeader: exit, - tableRow: exit - } - } -} -function enterTable(token) { - const align = token._align; - this.enter( - { - type: 'table', - align: align.map(function (d) { - return d === 'none' ? null : d - }), - children: [] - }, - token - ); - this.data.inTable = true; -} -function exitTable(token) { - this.exit(token); - this.data.inTable = undefined; -} -function enterRow(token) { - this.enter({type: 'tableRow', children: []}, token); -} -function exit(token) { - this.exit(token); -} -function enterCell(token) { - this.enter({type: 'tableCell', children: []}, token); -} -function exitCodeText(token) { - let value = this.resume(); - if (this.data.inTable) { - value = value.replace(/\\([\\|])/g, replace); - } - const node = this.stack[this.stack.length - 1]; - ok$1(node.type === 'inlineCode'); - node.value = value; - this.exit(token); -} -function replace($0, $1) { - return $1 === '|' ? $1 : $0 -} -function gfmTableToMarkdown(options) { - const settings = options || {}; - const padding = settings.tableCellPadding; - const alignDelimiters = settings.tablePipeAlign; - const stringLength = settings.stringLength; - const around = padding ? ' ' : '|'; - return { - unsafe: [ - {character: '\r', inConstruct: 'tableCell'}, - {character: '\n', inConstruct: 'tableCell'}, - {atBreak: true, character: '|', after: '[\t :-]'}, - {character: '|', inConstruct: 'tableCell'}, - {atBreak: true, character: ':', after: '-'}, - {atBreak: true, character: '-', after: '[:|-]'} - ], - handlers: { - inlineCode: inlineCodeWithTable, - table: handleTable, - tableCell: handleTableCell, - tableRow: handleTableRow - } - } - function handleTable(node, _, state, info) { - return serializeData(handleTableAsData(node, state, info), node.align) - } - function handleTableRow(node, _, state, info) { - const row = handleTableRowAsData(node, state, info); - const value = serializeData([row]); - return value.slice(0, value.indexOf('\n')) - } - function handleTableCell(node, _, state, info) { - const exit = state.enter('tableCell'); - const subexit = state.enter('phrasing'); - const value = state.containerPhrasing(node, { - ...info, - before: around, - after: around - }); - subexit(); - exit(); - return value - } - function serializeData(matrix, align) { - return markdownTable(matrix, { - align, - alignDelimiters, - padding, - stringLength - }) - } - function handleTableAsData(node, state, info) { - const children = node.children; - let index = -1; - const result = []; - const subexit = state.enter('table'); - while (++index < children.length) { - result[index] = handleTableRowAsData(children[index], state, info); - } - subexit(); - return result - } - function handleTableRowAsData(node, state, info) { - const children = node.children; - let index = -1; - const result = []; - const subexit = state.enter('tableRow'); - while (++index < children.length) { - result[index] = handleTableCell(children[index], node, state, info); - } - subexit(); - return result - } - function inlineCodeWithTable(node, parent, state) { - let value = handle.inlineCode(node, parent, state); - if (state.stack.includes('tableCell')) { - value = value.replace(/\|/g, '\\$&'); - } - return value - } -} - -function gfmTaskListItemFromMarkdown() { - return { - exit: { - taskListCheckValueChecked: exitCheck, - taskListCheckValueUnchecked: exitCheck, - paragraph: exitParagraphWithTaskListItem - } - } -} -function gfmTaskListItemToMarkdown() { - return { - unsafe: [{atBreak: true, character: '-', after: '[:|-]'}], - handlers: {listItem: listItemWithTaskListItem} - } -} -function exitCheck(token) { - const node = this.stack[this.stack.length - 2]; - ok$1(node.type === 'listItem'); - node.checked = token.type === 'taskListCheckValueChecked'; -} -function exitParagraphWithTaskListItem(token) { - const parent = this.stack[this.stack.length - 2]; - if ( - parent && - parent.type === 'listItem' && - typeof parent.checked === 'boolean' - ) { - const node = this.stack[this.stack.length - 1]; - ok$1(node.type === 'paragraph'); - const head = node.children[0]; - if (head && head.type === 'text') { - const siblings = parent.children; - let index = -1; - let firstParaghraph; - while (++index < siblings.length) { - const sibling = siblings[index]; - if (sibling.type === 'paragraph') { - firstParaghraph = sibling; - break - } - } - if (firstParaghraph === node) { - head.value = head.value.slice(1); - if (head.value.length === 0) { - node.children.shift(); - } else if ( - node.position && - head.position && - typeof head.position.start.offset === 'number' - ) { - head.position.start.column++; - head.position.start.offset++; - node.position.start = Object.assign({}, head.position.start); - } - } - } - } - this.exit(token); -} -function listItemWithTaskListItem(node, parent, state, info) { - const head = node.children[0]; - const checkable = - typeof node.checked === 'boolean' && head && head.type === 'paragraph'; - const checkbox = '[' + (node.checked ? 'x' : ' ') + '] '; - const tracker = state.createTracker(info); - if (checkable) { - tracker.move(checkbox); - } - let value = handle.listItem(node, parent, state, { - ...info, - ...tracker.current() - }); - if (checkable) { - value = value.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/, check); - } - return value - function check($0) { - return $0 + checkbox - } -} - -function gfmFromMarkdown() { - return [ - gfmAutolinkLiteralFromMarkdown(), - gfmFootnoteFromMarkdown(), - gfmStrikethroughFromMarkdown(), - gfmTableFromMarkdown(), - gfmTaskListItemFromMarkdown() - ] -} -function gfmToMarkdown(options) { - return { - extensions: [ - gfmAutolinkLiteralToMarkdown(), - gfmFootnoteToMarkdown(), - gfmStrikethroughToMarkdown(), - gfmTableToMarkdown(options), - gfmTaskListItemToMarkdown() - ] - } -} - -const wwwPrefix = { - tokenize: tokenizeWwwPrefix, - partial: true -}; -const domain = { - tokenize: tokenizeDomain, - partial: true -}; -const path = { - tokenize: tokenizePath, - partial: true -}; -const trail = { - tokenize: tokenizeTrail, - partial: true -}; -const emailDomainDotTrail = { - tokenize: tokenizeEmailDomainDotTrail, - partial: true -}; -const wwwAutolink = { - name: 'wwwAutolink', - tokenize: tokenizeWwwAutolink, - previous: previousWww -}; -const protocolAutolink = { - name: 'protocolAutolink', - tokenize: tokenizeProtocolAutolink, - previous: previousProtocol -}; -const emailAutolink = { - name: 'emailAutolink', - tokenize: tokenizeEmailAutolink, - previous: previousEmail -}; -const text = {}; -function gfmAutolinkLiteral() { - return { - text - }; -} -let code = 48; -while (code < 123) { - text[code] = emailAutolink; - code++; - if (code === 58) code = 65;else if (code === 91) code = 97; -} -text[43] = emailAutolink; -text[45] = emailAutolink; -text[46] = emailAutolink; -text[95] = emailAutolink; -text[72] = [emailAutolink, protocolAutolink]; -text[104] = [emailAutolink, protocolAutolink]; -text[87] = [emailAutolink, wwwAutolink]; -text[119] = [emailAutolink, wwwAutolink]; -function tokenizeEmailAutolink(effects, ok, nok) { - const self = this; - let dot; - let data; - return start; - function start(code) { - if (!gfmAtext(code) || !previousEmail.call(self, self.previous) || previousUnbalanced(self.events)) { - return nok(code); - } - effects.enter('literalAutolink'); - effects.enter('literalAutolinkEmail'); - return atext(code); - } - function atext(code) { - if (gfmAtext(code)) { - effects.consume(code); - return atext; - } - if (code === 64) { - effects.consume(code); - return emailDomain; - } - return nok(code); - } - function emailDomain(code) { - if (code === 46) { - return effects.check(emailDomainDotTrail, emailDomainAfter, emailDomainDot)(code); - } - if (code === 45 || code === 95 || asciiAlphanumeric(code)) { - data = true; - effects.consume(code); - return emailDomain; - } - return emailDomainAfter(code); - } - function emailDomainDot(code) { - effects.consume(code); - dot = true; - return emailDomain; - } - function emailDomainAfter(code) { - if (data && dot && asciiAlpha(self.previous)) { - effects.exit('literalAutolinkEmail'); - effects.exit('literalAutolink'); - return ok(code); - } - return nok(code); - } -} -function tokenizeWwwAutolink(effects, ok, nok) { - const self = this; - return wwwStart; - function wwwStart(code) { - if (code !== 87 && code !== 119 || !previousWww.call(self, self.previous) || previousUnbalanced(self.events)) { - return nok(code); - } - effects.enter('literalAutolink'); - effects.enter('literalAutolinkWww'); - return effects.check(wwwPrefix, effects.attempt(domain, effects.attempt(path, wwwAfter), nok), nok)(code); - } - function wwwAfter(code) { - effects.exit('literalAutolinkWww'); - effects.exit('literalAutolink'); - return ok(code); - } -} -function tokenizeProtocolAutolink(effects, ok, nok) { - const self = this; - let buffer = ''; - let seen = false; - return protocolStart; - function protocolStart(code) { - if ((code === 72 || code === 104) && previousProtocol.call(self, self.previous) && !previousUnbalanced(self.events)) { - effects.enter('literalAutolink'); - effects.enter('literalAutolinkHttp'); - buffer += String.fromCodePoint(code); - effects.consume(code); - return protocolPrefixInside; - } - return nok(code); - } - function protocolPrefixInside(code) { - if (asciiAlpha(code) && buffer.length < 5) { - buffer += String.fromCodePoint(code); - effects.consume(code); - return protocolPrefixInside; - } - if (code === 58) { - const protocol = buffer.toLowerCase(); - if (protocol === 'http' || protocol === 'https') { - effects.consume(code); - return protocolSlashesInside; - } - } - return nok(code); - } - function protocolSlashesInside(code) { - if (code === 47) { - effects.consume(code); - if (seen) { - return afterProtocol; - } - seen = true; - return protocolSlashesInside; - } - return nok(code); - } - function afterProtocol(code) { - return code === null || asciiControl(code) || markdownLineEndingOrSpace(code) || unicodeWhitespace(code) || unicodePunctuation(code) ? nok(code) : effects.attempt(domain, effects.attempt(path, protocolAfter), nok)(code); - } - function protocolAfter(code) { - effects.exit('literalAutolinkHttp'); - effects.exit('literalAutolink'); - return ok(code); - } -} -function tokenizeWwwPrefix(effects, ok, nok) { - let size = 0; - return wwwPrefixInside; - function wwwPrefixInside(code) { - if ((code === 87 || code === 119) && size < 3) { - size++; - effects.consume(code); - return wwwPrefixInside; - } - if (code === 46 && size === 3) { - effects.consume(code); - return wwwPrefixAfter; - } - return nok(code); - } - function wwwPrefixAfter(code) { - return code === null ? nok(code) : ok(code); - } -} -function tokenizeDomain(effects, ok, nok) { - let underscoreInLastSegment; - let underscoreInLastLastSegment; - let seen; - return domainInside; - function domainInside(code) { - if (code === 46 || code === 95) { - return effects.check(trail, domainAfter, domainAtPunctuation)(code); - } - if (code === null || markdownLineEndingOrSpace(code) || unicodeWhitespace(code) || code !== 45 && unicodePunctuation(code)) { - return domainAfter(code); - } - seen = true; - effects.consume(code); - return domainInside; - } - function domainAtPunctuation(code) { - if (code === 95) { - underscoreInLastSegment = true; - } - else { - underscoreInLastLastSegment = underscoreInLastSegment; - underscoreInLastSegment = undefined; - } - effects.consume(code); - return domainInside; - } - function domainAfter(code) { - if (underscoreInLastLastSegment || underscoreInLastSegment || !seen) { - return nok(code); - } - return ok(code); - } -} -function tokenizePath(effects, ok) { - let sizeOpen = 0; - let sizeClose = 0; - return pathInside; - function pathInside(code) { - if (code === 40) { - sizeOpen++; - effects.consume(code); - return pathInside; - } - if (code === 41 && sizeClose < sizeOpen) { - return pathAtPunctuation(code); - } - if (code === 33 || code === 34 || code === 38 || code === 39 || code === 41 || code === 42 || code === 44 || code === 46 || code === 58 || code === 59 || code === 60 || code === 63 || code === 93 || code === 95 || code === 126) { - return effects.check(trail, ok, pathAtPunctuation)(code); - } - if (code === null || markdownLineEndingOrSpace(code) || unicodeWhitespace(code)) { - return ok(code); - } - effects.consume(code); - return pathInside; - } - function pathAtPunctuation(code) { - if (code === 41) { - sizeClose++; - } - effects.consume(code); - return pathInside; - } -} -function tokenizeTrail(effects, ok, nok) { - return trail; - function trail(code) { - if (code === 33 || code === 34 || code === 39 || code === 41 || code === 42 || code === 44 || code === 46 || code === 58 || code === 59 || code === 63 || code === 95 || code === 126) { - effects.consume(code); - return trail; - } - if (code === 38) { - effects.consume(code); - return trailCharacterReferenceStart; - } - if (code === 93) { - effects.consume(code); - return trailBracketAfter; - } - if ( - code === 60 || - code === null || markdownLineEndingOrSpace(code) || unicodeWhitespace(code)) { - return ok(code); - } - return nok(code); - } - function trailBracketAfter(code) { - if (code === null || code === 40 || code === 91 || markdownLineEndingOrSpace(code) || unicodeWhitespace(code)) { - return ok(code); - } - return trail(code); - } - function trailCharacterReferenceStart(code) { - return asciiAlpha(code) ? trailCharacterReferenceInside(code) : nok(code); - } - function trailCharacterReferenceInside(code) { - if (code === 59) { - effects.consume(code); - return trail; - } - if (asciiAlpha(code)) { - effects.consume(code); - return trailCharacterReferenceInside; - } - return nok(code); - } -} -function tokenizeEmailDomainDotTrail(effects, ok, nok) { - return start; - function start(code) { - effects.consume(code); - return after; - } - function after(code) { - return asciiAlphanumeric(code) ? nok(code) : ok(code); - } -} -function previousWww(code) { - return code === null || code === 40 || code === 42 || code === 95 || code === 91 || code === 93 || code === 126 || markdownLineEndingOrSpace(code); -} -function previousProtocol(code) { - return !asciiAlpha(code); -} -function previousEmail(code) { - return !(code === 47 || gfmAtext(code)); -} -function gfmAtext(code) { - return code === 43 || code === 45 || code === 46 || code === 95 || asciiAlphanumeric(code); -} -function previousUnbalanced(events) { - let index = events.length; - let result = false; - while (index--) { - const token = events[index][1]; - if ((token.type === 'labelLink' || token.type === 'labelImage') && !token._balanced) { - result = true; - break; - } - if (token._gfmAutolinkLiteralWalkedInto) { - result = false; - break; - } - } - if (events.length > 0 && !result) { - events[events.length - 1][1]._gfmAutolinkLiteralWalkedInto = true; - } - return result; -} - -const indent = { - tokenize: tokenizeIndent, - partial: true -}; -function gfmFootnote() { - return { - document: { - [91]: { - name: 'gfmFootnoteDefinition', - tokenize: tokenizeDefinitionStart, - continuation: { - tokenize: tokenizeDefinitionContinuation - }, - exit: gfmFootnoteDefinitionEnd - } - }, - text: { - [91]: { - name: 'gfmFootnoteCall', - tokenize: tokenizeGfmFootnoteCall - }, - [93]: { - name: 'gfmPotentialFootnoteCall', - add: 'after', - tokenize: tokenizePotentialGfmFootnoteCall, - resolveTo: resolveToPotentialGfmFootnoteCall - } - } - }; -} -function tokenizePotentialGfmFootnoteCall(effects, ok, nok) { - const self = this; - let index = self.events.length; - const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []); - let labelStart; - while (index--) { - const token = self.events[index][1]; - if (token.type === "labelImage") { - labelStart = token; - break; - } - if (token.type === 'gfmFootnoteCall' || token.type === "labelLink" || token.type === "label" || token.type === "image" || token.type === "link") { - break; - } - } - return start; - function start(code) { - if (!labelStart || !labelStart._balanced) { - return nok(code); - } - const id = normalizeIdentifier(self.sliceSerialize({ - start: labelStart.end, - end: self.now() - })); - if (id.codePointAt(0) !== 94 || !defined.includes(id.slice(1))) { - return nok(code); - } - effects.enter('gfmFootnoteCallLabelMarker'); - effects.consume(code); - effects.exit('gfmFootnoteCallLabelMarker'); - return ok(code); - } -} -function resolveToPotentialGfmFootnoteCall(events, context) { - let index = events.length; - while (index--) { - if (events[index][1].type === "labelImage" && events[index][0] === 'enter') { - events[index][1]; - break; - } - } - events[index + 1][1].type = "data"; - events[index + 3][1].type = 'gfmFootnoteCallLabelMarker'; - const call = { - type: 'gfmFootnoteCall', - start: Object.assign({}, events[index + 3][1].start), - end: Object.assign({}, events[events.length - 1][1].end) - }; - const marker = { - type: 'gfmFootnoteCallMarker', - start: Object.assign({}, events[index + 3][1].end), - end: Object.assign({}, events[index + 3][1].end) - }; - marker.end.column++; - marker.end.offset++; - marker.end._bufferIndex++; - const string = { - type: 'gfmFootnoteCallString', - start: Object.assign({}, marker.end), - end: Object.assign({}, events[events.length - 1][1].start) - }; - const chunk = { - type: "chunkString", - contentType: 'string', - start: Object.assign({}, string.start), - end: Object.assign({}, string.end) - }; - const replacement = [ - events[index + 1], events[index + 2], ['enter', call, context], - events[index + 3], events[index + 4], - ['enter', marker, context], ['exit', marker, context], - ['enter', string, context], ['enter', chunk, context], ['exit', chunk, context], ['exit', string, context], - events[events.length - 2], events[events.length - 1], ['exit', call, context]]; - events.splice(index, events.length - index + 1, ...replacement); - return events; -} -function tokenizeGfmFootnoteCall(effects, ok, nok) { - const self = this; - const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []); - let size = 0; - let data; - return start; - function start(code) { - effects.enter('gfmFootnoteCall'); - effects.enter('gfmFootnoteCallLabelMarker'); - effects.consume(code); - effects.exit('gfmFootnoteCallLabelMarker'); - return callStart; - } - function callStart(code) { - if (code !== 94) return nok(code); - effects.enter('gfmFootnoteCallMarker'); - effects.consume(code); - effects.exit('gfmFootnoteCallMarker'); - effects.enter('gfmFootnoteCallString'); - effects.enter('chunkString').contentType = 'string'; - return callData; - } - function callData(code) { - if ( - size > 999 || - code === 93 && !data || - code === null || code === 91 || markdownLineEndingOrSpace(code)) { - return nok(code); - } - if (code === 93) { - effects.exit('chunkString'); - const token = effects.exit('gfmFootnoteCallString'); - if (!defined.includes(normalizeIdentifier(self.sliceSerialize(token)))) { - return nok(code); - } - effects.enter('gfmFootnoteCallLabelMarker'); - effects.consume(code); - effects.exit('gfmFootnoteCallLabelMarker'); - effects.exit('gfmFootnoteCall'); - return ok; - } - if (!markdownLineEndingOrSpace(code)) { - data = true; - } - size++; - effects.consume(code); - return code === 92 ? callEscape : callData; - } - function callEscape(code) { - if (code === 91 || code === 92 || code === 93) { - effects.consume(code); - size++; - return callData; - } - return callData(code); - } -} -function tokenizeDefinitionStart(effects, ok, nok) { - const self = this; - const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []); - let identifier; - let size = 0; - let data; - return start; - function start(code) { - effects.enter('gfmFootnoteDefinition')._container = true; - effects.enter('gfmFootnoteDefinitionLabel'); - effects.enter('gfmFootnoteDefinitionLabelMarker'); - effects.consume(code); - effects.exit('gfmFootnoteDefinitionLabelMarker'); - return labelAtMarker; - } - function labelAtMarker(code) { - if (code === 94) { - effects.enter('gfmFootnoteDefinitionMarker'); - effects.consume(code); - effects.exit('gfmFootnoteDefinitionMarker'); - effects.enter('gfmFootnoteDefinitionLabelString'); - effects.enter('chunkString').contentType = 'string'; - return labelInside; - } - return nok(code); - } - function labelInside(code) { - if ( - size > 999 || - code === 93 && !data || - code === null || code === 91 || markdownLineEndingOrSpace(code)) { - return nok(code); - } - if (code === 93) { - effects.exit('chunkString'); - const token = effects.exit('gfmFootnoteDefinitionLabelString'); - identifier = normalizeIdentifier(self.sliceSerialize(token)); - effects.enter('gfmFootnoteDefinitionLabelMarker'); - effects.consume(code); - effects.exit('gfmFootnoteDefinitionLabelMarker'); - effects.exit('gfmFootnoteDefinitionLabel'); - return labelAfter; - } - if (!markdownLineEndingOrSpace(code)) { - data = true; - } - size++; - effects.consume(code); - return code === 92 ? labelEscape : labelInside; - } - function labelEscape(code) { - if (code === 91 || code === 92 || code === 93) { - effects.consume(code); - size++; - return labelInside; - } - return labelInside(code); - } - function labelAfter(code) { - if (code === 58) { - effects.enter('definitionMarker'); - effects.consume(code); - effects.exit('definitionMarker'); - if (!defined.includes(identifier)) { - defined.push(identifier); - } - return factorySpace(effects, whitespaceAfter, 'gfmFootnoteDefinitionWhitespace'); - } - return nok(code); - } - function whitespaceAfter(code) { - return ok(code); - } -} -function tokenizeDefinitionContinuation(effects, ok, nok) { - return effects.check(blankLine, ok, effects.attempt(indent, ok, nok)); -} -function gfmFootnoteDefinitionEnd(effects) { - effects.exit('gfmFootnoteDefinition'); -} -function tokenizeIndent(effects, ok, nok) { - const self = this; - return factorySpace(effects, afterPrefix, 'gfmFootnoteDefinitionIndent', 4 + 1); - function afterPrefix(code) { - const tail = self.events[self.events.length - 1]; - return tail && tail[1].type === 'gfmFootnoteDefinitionIndent' && tail[2].sliceSerialize(tail[1], true).length === 4 ? ok(code) : nok(code); - } -} - -function gfmStrikethrough(options) { - const options_ = options || {}; - let single = options_.singleTilde; - const tokenizer = { - name: 'strikethrough', - tokenize: tokenizeStrikethrough, - resolveAll: resolveAllStrikethrough - }; - if (single === null || single === undefined) { - single = true; - } - return { - text: { - [126]: tokenizer - }, - insideSpan: { - null: [tokenizer] - }, - attentionMarkers: { - null: [126] - } - }; - function resolveAllStrikethrough(events, context) { - let index = -1; - while (++index < events.length) { - if (events[index][0] === 'enter' && events[index][1].type === 'strikethroughSequenceTemporary' && events[index][1]._close) { - let open = index; - while (open--) { - if (events[open][0] === 'exit' && events[open][1].type === 'strikethroughSequenceTemporary' && events[open][1]._open && - events[index][1].end.offset - events[index][1].start.offset === events[open][1].end.offset - events[open][1].start.offset) { - events[index][1].type = 'strikethroughSequence'; - events[open][1].type = 'strikethroughSequence'; - const strikethrough = { - type: 'strikethrough', - start: Object.assign({}, events[open][1].start), - end: Object.assign({}, events[index][1].end) - }; - const text = { - type: 'strikethroughText', - start: Object.assign({}, events[open][1].end), - end: Object.assign({}, events[index][1].start) - }; - const nextEvents = [['enter', strikethrough, context], ['enter', events[open][1], context], ['exit', events[open][1], context], ['enter', text, context]]; - const insideSpan = context.parser.constructs.insideSpan.null; - if (insideSpan) { - splice(nextEvents, nextEvents.length, 0, resolveAll(insideSpan, events.slice(open + 1, index), context)); - } - splice(nextEvents, nextEvents.length, 0, [['exit', text, context], ['enter', events[index][1], context], ['exit', events[index][1], context], ['exit', strikethrough, context]]); - splice(events, open - 1, index - open + 3, nextEvents); - index = open + nextEvents.length - 2; - break; - } - } - } - } - index = -1; - while (++index < events.length) { - if (events[index][1].type === 'strikethroughSequenceTemporary') { - events[index][1].type = "data"; - } - } - return events; - } - function tokenizeStrikethrough(effects, ok, nok) { - const previous = this.previous; - const events = this.events; - let size = 0; - return start; - function start(code) { - if (previous === 126 && events[events.length - 1][1].type !== "characterEscape") { - return nok(code); - } - effects.enter('strikethroughSequenceTemporary'); - return more(code); - } - function more(code) { - const before = classifyCharacter(previous); - if (code === 126) { - if (size > 1) return nok(code); - effects.consume(code); - size++; - return more; - } - if (size < 2 && !single) return nok(code); - const token = effects.exit('strikethroughSequenceTemporary'); - const after = classifyCharacter(code); - token._open = !after || after === 2 && Boolean(before); - token._close = !before || before === 2 && Boolean(after); - return ok(code); - } - } -} - -class EditMap { - constructor() { - this.map = []; - } - add(index, remove, add) { - addImplementation(this, index, remove, add); - } - consume(events) { - this.map.sort(function (a, b) { - return a[0] - b[0]; - }); - if (this.map.length === 0) { - return; - } - let index = this.map.length; - const vecs = []; - while (index > 0) { - index -= 1; - vecs.push(events.slice(this.map[index][0] + this.map[index][1]), this.map[index][2]); - events.length = this.map[index][0]; - } - vecs.push([...events]); - events.length = 0; - let slice = vecs.pop(); - while (slice) { - events.push(...slice); - slice = vecs.pop(); - } - this.map.length = 0; - } -} -function addImplementation(editMap, at, remove, add) { - let index = 0; - if (remove === 0 && add.length === 0) { - return; - } - while (index < editMap.map.length) { - if (editMap.map[index][0] === at) { - editMap.map[index][1] += remove; - editMap.map[index][2].push(...add); - return; - } - index += 1; - } - editMap.map.push([at, remove, add]); -} - -function gfmTableAlign(events, index) { - let inDelimiterRow = false; - const align = []; - while (index < events.length) { - const event = events[index]; - if (inDelimiterRow) { - if (event[0] === 'enter') { - if (event[1].type === 'tableContent') { - align.push(events[index + 1][1].type === 'tableDelimiterMarker' ? 'left' : 'none'); - } - } - else if (event[1].type === 'tableContent') { - if (events[index - 1][1].type === 'tableDelimiterMarker') { - const alignIndex = align.length - 1; - align[alignIndex] = align[alignIndex] === 'left' ? 'center' : 'right'; - } - } - else if (event[1].type === 'tableDelimiterRow') { - break; - } - } else if (event[0] === 'enter' && event[1].type === 'tableDelimiterRow') { - inDelimiterRow = true; - } - index += 1; - } - return align; -} - -function gfmTable() { - return { - flow: { - null: { - name: 'table', - tokenize: tokenizeTable, - resolveAll: resolveTable - } - } - }; -} -function tokenizeTable(effects, ok, nok) { - const self = this; - let size = 0; - let sizeB = 0; - let seen; - return start; - function start(code) { - let index = self.events.length - 1; - while (index > -1) { - const type = self.events[index][1].type; - if (type === "lineEnding" || - type === "linePrefix") index--;else break; - } - const tail = index > -1 ? self.events[index][1].type : null; - const next = tail === 'tableHead' || tail === 'tableRow' ? bodyRowStart : headRowBefore; - if (next === bodyRowStart && self.parser.lazy[self.now().line]) { - return nok(code); - } - return next(code); - } - function headRowBefore(code) { - effects.enter('tableHead'); - effects.enter('tableRow'); - return headRowStart(code); - } - function headRowStart(code) { - if (code === 124) { - return headRowBreak(code); - } - seen = true; - sizeB += 1; - return headRowBreak(code); - } - function headRowBreak(code) { - if (code === null) { - return nok(code); - } - if (markdownLineEnding(code)) { - if (sizeB > 1) { - sizeB = 0; - self.interrupt = true; - effects.exit('tableRow'); - effects.enter("lineEnding"); - effects.consume(code); - effects.exit("lineEnding"); - return headDelimiterStart; - } - return nok(code); - } - if (markdownSpace(code)) { - return factorySpace(effects, headRowBreak, "whitespace")(code); - } - sizeB += 1; - if (seen) { - seen = false; - size += 1; - } - if (code === 124) { - effects.enter('tableCellDivider'); - effects.consume(code); - effects.exit('tableCellDivider'); - seen = true; - return headRowBreak; - } - effects.enter("data"); - return headRowData(code); - } - function headRowData(code) { - if (code === null || code === 124 || markdownLineEndingOrSpace(code)) { - effects.exit("data"); - return headRowBreak(code); - } - effects.consume(code); - return code === 92 ? headRowEscape : headRowData; - } - function headRowEscape(code) { - if (code === 92 || code === 124) { - effects.consume(code); - return headRowData; - } - return headRowData(code); - } - function headDelimiterStart(code) { - self.interrupt = false; - if (self.parser.lazy[self.now().line]) { - return nok(code); - } - effects.enter('tableDelimiterRow'); - seen = false; - if (markdownSpace(code)) { - return factorySpace(effects, headDelimiterBefore, "linePrefix", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4)(code); - } - return headDelimiterBefore(code); - } - function headDelimiterBefore(code) { - if (code === 45 || code === 58) { - return headDelimiterValueBefore(code); - } - if (code === 124) { - seen = true; - effects.enter('tableCellDivider'); - effects.consume(code); - effects.exit('tableCellDivider'); - return headDelimiterCellBefore; - } - return headDelimiterNok(code); - } - function headDelimiterCellBefore(code) { - if (markdownSpace(code)) { - return factorySpace(effects, headDelimiterValueBefore, "whitespace")(code); - } - return headDelimiterValueBefore(code); - } - function headDelimiterValueBefore(code) { - if (code === 58) { - sizeB += 1; - seen = true; - effects.enter('tableDelimiterMarker'); - effects.consume(code); - effects.exit('tableDelimiterMarker'); - return headDelimiterLeftAlignmentAfter; - } - if (code === 45) { - sizeB += 1; - return headDelimiterLeftAlignmentAfter(code); - } - if (code === null || markdownLineEnding(code)) { - return headDelimiterCellAfter(code); - } - return headDelimiterNok(code); - } - function headDelimiterLeftAlignmentAfter(code) { - if (code === 45) { - effects.enter('tableDelimiterFiller'); - return headDelimiterFiller(code); - } - return headDelimiterNok(code); - } - function headDelimiterFiller(code) { - if (code === 45) { - effects.consume(code); - return headDelimiterFiller; - } - if (code === 58) { - seen = true; - effects.exit('tableDelimiterFiller'); - effects.enter('tableDelimiterMarker'); - effects.consume(code); - effects.exit('tableDelimiterMarker'); - return headDelimiterRightAlignmentAfter; - } - effects.exit('tableDelimiterFiller'); - return headDelimiterRightAlignmentAfter(code); - } - function headDelimiterRightAlignmentAfter(code) { - if (markdownSpace(code)) { - return factorySpace(effects, headDelimiterCellAfter, "whitespace")(code); - } - return headDelimiterCellAfter(code); - } - function headDelimiterCellAfter(code) { - if (code === 124) { - return headDelimiterBefore(code); - } - if (code === null || markdownLineEnding(code)) { - if (!seen || size !== sizeB) { - return headDelimiterNok(code); - } - effects.exit('tableDelimiterRow'); - effects.exit('tableHead'); - return ok(code); - } - return headDelimiterNok(code); - } - function headDelimiterNok(code) { - return nok(code); - } - function bodyRowStart(code) { - effects.enter('tableRow'); - return bodyRowBreak(code); - } - function bodyRowBreak(code) { - if (code === 124) { - effects.enter('tableCellDivider'); - effects.consume(code); - effects.exit('tableCellDivider'); - return bodyRowBreak; - } - if (code === null || markdownLineEnding(code)) { - effects.exit('tableRow'); - return ok(code); - } - if (markdownSpace(code)) { - return factorySpace(effects, bodyRowBreak, "whitespace")(code); - } - effects.enter("data"); - return bodyRowData(code); - } - function bodyRowData(code) { - if (code === null || code === 124 || markdownLineEndingOrSpace(code)) { - effects.exit("data"); - return bodyRowBreak(code); - } - effects.consume(code); - return code === 92 ? bodyRowEscape : bodyRowData; - } - function bodyRowEscape(code) { - if (code === 92 || code === 124) { - effects.consume(code); - return bodyRowData; - } - return bodyRowData(code); - } -} -function resolveTable(events, context) { - let index = -1; - let inFirstCellAwaitingPipe = true; - let rowKind = 0; - let lastCell = [0, 0, 0, 0]; - let cell = [0, 0, 0, 0]; - let afterHeadAwaitingFirstBodyRow = false; - let lastTableEnd = 0; - let currentTable; - let currentBody; - let currentCell; - const map = new EditMap(); - while (++index < events.length) { - const event = events[index]; - const token = event[1]; - if (event[0] === 'enter') { - if (token.type === 'tableHead') { - afterHeadAwaitingFirstBodyRow = false; - if (lastTableEnd !== 0) { - flushTableEnd(map, context, lastTableEnd, currentTable, currentBody); - currentBody = undefined; - lastTableEnd = 0; - } - currentTable = { - type: 'table', - start: Object.assign({}, token.start), - end: Object.assign({}, token.end) - }; - map.add(index, 0, [['enter', currentTable, context]]); - } else if (token.type === 'tableRow' || token.type === 'tableDelimiterRow') { - inFirstCellAwaitingPipe = true; - currentCell = undefined; - lastCell = [0, 0, 0, 0]; - cell = [0, index + 1, 0, 0]; - if (afterHeadAwaitingFirstBodyRow) { - afterHeadAwaitingFirstBodyRow = false; - currentBody = { - type: 'tableBody', - start: Object.assign({}, token.start), - end: Object.assign({}, token.end) - }; - map.add(index, 0, [['enter', currentBody, context]]); - } - rowKind = token.type === 'tableDelimiterRow' ? 2 : currentBody ? 3 : 1; - } - else if (rowKind && (token.type === "data" || token.type === 'tableDelimiterMarker' || token.type === 'tableDelimiterFiller')) { - inFirstCellAwaitingPipe = false; - if (cell[2] === 0) { - if (lastCell[1] !== 0) { - cell[0] = cell[1]; - currentCell = flushCell(map, context, lastCell, rowKind, undefined, currentCell); - lastCell = [0, 0, 0, 0]; - } - cell[2] = index; - } - } else if (token.type === 'tableCellDivider') { - if (inFirstCellAwaitingPipe) { - inFirstCellAwaitingPipe = false; - } else { - if (lastCell[1] !== 0) { - cell[0] = cell[1]; - currentCell = flushCell(map, context, lastCell, rowKind, undefined, currentCell); - } - lastCell = cell; - cell = [lastCell[1], index, 0, 0]; - } - } - } - else if (token.type === 'tableHead') { - afterHeadAwaitingFirstBodyRow = true; - lastTableEnd = index; - } else if (token.type === 'tableRow' || token.type === 'tableDelimiterRow') { - lastTableEnd = index; - if (lastCell[1] !== 0) { - cell[0] = cell[1]; - currentCell = flushCell(map, context, lastCell, rowKind, index, currentCell); - } else if (cell[1] !== 0) { - currentCell = flushCell(map, context, cell, rowKind, index, currentCell); - } - rowKind = 0; - } else if (rowKind && (token.type === "data" || token.type === 'tableDelimiterMarker' || token.type === 'tableDelimiterFiller')) { - cell[3] = index; - } - } - if (lastTableEnd !== 0) { - flushTableEnd(map, context, lastTableEnd, currentTable, currentBody); - } - map.consume(context.events); - index = -1; - while (++index < context.events.length) { - const event = context.events[index]; - if (event[0] === 'enter' && event[1].type === 'table') { - event[1]._align = gfmTableAlign(context.events, index); - } - } - return events; -} -function flushCell(map, context, range, rowKind, rowEnd, previousCell) { - const groupName = rowKind === 1 ? 'tableHeader' : rowKind === 2 ? 'tableDelimiter' : 'tableData'; - const valueName = 'tableContent'; - if (range[0] !== 0) { - previousCell.end = Object.assign({}, getPoint(context.events, range[0])); - map.add(range[0], 0, [['exit', previousCell, context]]); - } - const now = getPoint(context.events, range[1]); - previousCell = { - type: groupName, - start: Object.assign({}, now), - end: Object.assign({}, now) - }; - map.add(range[1], 0, [['enter', previousCell, context]]); - if (range[2] !== 0) { - const relatedStart = getPoint(context.events, range[2]); - const relatedEnd = getPoint(context.events, range[3]); - const valueToken = { - type: valueName, - start: Object.assign({}, relatedStart), - end: Object.assign({}, relatedEnd) - }; - map.add(range[2], 0, [['enter', valueToken, context]]); - if (rowKind !== 2) { - const start = context.events[range[2]]; - const end = context.events[range[3]]; - start[1].end = Object.assign({}, end[1].end); - start[1].type = "chunkText"; - start[1].contentType = "text"; - if (range[3] > range[2] + 1) { - const a = range[2] + 1; - const b = range[3] - range[2] - 1; - map.add(a, b, []); - } - } - map.add(range[3] + 1, 0, [['exit', valueToken, context]]); - } - if (rowEnd !== undefined) { - previousCell.end = Object.assign({}, getPoint(context.events, rowEnd)); - map.add(rowEnd, 0, [['exit', previousCell, context]]); - previousCell = undefined; - } - return previousCell; -} -function flushTableEnd(map, context, index, table, tableBody) { - const exits = []; - const related = getPoint(context.events, index); - if (tableBody) { - tableBody.end = Object.assign({}, related); - exits.push(['exit', tableBody, context]); - } - table.end = Object.assign({}, related); - exits.push(['exit', table, context]); - map.add(index + 1, 0, exits); -} -function getPoint(events, index) { - const event = events[index]; - const side = event[0] === 'enter' ? 'start' : 'end'; - return event[1][side]; -} - -const tasklistCheck = { - name: 'tasklistCheck', - tokenize: tokenizeTasklistCheck -}; -function gfmTaskListItem() { - return { - text: { - [91]: tasklistCheck - } - }; -} -function tokenizeTasklistCheck(effects, ok, nok) { - const self = this; - return open; - function open(code) { - if ( - self.previous !== null || - !self._gfmTasklistFirstContentOfListItem) { - return nok(code); - } - effects.enter('taskListCheck'); - effects.enter('taskListCheckMarker'); - effects.consume(code); - effects.exit('taskListCheckMarker'); - return inside; - } - function inside(code) { - if (markdownLineEndingOrSpace(code)) { - effects.enter('taskListCheckValueUnchecked'); - effects.consume(code); - effects.exit('taskListCheckValueUnchecked'); - return close; - } - if (code === 88 || code === 120) { - effects.enter('taskListCheckValueChecked'); - effects.consume(code); - effects.exit('taskListCheckValueChecked'); - return close; - } - return nok(code); - } - function close(code) { - if (code === 93) { - effects.enter('taskListCheckMarker'); - effects.consume(code); - effects.exit('taskListCheckMarker'); - effects.exit('taskListCheck'); - return after; - } - return nok(code); - } - function after(code) { - if (markdownLineEnding(code)) { - return ok(code); - } - if (markdownSpace(code)) { - return effects.check({ - tokenize: spaceThenNonSpace - }, ok, nok)(code); - } - return nok(code); - } -} -function spaceThenNonSpace(effects, ok, nok) { - return factorySpace(effects, after, "whitespace"); - function after(code) { - return code === null ? nok(code) : ok(code); - } -} - -function gfm(options) { - return combineExtensions([ - gfmAutolinkLiteral(), - gfmFootnote(), - gfmStrikethrough(options), - gfmTable(), - gfmTaskListItem() - ]) -} - -const emptyOptions$1 = {}; -function remarkGfm(options) { - const self = (this); - const settings = options || emptyOptions$1; - const data = self.data(); - const micromarkExtensions = - data.micromarkExtensions || (data.micromarkExtensions = []); - const fromMarkdownExtensions = - data.fromMarkdownExtensions || (data.fromMarkdownExtensions = []); - const toMarkdownExtensions = - data.toMarkdownExtensions || (data.toMarkdownExtensions = []); - micromarkExtensions.push(gfm(settings)); - fromMarkdownExtensions.push(gfmFromMarkdown()); - toMarkdownExtensions.push(gfmToMarkdown(settings)); -} - -const commentExpression = /\s*([a-zA-Z\d-]+)(\s+([\s\S]*))?\s*/; -const esCommentExpression = new RegExp( - '(\\s*\\/\\*' + commentExpression.source + '\\*\\/\\s*)' -); -const markerExpression = new RegExp( - '(\\s*\\s*)' -); -function commentMarker(value) { - if ( - isNode(value) && - (value.type === 'html' || - value.type === 'mdxFlowExpression' || - value.type === 'mdxTextExpression') - ) { - const match = value.value.match( - value.type === 'html' ? markerExpression : esCommentExpression - ); - if (match && match[0].length === value.value.length) { - const parameters = parseParameters(match[3] || ''); - if (parameters) { - return { - name: match[2], - attributes: (match[4] || '').trim(), - parameters, - node: value - } - } - } - } -} -function parseParameters(value) { - const parameters = {}; - return value - .replace( - /\s+([-\w]+)(?:=(?:"((?:\\[\s\S]|[^"])*)"|'((?:\\[\s\S]|[^'])*)'|((?:\\[\s\S]|[^"'\s])+)))?/gi, - replacer - ) - .replace(/\s+/g, '') - ? undefined - : parameters - function replacer(_, $1, $2, $3, $4) { - let value = $2 === undefined ? ($3 === undefined ? $4 : $3) : $2; - const number = Number(value); - if (value === 'true' || value === undefined) { - value = true; - } else if (value === 'false') { - value = false; - } else if (value.trim() && !Number.isNaN(number)) { - value = number; - } - parameters[$1] = value; - return '' - } -} -function isNode(value) { - return Boolean(value && typeof value === 'object' && 'type' in value) -} - -function parse(value) { - const input = String(value || '').trim(); - return input ? input.split(/[ \t\n\r\f]+/g) : [] -} - -function location(file) { - const value = String(file); - const indices = []; - return {toOffset, toPoint} - function toPoint(offset) { - if (typeof offset === 'number' && offset > -1 && offset <= value.length) { - let index = 0; - while (true) { - let end = indices[index]; - if (end === undefined) { - const eol = next(value, indices[index - 1]); - end = eol === -1 ? value.length + 1 : eol + 1; - indices[index] = end; - } - if (end > offset) { - return { - line: index + 1, - column: offset - (index > 0 ? indices[index - 1] : 0) + 1, - offset - } - } - index++; - } - } - } - function toOffset(point) { - if ( - point && - typeof point.line === 'number' && - typeof point.column === 'number' && - !Number.isNaN(point.line) && - !Number.isNaN(point.column) - ) { - while (indices.length < point.line) { - const from = indices[indices.length - 1]; - const eol = next(value, from); - const end = eol === -1 ? value.length + 1 : eol + 1; - if (from === end) break - indices.push(end); - } - const offset = - (point.line > 1 ? indices[point.line - 2] : 0) + point.column - 1; - if (offset < indices[point.line - 1]) return offset - } - } -} -function next(value, from) { - const cr = value.indexOf('\r', from); - const lf = value.indexOf('\n', from); - if (lf === -1) return cr - if (cr === -1 || cr + 1 === lf) return lf - return cr < lf ? cr : lf -} - -const own = {}.hasOwnProperty; -function messageControl(tree, options) { - if (!options || typeof options !== 'object') { - throw new Error('Expected `options`') - } - const {file, marker, name, test} = options; - let {enable, disable, known, reset, source} = options; - if (!enable) enable = []; - if (!disable) disable = []; - if (!file) { - throw new Error('Expected `file` in `options`') - } - if (!marker) { - throw new Error('Expected `marker` in `options`') - } - if (!name) { - throw new Error('Expected `name` in `options`') - } - const sources = typeof source === 'string' ? [source] : source || [name]; - const toOffset = location(file).toOffset; - const initial = !reset; - const gaps = detectGaps(tree); - const scope = {}; - const globals = []; - visit(tree, test, visitor); - file.messages = file.messages.filter(function (m) { - return filter(m) - }); - function visitor(node, position, parent) { - const point = node.position && node.position.start; - const mark = marker(node); - if (!point || !mark || mark.name !== name) { - return - } - const ruleIds = parse(mark.attributes); - const verb = ruleIds.shift(); - const fn = - verb === 'enable' - ? doEnable - : verb === 'disable' - ? doDisable - : verb === 'ignore' - ? doIgnore - : undefined; - if (!fn) { - file.fail( - 'Unknown keyword `' + - verb + - '`: expected ' + - "`'enable'`, `'disable'`, or `'ignore'`", - node - ); - } - const next = - (parent && position !== undefined && parent.children[position + 1]) || - undefined; - const tail = next && next.position && next.position.end; - if (ruleIds.length === 0) { - fn(point, undefined, tail); - } else { - let index = -1; - while (++index < ruleIds.length) { - const ruleId = ruleIds[index]; - if (isKnown(ruleId, verb, node)) { - fn(point, ruleId, tail); - } - } - } - } - function doIgnore(point, ruleId, tail) { - if (tail) { - toggle(point, false, ruleId); - toggle(tail, true, ruleId); - } - } - function doDisable(point, ruleId) { - toggle(point, false, ruleId); - if (!ruleId) reset = true; - } - function doEnable(point, ruleId) { - toggle(point, true, ruleId); - if (!ruleId) reset = false; - } - function filter(message) { - let gapIndex = gaps.length; - if (!message.source || !sources.includes(message.source)) { - return true - } - if (!message.line) message.line = 1; - if (!message.column) message.column = 1; - const offset = toOffset(message); - while (gapIndex--) { - if (gaps[gapIndex][0] <= offset && gaps[gapIndex][1] > offset) { - return false - } - } - return ( - (!message.ruleId || check(message, scope[message.ruleId], true)) && - check(message, globals, false) - ) - } - function isKnown(ruleId, verb, node) { - const result = known ? known.includes(ruleId) : true; - if (!result) { - file.message('Cannot ' + verb + " `'" + ruleId + "'`, it’s not known", { - ancestors: [node], - place: node.position, - ruleId: 'known', - source: 'unified-message-control' - }); - } - return result - } - function getState(ruleId) { - const ranges = ruleId ? scope[ruleId] : globals; - if (ranges && ranges.length > 0) { - return ranges[ranges.length - 1].state - } - return ruleId - ? reset - ? enable.includes(ruleId) - : !disable.includes(ruleId) - : !reset - } - function toggle(point, state, ruleId) { - const markers = ruleId ? scope[ruleId] || (scope[ruleId] = []) : globals; - const current = getState(ruleId); - if (current !== state) { - markers.push({state, point}); - } - if (!ruleId) { - for (ruleId in scope) { - if (own.call(scope, ruleId)) { - toggle(point, state, ruleId); - } - } - } - } - function check(message, marks, local) { - if (message.line && message.column && marks && marks.length > 0) { - let index = marks.length; - while (index--) { - const mark = marks[index]; - if ( - mark.point && - (mark.point.line < message.line || - (mark.point.line === message.line && - mark.point.column <= message.column)) - ) { - return mark.state === true - } - } - } - if (local) { - ok$1(message.ruleId); - return reset - ? enable.includes(message.ruleId) - : !disable.includes(message.ruleId) - } - return Boolean(initial || reset) - } -} -function detectGaps(tree) { - const end = - tree && tree.position && tree.position.end && tree.position.end.offset; - let offset = 0; - let gap = false; - const gaps = []; - visit(tree, one); - if (typeof end === 'number' && offset !== end) { - update(); - update(end); - } - return gaps - function one(node) { - update(node.position && node.position.start && node.position.start.offset); - if (!('children' in node)) { - update(node.position && node.position.end && node.position.end.offset); - } - } - function update(latest) { - if (latest === null || latest === undefined) { - gap = true; - } else if (offset < latest) { - if (gap) { - gaps.push([offset, latest]); - gap = false; - } - offset = latest; - } - } -} - -const test = [ - 'comment', - 'html', - 'mdxFlowExpression', - 'mdxTextExpression' -]; -function remarkMessageControl(options) { - return function (tree, file) { - messageControl(tree, {...options, file, marker: commentMarker, test}); - } -} - -function remarkLint() { - this.use(lintMessageControl); -} -function lintMessageControl() { - return remarkMessageControl({name: 'lint', source: 'remark-lint'}) -} - -function lintRule$1(meta, rule) { - const id = typeof meta === 'string' ? meta : meta.origin; - const url = typeof meta === 'string' ? undefined : meta.url; - const parts = id.split(':'); - const source = parts[1] ? parts[0] : undefined; - const ruleId = parts[1]; - Object.defineProperty(plugin, 'name', {value: id}); - return plugin - function plugin(config) { - const [severity, options] = coerce$1(ruleId, config); - const fatal = severity === 2; - if (!severity) return - return function (tree, file, next) { - let index = file.messages.length - 1; - wrap(rule, function (error) { - const messages = file.messages; - if (error && !messages.includes(error)) { - try { - file.fail(error); - } catch {} - } - while (++index < messages.length) { - Object.assign(messages[index], {fatal, ruleId, source, url}); - } - next(); - })(tree, file, options); - } - } -} -function coerce$1(name, config) { - if (!Array.isArray(config)) { - return [1, config] - } - const [severity, ...options] = config; - switch (severity) { - case false: - case 0: - case 'off': { - return [0, ...options] - } - case true: - case 1: - case 'on': - case 'warn': { - return [1, ...options] - } - case 2: - case 'error': { - return [2, ...options] - } - default: { - if (typeof severity !== 'number') { - return [1, config] - } - throw new Error( - 'Incorrect severity `' + - severity + - '` for `' + - name + - '`, ' + - 'expected 0, 1, or 2' - ) - } - } -} - -/** - * remark-lint rule to warn when a final line ending is missing. - * - * ## What is this? - * - * This package checks the final line ending. - * - * ## When should I use this? - * - * You can use this package to check final line endings. - * - * ## API - * - * ### `unified().use(remarkLintFinalNewline)` - * - * Warn when a final line ending is missing. - * - * ###### Parameters - * - * There are no options. - * - * ###### Returns - * - * Transform ([`Transformer` from `unified`][github-unified-transformer]). - * - * ## Recommendation - * - * Turn this rule on. - * See [StackExchange][] for more info. - * - * ## Fix - * - * [`remark-stringify`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify) - * always adds final line endings. - * - * [api-remark-lint-final-newline]: #unifieduseremarklintfinalnewline - * [github-remark-stringify]: https://github.com/remarkjs/remark/tree/main/packages/remark-stringify - * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer - * [stackexchange]: https://unix.stackexchange.com/questions/18743 - * - * ## Examples - * - * ##### `ok.md` - * - * ###### In - * - * ```markdown - * Mercury␊ - * ``` - * - * ###### Out - * - * No messages. - * - * ##### `not-ok.md` - * - * ###### In - * - * ```markdown - * Mercury␀ - * ``` - * - * ###### Out - * - * ```text - * 1:8: Unexpected missing final newline character, expected line feed (`\n`) at end of file - * ``` - * - * @module final-newline - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - */ -const remarkLintFinalNewline = lintRule$1( - { - origin: 'remark-lint:final-newline', - url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-final-newline#readme' - }, - function (_, file) { - const value = String(file); - const end = location(file).toPoint(value.length); - const last = value.length - 1; - if ( - last !== -1 && - value.charAt(last) !== '\n' - ) { - file.message( - 'Unexpected missing final newline character, expected line feed (`\\n`) at end of file', - end - ); - } - } -); - -const pointEnd = point('end'); -const pointStart = point('start'); -function point(type) { - return point - function point(node) { - const point = (node && node.position && node.position[type]) || {}; - if ( - typeof point.line === 'number' && - point.line > 0 && - typeof point.column === 'number' && - point.column > 0 - ) { - return { - line: point.line, - column: point.column, - offset: - typeof point.offset === 'number' && point.offset > -1 - ? point.offset - : undefined - } - } - } -} -function position(node) { - const start = pointStart(node); - const end = pointEnd(node); - if (start && end) { - return {start, end} - } -} - -/** - * remark-lint rule to warn when more spaces are used than needed - * for hard breaks. - * - * ## What is this? - * - * This package checks the whitespace of hard breaks. - * - * ## When should I use this? - * - * You can use this package to check that the number of spaces in hard breaks - * are consistent. - * - * ## API - * - * ### `unified().use(remarkLintHardBreakSpaces)` - * - * Warn when more spaces are used than needed for hard breaks. - * - * ###### Parameters - * - * There are no options. - * - * ###### Returns - * - * Transform ([`Transformer` from `unified`][github-unified-transformer]). - * - * ## Recommendation - * - * Less than two spaces do not create a hard breaks and more than two spaces - * have no effect. - * Due to this, it’s recommended to turn this rule on. - * - * [api-remark-lint-hard-break-spaces]: #unifieduseremarklinthardbreakspaces - * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer - * - * @module hard-break-spaces - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @example - * {"name": "ok.md"} - * - * **Mercury** is the first planet from the Sun␠␠ - * and the smallest in the Solar System. - * - * @example - * {"label": "input", "name": "not-ok.md"} - * - * **Mercury** is the first planet from the Sun␠␠␠ - * and the smallest in the Solar System. - * @example - * {"label": "output", "name": "not-ok.md"} - * - * 1:45-2:1: Unexpected `3` spaces for hard break, expected `2` spaces - * - * @example - * {"gfm": true, "label": "input", "name": "containers.md"} - * - * [^mercury]: - * > * > * **Mercury** is the first planet from the Sun␠␠␠ - * > > and the smallest in the Solar System. - * @example - * {"gfm": true, "label": "output", "name": "containers.md"} - * - * 2:57-3:1: Unexpected `3` spaces for hard break, expected `2` spaces - */ -const remarkLintHardBreakSpaces = lintRule$1( - { - origin: 'remark-lint:hard-break-spaces', - url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-hard-break-spaces#readme' - }, - function (tree, file) { - const value = String(file); - visit(tree, 'break', function (node) { - const end = pointEnd(node); - const start = pointStart(node); - if ( - end && - start && - typeof end.offset === 'number' && - typeof start.offset === 'number' - ) { - const slice = value.slice(start.offset, end.offset); - let actual = 0; - while (slice.charCodeAt(actual) === 32) actual++; - if (actual > 2) { - file.message( - 'Unexpected `' + - actual + - '` spaces for hard break, expected `2` spaces', - node - ); - } - } - }); - } -); - -function commonjsRequire(path) { - throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.'); -} - -var pluralize$2 = {exports: {}}; - -var pluralize$1 = pluralize$2.exports; -var hasRequiredPluralize; -function requirePluralize () { - if (hasRequiredPluralize) return pluralize$2.exports; - hasRequiredPluralize = 1; - (function (module, exports) { - (function (root, pluralize) { - if (typeof commonjsRequire === 'function' && 'object' === 'object' && 'object' === 'object') { - module.exports = pluralize(); - } else { - root.pluralize = pluralize(); - } - })(pluralize$1, function () { - var pluralRules = []; - var singularRules = []; - var uncountables = {}; - var irregularPlurals = {}; - var irregularSingles = {}; - function sanitizeRule (rule) { - if (typeof rule === 'string') { - return new RegExp('^' + rule + '$', 'i'); - } - return rule; - } - function restoreCase (word, token) { - if (word === token) return token; - if (word === word.toLowerCase()) return token.toLowerCase(); - if (word === word.toUpperCase()) return token.toUpperCase(); - if (word[0] === word[0].toUpperCase()) { - return token.charAt(0).toUpperCase() + token.substr(1).toLowerCase(); - } - return token.toLowerCase(); - } - function interpolate (str, args) { - return str.replace(/\$(\d{1,2})/g, function (match, index) { - return args[index] || ''; - }); - } - function replace (word, rule) { - return word.replace(rule[0], function (match, index) { - var result = interpolate(rule[1], arguments); - if (match === '') { - return restoreCase(word[index - 1], result); - } - return restoreCase(match, result); - }); - } - function sanitizeWord (token, word, rules) { - if (!token.length || uncountables.hasOwnProperty(token)) { - return word; - } - var len = rules.length; - while (len--) { - var rule = rules[len]; - if (rule[0].test(word)) return replace(word, rule); - } - return word; - } - function replaceWord (replaceMap, keepMap, rules) { - return function (word) { - var token = word.toLowerCase(); - if (keepMap.hasOwnProperty(token)) { - return restoreCase(word, token); - } - if (replaceMap.hasOwnProperty(token)) { - return restoreCase(word, replaceMap[token]); - } - return sanitizeWord(token, word, rules); - }; - } - function checkWord (replaceMap, keepMap, rules, bool) { - return function (word) { - var token = word.toLowerCase(); - if (keepMap.hasOwnProperty(token)) return true; - if (replaceMap.hasOwnProperty(token)) return false; - return sanitizeWord(token, token, rules) === token; - }; - } - function pluralize (word, count, inclusive) { - var pluralized = count === 1 - ? pluralize.singular(word) : pluralize.plural(word); - return (inclusive ? count + ' ' : '') + pluralized; - } - pluralize.plural = replaceWord( - irregularSingles, irregularPlurals, pluralRules - ); - pluralize.isPlural = checkWord( - irregularSingles, irregularPlurals, pluralRules - ); - pluralize.singular = replaceWord( - irregularPlurals, irregularSingles, singularRules - ); - pluralize.isSingular = checkWord( - irregularPlurals, irregularSingles, singularRules - ); - pluralize.addPluralRule = function (rule, replacement) { - pluralRules.push([sanitizeRule(rule), replacement]); - }; - pluralize.addSingularRule = function (rule, replacement) { - singularRules.push([sanitizeRule(rule), replacement]); - }; - pluralize.addUncountableRule = function (word) { - if (typeof word === 'string') { - uncountables[word.toLowerCase()] = true; - return; - } - pluralize.addPluralRule(word, '$0'); - pluralize.addSingularRule(word, '$0'); - }; - pluralize.addIrregularRule = function (single, plural) { - plural = plural.toLowerCase(); - single = single.toLowerCase(); - irregularSingles[single] = plural; - irregularPlurals[plural] = single; - }; - [ - ['I', 'we'], - ['me', 'us'], - ['he', 'they'], - ['she', 'they'], - ['them', 'them'], - ['myself', 'ourselves'], - ['yourself', 'yourselves'], - ['itself', 'themselves'], - ['herself', 'themselves'], - ['himself', 'themselves'], - ['themself', 'themselves'], - ['is', 'are'], - ['was', 'were'], - ['has', 'have'], - ['this', 'these'], - ['that', 'those'], - ['echo', 'echoes'], - ['dingo', 'dingoes'], - ['volcano', 'volcanoes'], - ['tornado', 'tornadoes'], - ['torpedo', 'torpedoes'], - ['genus', 'genera'], - ['viscus', 'viscera'], - ['stigma', 'stigmata'], - ['stoma', 'stomata'], - ['dogma', 'dogmata'], - ['lemma', 'lemmata'], - ['schema', 'schemata'], - ['anathema', 'anathemata'], - ['ox', 'oxen'], - ['axe', 'axes'], - ['die', 'dice'], - ['yes', 'yeses'], - ['foot', 'feet'], - ['eave', 'eaves'], - ['goose', 'geese'], - ['tooth', 'teeth'], - ['quiz', 'quizzes'], - ['human', 'humans'], - ['proof', 'proofs'], - ['carve', 'carves'], - ['valve', 'valves'], - ['looey', 'looies'], - ['thief', 'thieves'], - ['groove', 'grooves'], - ['pickaxe', 'pickaxes'], - ['passerby', 'passersby'] - ].forEach(function (rule) { - return pluralize.addIrregularRule(rule[0], rule[1]); - }); - [ - [/s?$/i, 's'], - [/[^\u0000-\u007F]$/i, '$0'], - [/([^aeiou]ese)$/i, '$1'], - [/(ax|test)is$/i, '$1es'], - [/(alias|[^aou]us|t[lm]as|gas|ris)$/i, '$1es'], - [/(e[mn]u)s?$/i, '$1s'], - [/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i, '$1'], - [/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, '$1i'], - [/(alumn|alg|vertebr)(?:a|ae)$/i, '$1ae'], - [/(seraph|cherub)(?:im)?$/i, '$1im'], - [/(her|at|gr)o$/i, '$1oes'], - [/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i, '$1a'], - [/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i, '$1a'], - [/sis$/i, 'ses'], - [/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i, '$1$2ves'], - [/([^aeiouy]|qu)y$/i, '$1ies'], - [/([^ch][ieo][ln])ey$/i, '$1ies'], - [/(x|ch|ss|sh|zz)$/i, '$1es'], - [/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i, '$1ices'], - [/\b((?:tit)?m|l)(?:ice|ouse)$/i, '$1ice'], - [/(pe)(?:rson|ople)$/i, '$1ople'], - [/(child)(?:ren)?$/i, '$1ren'], - [/eaux$/i, '$0'], - [/m[ae]n$/i, 'men'], - ['thou', 'you'] - ].forEach(function (rule) { - return pluralize.addPluralRule(rule[0], rule[1]); - }); - [ - [/s$/i, ''], - [/(ss)$/i, '$1'], - [/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i, '$1fe'], - [/(ar|(?:wo|[ae])l|[eo][ao])ves$/i, '$1f'], - [/ies$/i, 'y'], - [/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i, '$1ie'], - [/\b(mon|smil)ies$/i, '$1ey'], - [/\b((?:tit)?m|l)ice$/i, '$1ouse'], - [/(seraph|cherub)im$/i, '$1'], - [/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i, '$1'], - [/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i, '$1sis'], - [/(movie|twelve|abuse|e[mn]u)s$/i, '$1'], - [/(test)(?:is|es)$/i, '$1is'], - [/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, '$1us'], - [/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i, '$1um'], - [/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i, '$1on'], - [/(alumn|alg|vertebr)ae$/i, '$1a'], - [/(cod|mur|sil|vert|ind)ices$/i, '$1ex'], - [/(matr|append)ices$/i, '$1ix'], - [/(pe)(rson|ople)$/i, '$1rson'], - [/(child)ren$/i, '$1'], - [/(eau)x?$/i, '$1'], - [/men$/i, 'man'] - ].forEach(function (rule) { - return pluralize.addSingularRule(rule[0], rule[1]); - }); - [ - 'adulthood', - 'advice', - 'agenda', - 'aid', - 'aircraft', - 'alcohol', - 'ammo', - 'analytics', - 'anime', - 'athletics', - 'audio', - 'bison', - 'blood', - 'bream', - 'buffalo', - 'butter', - 'carp', - 'cash', - 'chassis', - 'chess', - 'clothing', - 'cod', - 'commerce', - 'cooperation', - 'corps', - 'debris', - 'diabetes', - 'digestion', - 'elk', - 'energy', - 'equipment', - 'excretion', - 'expertise', - 'firmware', - 'flounder', - 'fun', - 'gallows', - 'garbage', - 'graffiti', - 'hardware', - 'headquarters', - 'health', - 'herpes', - 'highjinks', - 'homework', - 'housework', - 'information', - 'jeans', - 'justice', - 'kudos', - 'labour', - 'literature', - 'machinery', - 'mackerel', - 'mail', - 'media', - 'mews', - 'moose', - 'music', - 'mud', - 'manga', - 'news', - 'only', - 'personnel', - 'pike', - 'plankton', - 'pliers', - 'police', - 'pollution', - 'premises', - 'rain', - 'research', - 'rice', - 'salmon', - 'scissors', - 'series', - 'sewage', - 'shambles', - 'shrimp', - 'software', - 'species', - 'staff', - 'swine', - 'tennis', - 'traffic', - 'transportation', - 'trout', - 'tuna', - 'wealth', - 'welfare', - 'whiting', - 'wildebeest', - 'wildlife', - 'you', - /pok[eé]mon$/i, - /[^aeiou]ese$/i, - /deer$/i, - /fish$/i, - /measles$/i, - /o[iu]s$/i, - /pox$/i, - /sheep$/i - ].forEach(pluralize.addUncountableRule); - return pluralize; - }); - } (pluralize$2)); - return pluralize$2.exports; -} - -var pluralizeExports = requirePluralize(); -var pluralize = /*@__PURE__*/getDefaultExportFromCjs(pluralizeExports); - -/** - * remark-lint rule to warn when list item markers are indented. - * - * ## What is this? - * - * This package checks indentation before list item markers. - * - * ## When should I use this? - * - * You can use this package to check that the style of list items is - * consistent. - * - * ## API - * - * ### `unified().use(remarkLintListItemBulletIndent)` - * - * Warn when list item markers are indented. - * - * ###### Parameters - * - * There are no options. - * - * ###### Returns - * - * Transform ([`Transformer` from `unified`][github-unified-transformer]). - * - * ## Recommendation - * - * There is no specific handling of indented list items in markdown. - * While it is possible to use an indent to align ordered lists on their marker: - * - * ```markdown - * 1. Mercury - * 10. Venus - * 100. Earth - * ``` - * - * …such a style is uncommon and hard to maintain as adding a 10th item - * means 9 other items have to change (more arduous while unlikely would be - * the 100th item). - * So it is recommended to not indent items and to turn this rule on. - * - * ## Fix - * - * [`remark-stringify`][github-remark-stringify] formats all items without - * indent. - * - * [api-remark-lint-list-item-bullet-indent]: #unifieduseremarklintlistitembulletindent - * [github-remark-stringify]: https://github.com/remarkjs/remark/tree/main/packages/remark-stringify - * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer - * - * @module list-item-bullet-indent - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @example - * {"name": "ok.md"} - * - * Mercury. - * - * * Venus. - * * Earth. - * - * @example - * {"label": "input", "name": "not-ok.md"} - * - * Mercury. - * - * ␠* Venus. - * ␠* Earth. - * - * @example - * {"label": "output", "name": "not-ok.md"} - * - * 3:2: Unexpected `1` space before list item, expected `0` spaces, remove them - * 4:2: Unexpected `1` space before list item, expected `0` spaces, remove them - */ -const remarkLintListItemBulletIndent = lintRule$1( - { - origin: 'remark-lint:list-item-bullet-indent', - url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-list-item-bullet-indent#readme' - }, - function (tree, file) { - const treeStart = pointStart(tree); - if (!tree || tree.type !== 'root' || !treeStart) return - for (const child of tree.children) { - if (child.type !== 'list') continue - const list = child; - for (const item of list.children) { - const place = pointStart(item); - if (!place) continue - const actual = place.column - treeStart.column; - if (actual) { - file.message( - 'Unexpected `' + - actual + - '` ' + - pluralize('space', actual) + - ' before list item, expected `0` spaces, remove them', - {ancestors: [tree, list, item], place} - ); - } - } - } - } -); - -/** - * remark-lint rule to warn when the whitespace after list item markers violate - * a given style. - * - * ## What is this? - * - * This package checks the style of whitespace after list item markers. - * - * ## When should I use this? - * - * You can use this package to check that the style of whitespace after list - * item markers and before content is consistent. - * - * ## API - * - * ### `unified().use(remarkLintListItemIndent[, options])` - * - * Warn when the whitespace after list item markers violate a given style. - * - * ###### Parameters - * - * * `options` ([`Options`][api-options], default: `'one'`) - * — preferred style - * - * ###### Returns - * - * Transform ([`Transformer` from `unified`][github-unified-transformer]). - * - * ### `Options` - * - * Configuration (TypeScript type). - * - * * `'mixed'` - * — prefer `'one'` for tight lists and `'tab'` for loose lists - * * `'one'` - * — prefer the size of the bullet and a single space - * * `'tab'` - * — prefer the size of the bullet and a single space to the next tab stop - * - * ###### Type - * - * ```ts - * type Options = 'mixed' | 'one' | 'tab' - * ``` - * - * ## Recommendation - * - * First some background. - * The number of spaces that occur after list markers (`*`, `-`, and `+` for - * unordered lists and `.` and `)` for unordered lists) and before the content - * on the first line, - * defines how much indentation can be used for further lines. - * At least one space is required and up to 4 spaces are allowed. - * If there is no further content after the marker then it’s a blank line which - * is handled as if there was one space. - * If there are 5 or more spaces and then content then it’s also seen as one - * space and the rest is seen as indented code. - * - * Regardless of ordered and unordered, - * there are two kinds of lists in markdown, - * tight and loose. - * Lists are tight by default but if there is a blank line between two list - * items or between two blocks inside an item, - * that turns the whole list into a loose list. - * When turning markdown into HTML, - * paragraphs in tight lists are not wrapped in `

` tags. - * - * How indentation of lists works in markdown has historically been a mess, - * especially with how they interact with indented code. - * CommonMark made that a *lot* better, - * but there remain (documented but complex) edge cases and some behavior - * intuitive. - * Due to this, `'tab'` works the best in most markdown parsers *and* in - * CommonMark. - * Currently the situation between markdown parsers is better, - * so the default `'one'`, - * which seems to be the most common style used by authors, - * is okay. - * - * ## Fix - * - * [`remark-stringify`][github-remark-stringify] uses `listItemIndent: 'one'` - * by default. - * `listItemIndent: 'mixed'` or `listItemIndent: 'tab'` is also supported. - * - * [api-options]: #options - * [api-remark-lint-list-item-indent]: #unifieduseremarklintlistitemindent-options - * [github-remark-stringify]: https://github.com/remarkjs/remark/tree/main/packages/remark-stringify - * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer - * - * @module list-item-indent - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * - * @example - * {"name": "ok.md"} - * - * *␠Mercury. - * *␠Venus. - * - * 111.␠Earth - * ␠␠␠␠␠and Mars. - * - * *␠**Jupiter**. - * - * ␠␠Jupiter is the fifth planet from the Sun and the largest in the Solar - * ␠␠System. - * - * *␠Saturn. - * - * ␠␠Saturn is the sixth planet from the Sun and the second-largest in the Solar System, after Jupiter. - * - * @example - * {"config": "mixed", "name": "ok.md"} - * - * *␠Mercury. - * *␠Venus. - * - * 111.␠Earth - * ␠␠␠␠␠and Mars. - * - * *␠␠␠**Jupiter**. - * - * ␠␠␠␠Jupiter is the fifth planet from the Sun and the largest in the Solar - * ␠␠␠␠System. - * - * *␠␠␠Saturn. - * - * ␠␠␠␠Saturn is the sixth planet from the Sun and the second-largest in the Solar System, after Jupiter. - * - * @example - * {"config": "mixed", "label": "input", "name": "not-ok.md"} - * - * *␠␠␠Mercury. - * *␠␠␠Venus. - * - * 111.␠␠␠␠Earth - * ␠␠␠␠␠␠␠␠and Mars. - * - * *␠**Jupiter**. - * - * ␠␠Jupiter is the fifth planet from the Sun and the largest in the Solar - * ␠␠System. - * - * *␠Saturn. - * - * ␠␠Saturn is the sixth planet from the Sun and the second-largest in the Solar System, after Jupiter. - * @example - * {"config": "mixed", "label": "output", "name": "not-ok.md"} - * - * 1:5: Unexpected `3` spaces between list item marker and content in tight list, expected `1` space, remove `2` spaces - * 2:5: Unexpected `3` spaces between list item marker and content in tight list, expected `1` space, remove `2` spaces - * 4:9: Unexpected `4` spaces between list item marker and content in tight list, expected `1` space, remove `3` spaces - * 7:3: Unexpected `1` space between list item marker and content in loose list, expected `3` spaces, add `2` spaces - * 12:3: Unexpected `1` space between list item marker and content in loose list, expected `3` spaces, add `2` spaces - * - * @example - * {"config": "one", "name": "ok.md"} - * - * *␠Mercury. - * *␠Venus. - * - * 111.␠Earth - * ␠␠␠␠␠and Mars. - * - * *␠**Jupiter**. - * - * ␠␠Jupiter is the fifth planet from the Sun and the largest in the Solar - * ␠␠System. - * - * *␠Saturn. - * - * ␠␠Saturn is the sixth planet from the Sun and the second-largest in the Solar System, after Jupiter. - * - * @example - * {"config": "one", "label": "input", "name": "not-ok.md"} - * - * *␠␠␠Mercury. - * *␠␠␠Venus. - * - * 111.␠␠␠␠Earth - * ␠␠␠␠␠␠␠␠and Mars. - * - * *␠␠␠**Jupiter**. - * - * ␠␠␠␠Jupiter is the fifth planet from the Sun and the largest in the Solar - * ␠␠␠␠System. - * - * *␠␠␠Saturn. - * - * ␠␠␠␠Saturn is the sixth planet from the Sun and the second-largest in the Solar System, after Jupiter. - * @example - * {"config": "one", "label": "output", "name": "not-ok.md"} - * - * 1:5: Unexpected `3` spaces between list item marker and content, expected `1` space, remove `2` spaces - * 2:5: Unexpected `3` spaces between list item marker and content, expected `1` space, remove `2` spaces - * 4:9: Unexpected `4` spaces between list item marker and content, expected `1` space, remove `3` spaces - * 7:5: Unexpected `3` spaces between list item marker and content, expected `1` space, remove `2` spaces - * 12:5: Unexpected `3` spaces between list item marker and content, expected `1` space, remove `2` spaces - * - * @example - * {"config": "tab", "name": "ok.md"} - * - * *␠␠␠Mercury. - * *␠␠␠Venus. - * - * 111.␠␠␠␠Earth - * ␠␠␠␠␠␠␠␠and Mars. - * - * *␠␠␠**Jupiter**. - * - * ␠␠␠␠Jupiter is the fifth planet from the Sun and the largest in the Solar - * ␠␠␠␠System. - * - * *␠␠␠Saturn. - * - * ␠␠␠␠Saturn is the sixth planet from the Sun and the second-largest in the Solar System, after Jupiter. - * - * @example - * {"config": "tab", "label": "input", "name": "not-ok.md"} - * - * *␠Mercury. - * *␠Venus. - * - * 111.␠Earth - * ␠␠␠␠␠and Mars. - * - * *␠**Jupiter**. - * - * ␠␠Jupiter is the fifth planet from the Sun and the largest in the Solar - * ␠␠System. - * - * *␠Saturn. - * - * ␠␠Saturn is the sixth planet from the Sun and the second-largest in the Solar System, after Jupiter. - * @example - * {"config": "tab", "label": "output", "name": "not-ok.md"} - * - * 1:3: Unexpected `1` space between list item marker and content, expected `3` spaces, add `2` spaces - * 2:3: Unexpected `1` space between list item marker and content, expected `3` spaces, add `2` spaces - * 4:6: Unexpected `1` space between list item marker and content, expected `4` spaces, add `3` spaces - * 7:3: Unexpected `1` space between list item marker and content, expected `3` spaces, add `2` spaces - * 12:3: Unexpected `1` space between list item marker and content, expected `3` spaces, add `2` spaces - * - * @example - * {"config": "🌍", "label": "output", "name": "not-ok.md", "positionless": true} - * - * 1:1: Unexpected value `🌍` for `options`, expected `'mixed'`, `'one'`, or `'tab'` - * - * @example - * {"config": "mixed", "gfm": true, "label": "input", "name": "gfm.md"} - * - * *␠[x] Mercury. - * - * 1.␠␠[ ] Venus. - * - * 2.␠␠[ ] Earth. - * - * @example - * {"config": "one", "gfm": true, "name": "gfm.md"} - * - * *␠[x] Mercury. - * - * 1.␠[ ] Venus. - * - * 2.␠[ ] Earth. - * - * @example - * {"config": "tab", "gfm": true, "name": "gfm.md"} - * - * *␠␠␠[x] Mercury. - * - * 1.␠␠[ ] Venus. - * - * 2.␠␠[ ] Earth. - * - * @example - * {"config": "mixed", "name": "loose-tight.md"} - * - * Loose lists have blank lines between items: - * - * *␠␠␠Mercury. - * - * *␠␠␠Venus. - * - * …or between children of items: - * - * 1.␠␠Earth. - * - * ␠␠␠␠Earth is the third planet from the Sun and the only astronomical - * ␠␠␠␠object known to harbor life. - */ -const remarkLintListItemIndent = lintRule$1( - { - origin: 'remark-lint:list-item-indent', - url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-list-item-indent#readme' - }, - function (tree, file, options) { - const value = String(file); - let expected; - if (options === null || options === undefined) { - expected = 'one'; - } else if (options === 'space') { - file.fail( - 'Unexpected value `' + options + "` for `options`, expected `'one'`" - ); - } else if (options === 'tab-size') { - file.fail( - 'Unexpected value `' + options + "` for `options`, expected `'tab'`" - ); - } else if (options === 'mixed' || options === 'one' || options === 'tab') { - expected = options; - } else { - file.fail( - 'Unexpected value `' + - options + - "` for `options`, expected `'mixed'`, `'one'`, or `'tab'`" - ); - } - visitParents(tree, function (node, parents) { - if (phrasing(node)) { - return SKIP - } - if (node.type !== 'list') return - let loose = node.spread; - if (!loose) { - for (const child of node.children) { - if (child.spread) { - loose = true; - break - } - } - } - for (const child of node.children) { - const head = child.children[0]; - const itemStart = pointStart(child); - const headStart = pointStart(head); - if ( - itemStart && - headStart && - typeof itemStart.offset === 'number' && - typeof headStart.offset === 'number' - ) { - let slice = value.slice(itemStart.offset, headStart.offset); - const checkboxIndex = slice.indexOf('['); - if (checkboxIndex !== -1) slice = slice.slice(0, checkboxIndex); - const actualIndent = slice.length; - let end = actualIndent; - let previous = slice.charCodeAt(end - 1); - while (previous === 9 || previous === 32) { - end--; - previous = slice.charCodeAt(end - 1); - } - let expectedIndent = end + 1; - if (expected === 'tab' || (expected === 'mixed' && loose)) { - expectedIndent = Math.ceil(expectedIndent / 4) * 4; - } - const expectedSpaces = expectedIndent - end; - const actualSpaces = actualIndent - end; - if (actualSpaces !== expectedSpaces) { - const difference = expectedSpaces - actualSpaces; - const differenceAbsolute = Math.abs(difference); - file.message( - 'Unexpected `' + - actualSpaces + - '` ' + - pluralize('space', actualSpaces) + - ' between list item marker and content' + - (expected === 'mixed' - ? ' in ' + (loose ? 'loose' : 'tight') + ' list' - : '') + - ', expected `' + - expectedSpaces + - '` ' + - pluralize('space', expectedSpaces) + - ', ' + - (difference > 0 ? 'add' : 'remove') + - ' `' + - differenceAbsolute + - '` ' + - pluralize('space', differenceAbsolute), - {ancestors: [...parents, node, child], place: headStart} - ); - } - } - } - }); - } -); - -/** - * remark-lint rule to warn for lazy lines in block quotes. - * - * ## What is this? - * - * This package checks the style of block quotes. - * - * ## When should I use this? - * - * You can use this package to check that the style of block quotes is - * consistent. - * - * ## API - * - * ### `unified().use(remarkLintNoBlockquoteWithoutMarker)` - * - * Warn for lazy lines in block quotes. - * - * ###### Parameters - * - * There are no options. - * - * ###### Returns - * - * Transform ([`Transformer` from `unified`][github-unified-transformer]). - * - * ## Recommendation - * - * Rules around lazy lines are not straightforward and visually confusing, - * so it’s recommended to start each line with a `>`. - * - * ## Fix - * - * [`remark-stringify`][github-remark-stringify] adds `>` markers to every line - * in a block quote. - * - * [api-remark-lint-no-blockquote-without-marker]: #unifieduseremarklintnoblockquotewithoutmarker - * [github-remark-stringify]: https://github.com/remarkjs/remark/tree/main/packages/remark-stringify - * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer - * - * @module no-blockquote-without-marker - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @example - * {"name": "ok.md"} - * - * > Mercury, - * > Venus, - * > and Earth. - * - * Mars. - * - * @example - * {"name": "ok-tabs.md"} - * - * >␉Mercury, - * >␉Venus, - * >␉and Earth. - * - * @example - * {"label": "input", "name": "not-ok.md"} - * - * > Mercury, - * Venus, - * > and Earth. - * @example - * {"label": "output", "name": "not-ok.md"} - * - * 2:1: Unexpected `0` block quote markers before paragraph line, expected `1` marker, add `1` marker - * - * @example - * {"label": "input", "name": "not-ok-tabs.md"} - * - * >␉Mercury, - * ␉Venus, - * and Earth. - * @example - * {"label": "output", "name": "not-ok-tabs.md"} - * - * 2:2: Unexpected `0` block quote markers before paragraph line, expected `1` marker, add `1` marker - * 3:1: Unexpected `0` block quote markers before paragraph line, expected `1` marker, add `1` marker - * - * @example - * {"label": "input", "name": "containers.md"} - * - * * > Mercury and - * Venus. - * - * > * Mercury and - * Venus. - * - * * > * Mercury and - * Venus. - * - * > * > Mercury and - * Venus. - * - * *** - * - * > * > Mercury and - * > Venus. - * @example - * {"label": "output", "name": "containers.md"} - * - * 2:1: Unexpected `0` block quote markers before paragraph line, expected `1` marker, add `1` marker - * 5:3: Unexpected `0` block quote markers before paragraph line, expected `1` marker, add `1` marker - * 8:5: Unexpected `0` block quote markers before paragraph line, expected `1` marker, add `1` marker - * 11:7: Unexpected `0` block quote markers before paragraph line, expected `2` markers, add `2` markers - * 16:7: Unexpected `1` block quote marker before paragraph line, expected `2` markers, add `1` marker - */ -const remarkLintNoBlockquoteWithoutMarker = lintRule$1( - { - origin: 'remark-lint:no-blockquote-without-marker', - url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-blockquote-without-marker#readme' - }, - function (tree, file) { - const value = String(file); - const loc = location(file); - visitParents(tree, function (node, parents) { - if (phrasing(node)) { - return SKIP - } - if (node.type !== 'paragraph') return - let expected = 0; - for (const parent of parents) { - if (parent.type === 'blockquote') { - expected++; - } - else if ( - parent.type === 'containerDirective' || - parent.type === 'footnoteDefinition' || - parent.type === 'list' || - parent.type === 'listItem' || - parent.type === 'root' - ) ; else { - return SKIP - } - } - if (!expected) return SKIP - const end = pointEnd(node); - const start = pointStart(node); - if (!end || !start) return SKIP - let line = start.line; - while (++line <= end.line) { - const lineStart = loc.toOffset({line, column: 1}); - let actual = 0; - let index = lineStart; - while (index < value.length) { - const code = value.charCodeAt(index); - if (code === 9 || code === 32) ; else if (code === 62 ) { - actual++; - } else { - break - } - index++; - } - const point = loc.toPoint(index); - const difference = expected - actual; - if (difference) { - file.message( - 'Unexpected `' + - actual + - '` block quote ' + - pluralize('marker', actual) + - ' before paragraph line, expected `' + - expected + - '` ' + - pluralize('marker', expected) + - ', add `' + - difference + - '` ' + - pluralize('marker', difference), - {ancestors: [...parents, node], place: point} - ); - } - } - }); - } -); - -/** - * remark-lint rule to warn when identifiers are defined multiple times. - * - * ## What is this? - * - * This package checks that defined identifiers are unique. - * - * ## When should I use this? - * - * You can use this package to check that definitions are useful. - * - * ## API - * - * ### `unified().use(remarkLintNoDuplicateDefinitions)` - * - * Warn when identifiers are defined multiple times. - * - * ###### Parameters - * - * There are no options. - * - * ###### Returns - * - * Transform ([`Transformer` from `unified`][github-unified-transformer]). - * - * ## Recommendation - * - * It’s a mistake when the same identifier is defined multiple times. - * - * [api-remark-lint-no-duplicate-definitions]: #unifieduseremarklintnoduplicatedefinitions - * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer - * - * @module no-duplicate-definitions - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * - * @example - * {"name": "ok.md"} - * - * [mercury]: https://example.com/mercury/ - * [venus]: https://example.com/venus/ - * - * @example - * {"label": "input", "name": "not-ok.md"} - * - * [mercury]: https://example.com/mercury/ - * [mercury]: https://example.com/venus/ - * @example - * {"label": "output", "name": "not-ok.md"} - * - * 2:1-2:38: Unexpected definition with an already defined identifier (`mercury`), expected unique identifiers - * - * @example - * {"gfm": true, "label": "input", "name": "gfm.md"} - * - * Mercury[^mercury]. - * - * [^mercury]: - * Mercury is the first planet from the Sun and the smallest in the Solar - * System. - * - * [^mercury]: - * Venus is the second planet from the Sun. - * - * @example - * {"gfm": true, "label": "output", "name": "gfm.md"} - * - * 7:1-7:12: Unexpected footnote definition with an already defined identifier (`mercury`), expected unique identifiers - */ -const empty = []; -const remarkLintNoDuplicateDefinitions = lintRule$1( - { - origin: 'remark-lint:no-duplicate-definitions', - url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-duplicate-definitions#readme' - }, - function (tree, file) { - const definitions = new Map(); - const footnoteDefinitions = new Map(); - visitParents(tree, function (node, parents) { - if (phrasing(node)) { - return SKIP - } - const [map, identifier] = - node.type === 'definition' - ? [definitions, node.identifier] - : node.type === 'footnoteDefinition' - ? [footnoteDefinitions, node.identifier] - : empty; - if (map && identifier && node.position) { - const ancestors = [...parents, node]; - const duplicateAncestors = map.get(identifier); - if (duplicateAncestors) { - const duplicate = duplicateAncestors.at(-1); - file.message( - 'Unexpected ' + - (node.type === 'footnoteDefinition' ? 'footnote ' : '') + - 'definition with an already defined identifier (`' + - identifier + - '`), expected unique identifiers', - { - ancestors, - cause: new VFileMessage('Identifier already defined here', { - ancestors: duplicateAncestors, - place: duplicate.position, - source: 'remark-lint', - ruleId: 'no-duplicate-definitions' - }), - place: node.position - } - ); - } - map.set(identifier, ancestors); - } - }); - } -); - -/** - * remark-lint rule to warn when extra whitespace is used between hashes and - * content in headings. - * - * ## What is this? - * - * This package checks whitespace between hashes and content. - * - * ## When should I use this? - * - * You can use this package to check that headings are consistent. - * - * ## API - * - * ### `unified().use(remarkLintNoHeadingContentIndent)` - * - * Warn when extra whitespace is used between hashes and content in headings. - * - * ###### Parameters - * - * There are no options. - * - * ###### Returns - * - * Transform ([`Transformer` from `unified`][github-unified-transformer]). - * - * ## Recommendation - * - * One space is required and more than one space has no effect. - * Due to this, it’s recommended to turn this rule on. - * - * ## Fix - * - * [`remark-stringify`][github-remark-stringify] formats headings with one space. - * - * [api-remark-lint-no-heading-content-indent]: #unifieduseremarklintnoheadingcontentindent - * [github-remark-stringify]: https://github.com/remarkjs/remark/tree/main/packages/remark-stringify - * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer - * - * @module no-heading-content-indent - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * - * @example - * {"name": "ok.md"} - * - * #␠Mercury - * - * ##␠Venus␠## - * - * ␠␠##␠Earth - * - * Setext headings are not affected: - * - * ␠Mars - * ===== - * - * ␠Jupiter - * -------- - * - * @example - * {"label": "input", "name": "not-ok.md"} - * - * #␠␠Mercury - * - * ##␠Venus␠␠## - * - * ␠␠##␠␠␠Earth - * @example - * {"label": "output", "name": "not-ok.md"} - * - * 1:4: Unexpected `2` spaces between hashes and content, expected `1` space, remove `1` space - * 3:11: Unexpected `2` spaces between content and hashes, expected `1` space, remove `1` space - * 5:8: Unexpected `3` spaces between hashes and content, expected `1` space, remove `2` spaces - * - * @example - * {"label": "input", "name": "empty-heading.md"} - * - * #␠␠ - * @example - * {"label": "output", "name": "empty-heading.md"} - * - * 1:4: Unexpected `2` spaces between hashes and content, expected `1` space, remove `1` space - */ -const remarkLintNoHeadingContentIndent = lintRule$1( - { - origin: 'remark-lint:no-heading-content-indent', - url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-heading-content-indent#readme' - }, - function (tree, file) { - const value = String(file); - visitParents(tree, function (node, parents) { - if (phrasing(node)) { - return SKIP - } - if (node.type !== 'heading') return - const start = pointStart(node); - const end = pointEnd(node); - if ( - !end || - !start || - typeof end.offset !== 'number' || - typeof start.offset !== 'number' - ) { - return - } - let index = start.offset; - let code = value.charCodeAt(index); - let found = false; - while (value.charCodeAt(index) === 35 ) { - index++; - found = true; - continue - } - const from = index; - code = value.charCodeAt(index); - while (code === 9 || code === 32 ) { - code = value.charCodeAt(++index); - continue - } - const size = index - from; - if (found && size > 1) { - file.message( - 'Unexpected `' + - size + - '` ' + - pluralize('space', size) + - ' between hashes and content, expected `1` space, remove `' + - (size - 1) + - '` ' + - pluralize('space', size - 1), - { - ancestors: [...parents, node], - place: { - line: start.line, - column: start.column + (index - start.offset), - offset: start.offset + (index - start.offset) - } - } - ); - } - const contentStart = index; - index = end.offset; - code = value.charCodeAt(index - 1); - while (code === 9 || code === 32 ) { - index--; - code = value.charCodeAt(index - 1); - continue - } - let endFound = false; - while (value.charCodeAt(index - 1) === 35 ) { - index--; - endFound = true; - continue - } - const endFrom = index; - code = value.charCodeAt(index - 1); - while (code === 9 || code === 32 ) { - index--; - code = value.charCodeAt(index - 1); - continue - } - const endSize = endFrom - index; - if (endFound && index > contentStart && endSize > 1) { - file.message( - 'Unexpected `' + - endSize + - '` ' + - pluralize('space', endSize) + - ' between content and hashes, expected `1` space, remove `' + - (endSize - 1) + - '` ' + - pluralize('space', endSize - 1), - { - ancestors: [...parents, node], - place: { - line: end.line, - column: end.column - (end.offset - endFrom), - offset: end.offset - (end.offset - endFrom) - } - } - ); - } - }); - } -); - -/** - * remark-lint rule to warn when GFM autolink literals are used. - * - * ## What is this? - * - * This package checks that regular autolinks or full links are used. - * Literal autolinks is a GFM feature enabled with - * [`remark-gfm`][github-remark-gfm]. - * - * ## When should I use this? - * - * You can use this package to check that links are consistent. - * - * ## API - * - * ### `unified().use(remarkLintNoLiteralUrls)` - * - * Warn when GFM autolink literals are used. - * - * ###### Parameters - * - * There are no options. - * - * ###### Returns - * - * Transform ([`Transformer` from `unified`][github-unified-transformer]). - * - * ## Recommendation - * - * GFM autolink literals (just a raw URL) are a feature enabled by GFM. - * They don’t work everywhere. - * So, - * it’s recommended to instead use regular autolinks (``) or full - * links (`[text](url)`). - * - * ## Fix - * - * [`remark-stringify`][github-remark-stringify] never generates GFM autolink - * literals. - * It always generates regular autolinks or full links. - * - * [api-remark-lint-no-literal-urls]: #unifieduseremarklintnoliteralurls - * [github-remark-gfm]: https://github.com/remarkjs/remark-gfm - * [github-remark-stringify]: https://github.com/remarkjs/remark/tree/main/packages/remark-stringify - * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer - * - * @module no-literal-urls - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * - * @example - * {"name": "ok.md", "gfm": true} - * - * - * - * ![Venus](http://example.com/venus/). - * - * @example - * {"name": "not-ok.md", "label": "input", "gfm": true} - * - * https://example.com/mercury/ - * - * www.example.com/venus/ - * - * earth@mars.planets - * - * @example - * {"name": "not-ok.md", "label": "output", "gfm": true} - * - * 1:1-1:29: Unexpected GFM autolink literal, expected regular autolink, add `<` before and `>` after - * 3:1-3:23: Unexpected GFM autolink literal, expected regular autolink, add `` after - * 5:1-5:19: Unexpected GFM autolink literal, expected regular autolink, add `` after - */ -const defaultHttp = 'http://'; -const defaultMailto = 'mailto:'; -const remarkLintNoLiteralUrls = lintRule$1( - { - origin: 'remark-lint:no-literal-urls', - url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-literal-urls#readme' - }, - function (tree, file) { - const value = String(file); - visitParents(tree, 'link', function (node, parents) { - const start = pointStart(node); - if (!start || typeof start.offset !== 'number') return - const raw = toString(node); - let protocol; - let otherwiseFine = false; - if (raw === node.url) { - otherwiseFine = true; - } else if (defaultHttp + raw === node.url) { - protocol = defaultHttp; - } else if (defaultMailto + raw === node.url) { - protocol = defaultMailto; - } - if ( - (protocol || otherwiseFine) && - !asciiPunctuation(value.charCodeAt(start.offset)) - ) { - file.message( - 'Unexpected GFM autolink literal, expected regular autolink, add ' + - (protocol ? '`<' + protocol + '`' : '`<`') + - ' before and `>` after', - {ancestors: [...parents, node], place: node.position} - ); - } - }); - } -); - -/** - * remark-lint rule to warn when shortcut reference images are used. - * - * ## What is this? - * - * This package checks that collapsed or full reference images are used. - * - * ## When should I use this? - * - * You can use this package to check that references are consistent. - * - * ## API - * - * ### `unified().use(remarkLintNoShortcutReferenceImage)` - * - * Warn when shortcut reference images are used. - * - * ###### Parameters - * - * There are no options. - * - * ###### Returns - * - * Transform ([`Transformer` from `unified`][github-unified-transformer]). - * - * ## Recommendation - * - * Shortcut references use an implicit style that looks a lot like something - * that could occur as plain text instead of syntax. - * In some cases, - * plain text is intended instead of an image. - * So it’s recommended to use collapsed or full references instead. - * - * [api-remark-lint-no-shortcut-reference-image]: #unifieduseremarklintnoshortcutreferenceimage - * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer - * - * @module no-shortcut-reference-image - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * - * @example - * {"name": "ok.md"} - * - * ![Mercury][] - * - * [mercury]: /mercury.png - * - * @example - * {"label": "input", "name": "not-ok.md"} - * - * ![Mercury] - * - * [mercury]: /mercury.png - * @example - * {"label": "output", "name": "not-ok.md"} - * - * 1:1-1:11: Unexpected shortcut reference image (`![text]`), expected collapsed reference (`![text][]`) - */ -const remarkLintNoShortcutReferenceImage = lintRule$1( - { - origin: 'remark-lint:no-shortcut-reference-image', - url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-shortcut-reference-image#readme' - }, - function (tree, file) { - visitParents(tree, 'imageReference', function (node, parents) { - if (node.position && node.referenceType === 'shortcut') { - file.message( - 'Unexpected shortcut reference image (`![text]`), expected collapsed reference (`![text][]`)', - {ancestors: [...parents, node], place: node.position} - ); - } - }); - } -); - -/** - * remark-lint rule to warn when shortcut reference links are used. - * - * ## What is this? - * - * This package checks that collapsed or full reference links are used. - * - * ## When should I use this? - * - * You can use this package to check that references are consistent. - * - * ## API - * - * ### `unified().use(remarkLintNoShortcutReferenceLink)` - * - * Warn when shortcut reference links are used. - * - * ###### Parameters - * - * There are no options. - * - * ###### Returns - * - * Transform ([`Transformer` from `unified`][github-unified-transformer]). - * - * ## Recommendation - * - * Shortcut references use an implicit style that looks a lot like something - * that could occur as plain text instead of syntax. - * In some cases, - * plain text is intended instead of a link. - * So it’s recommended to use collapsed or full references instead. - * - * [api-remark-lint-no-shortcut-reference-link]: #unifieduseremarklintnoshortcutreferencelink - * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer - * - * @module no-shortcut-reference-link - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * - * @example - * {"name": "ok.md"} - * - * [Mercury][] - * - * [mercury]: http://example.com/mercury/ - * - * @example - * {"label": "input", "name": "not-ok.md"} - * - * [Mercury] - * - * [mercury]: http://example.com/mercury/ - * @example - * {"label": "output", "name": "not-ok.md"} - * - * 1:1-1:10: Unexpected shortcut reference link (`[text]`), expected collapsed reference (`[text][]`) - */ -const remarkLintNoShortcutReferenceLink = lintRule$1( - { - origin: 'remark-lint:no-shortcut-reference-link', - url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-shortcut-reference-link#readme' - }, - function (tree, file) { - visitParents(tree, 'linkReference', function (node, parents) { - if (node.position && node.referenceType === 'shortcut') { - file.message( - 'Unexpected shortcut reference link (`[text]`), expected collapsed reference (`[text][]`)', - {ancestors: [...parents, node], place: node.position} - ); - } - }); - } -); - -const js = /\s+/g; -const html = /[\t\n\v\f\r ]+/g; -function collapseWhiteSpace(value, options) { - if (!options) { - options = {}; - } else if (typeof options === 'string') { - options = {style: options}; - } - const replace = options.preserveLineEndings ? replaceLineEnding : replaceSpace; - return String(value).replace( - options.style === 'html' ? html : js, - options.trim ? trimFactory(replace) : replace - ) -} -function replaceLineEnding(value) { - const match = /\r?\n|\r/.exec(value); - return match ? match[0] : ' ' -} -function replaceSpace() { - return ' ' -} -function trimFactory(replace) { - return dropOrReplace - function dropOrReplace(value, index, all) { - return index === 0 || index + value.length === all.length - ? '' - : replace(value) - } -} - -/** - * remark-lint rule to warn when undefined definitions are referenced. - * - * ## What is this? - * - * This package checks that referenced definitions are defined. - * - * ## When should I use this? - * - * You can use this package to check for broken references. - * - * ## API - * - * ### `unified().use(remarkLintNoUndefinedReferences[, options])` - * - * Warn when undefined definitions are referenced. - * - * ###### Parameters - * - * * `options` ([`Options`][api-options], optional) - * — configuration - * - * ###### Returns - * - * Transform ([`Transformer` from `unified`][github-unified-transformer]). - * - * ### `Options` - * - * Configuration (TypeScript type). - * - * ###### Fields - * - * * `allow` (`Array`, optional) - * — list of values to allow between `[` and `]` - * * `allowShortcutLink` (`boolean`, default: `false`) - * — allow shortcut references, which are just brackets such as `[text]` - * - * ## Recommendation - * - * Shortcut references use an implicit syntax that could also occur as plain - * text. - * To illustrate, - * it is reasonable to expect an author adding `[…]` to abbreviate some text - * somewhere in a document: - * - * ```markdown - * > Some […] quote. - * ``` - * - * This isn’t a problem, - * but it might become one when an author later adds a definition: - * - * ```markdown - * Some new text […][]. - * - * […]: #read-more - * ``` - * - * The second author might expect only their newly added text to form a link, - * but their changes also result in a link for the text by the first author. - * - * [api-options]: #options - * [api-remark-lint-no-undefined-references]: #unifieduseremarklintnoundefinedreferences-options - * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer - * - * @module no-undefined-references - * @author Titus Wormer - * @copyright 2016 Titus Wormer - * @license MIT - * - * @example - * {"name": "ok.md"} - * - * [Mercury][] is the first planet from the Sun and the smallest in the Solar - * System. - * - * Venus is the second planet from the [Sun. - * - * Earth is the third planet from the \[Sun] and the only astronomical object - * known to harbor life\. - * - * Mars is the fourth planet from the Sun: []. - * - * [mercury]: https://example.com/mercury/ - * - * @example - * {"label": "input", "name": "not-ok.md"} - * - * [Mercury] is the first planet from the Sun and the smallest in the Solar - * System. - * - * [Venus][] is the second planet from the Sun. - * - * [Earth][earth] is the third planet from the Sun and the only astronomical - * object known to harbor life. - * - * ![Mars] is the fourth planet from the Sun in the [Solar - * System]. - * - * > Jupiter is the fifth planet from the Sun and the largest in the [Solar - * > System][]. - * - * [Saturn][ is the sixth planet from the Sun and the second-largest - * in the Solar System, after Jupiter. - * - * [*Uranus*][] is the seventh planet from the Sun. - * - * [Neptune][neptune][more] is the eighth and farthest planet from the Sun. - * @example - * {"label": "output", "name": "not-ok.md"} - * - * 1:1-1:10: Unexpected reference to undefined definition, expected corresponding definition (`mercury`) for a link or escaped opening bracket (`\[`) for regular text - * 4:1-4:10: Unexpected reference to undefined definition, expected corresponding definition (`venus`) for a link or escaped opening bracket (`\[`) for regular text - * 6:1-6:15: Unexpected reference to undefined definition, expected corresponding definition (`earth`) for a link or escaped opening bracket (`\[`) for regular text - * 9:2-9:8: Unexpected reference to undefined definition, expected corresponding definition (`mars`) for an image or escaped opening bracket (`\[`) for regular text - * 9:50-10:8: Unexpected reference to undefined definition, expected corresponding definition (`solar system`) for a link or escaped opening bracket (`\[`) for regular text - * 12:67-13:12: Unexpected reference to undefined definition, expected corresponding definition (`solar > system`) for a link or escaped opening bracket (`\[`) for regular text - * 15:1-15:9: Unexpected reference to undefined definition, expected corresponding definition (`saturn`) for a link or escaped opening bracket (`\[`) for regular text - * 18:1-18:13: Unexpected reference to undefined definition, expected corresponding definition (`*uranus*`) for a link or escaped opening bracket (`\[`) for regular text - * 20:1-20:19: Unexpected reference to undefined definition, expected corresponding definition (`neptune`) for a link or escaped opening bracket (`\[`) for regular text - * 20:19-20:25: Unexpected reference to undefined definition, expected corresponding definition (`more`) for a link or escaped opening bracket (`\[`) for regular text - * - * @example - * {"config": {"allow": ["…"]}, "name": "ok-allow.md"} - * - * Mercury is the first planet from the Sun and the smallest in the Solar - * System. […] - * - * @example - * {"config": {"allow": [{"source": "^mer"}, "venus"]}, "name": "source.md"} - * - * [Mercury][] is the first planet from the Sun and the smallest in the Solar - * System. - * - * [Venus][] is the second planet from the Sun. - * - * @example - * {"gfm": true, "label": "input", "name": "gfm.md"} - * - * Mercury[^mercury] is the first planet from the Sun and the smallest in the - * Solar System. - * - * [^venus]: - * **Venus** is the second planet from the Sun. - * @example - * {"gfm": true, "label": "output", "name": "gfm.md"} - * - * 1:8-1:18: Unexpected reference to undefined definition, expected corresponding definition (`mercury`) for a footnote or escaped opening bracket (`\[`) for regular text - * - * @example - * {"config": {"allowShortcutLink": true}, "label": "input", "name": "allow-shortcut-link.md"} - * - * [Mercury] is the first planet from the Sun and the smallest in the Solar - * System. - * - * [Venus][] is the second planet from the Sun. - * - * [Earth][earth] is the third planet from the Sun and the only astronomical object - * known to harbor life. - * @example - * {"config": {"allowShortcutLink": true}, "label": "output", "name": "allow-shortcut-link.md"} - * - * 4:1-4:10: Unexpected reference to undefined definition, expected corresponding definition (`venus`) for a link or escaped opening bracket (`\[`) for regular text - * 6:1-6:15: Unexpected reference to undefined definition, expected corresponding definition (`earth`) for a link or escaped opening bracket (`\[`) for regular text - */ -const emptyOptions = {}; -const emptyAllow = []; -const lineEndingExpression = /(\r?\n|\r)[\t ]*(>[\t ]*)*/g; -const remarkLintNoUndefinedReferences = lintRule$1( - { - origin: 'remark-lint:no-undefined-references', - url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-undefined-references#readme' - }, - function (tree, file, options) { - const settings = options || emptyOptions; - const allow = settings.allow || emptyAllow; - const allowShortcutLink = settings.allowShortcutLink || false; - const value = String(file); - const toPoint = location(file).toPoint; - const definitionIdentifiers = new Set(); - const footnoteDefinitionIdentifiers = new Set(); - const regexes = []; - const strings = new Set(); - const phrasingStacks = []; - let index = -1; - while (++index < allow.length) { - const value = allow[index]; - if (typeof value === 'string') { - strings.add(normalizeIdentifier(value)); - } else if (typeof value === 'object' && 'source' in value) { - regexes.push(new RegExp(value.source, value.flags ?? 'i')); - } - } - visitParents(tree, function (node, parents) { - if (node.type === 'definition') { - definitionIdentifiers.add(normalizeIdentifier(node.identifier)); - } - if (node.type === 'footnoteDefinition') { - footnoteDefinitionIdentifiers.add(normalizeIdentifier(node.identifier)); - } - if (node.type === 'heading' || node.type === 'paragraph') { - phrasingStacks.push([...parents, node]); - } - }); - for (const ancestors of phrasingStacks) { - findInPhrasingContainer(ancestors); - } - function findInPhrasingContainer(ancestors) { - const bracketRanges = []; - const node = ancestors.at(-1); - for (const child of node.children) { - if (child.type === 'text') { - findRangesInText(bracketRanges, [...ancestors, child]); - } else if ('children' in child) { - findInPhrasingContainer([...ancestors, child]); - } - } - for (const range of bracketRanges) { - handleRange(range); - } - } - function findRangesInText(ranges, ancestors) { - const node = ancestors.at(-1); - const end = pointEnd(node); - const start = pointStart(node); - if ( - !end || - !start || - typeof start.offset !== 'number' || - typeof end.offset !== 'number' - ) { - return - } - const source = value.slice(start.offset, end.offset); - const lines = [[start.offset, '']]; - let last = 0; - lineEndingExpression.lastIndex = 0; - let match = lineEndingExpression.exec(source); - while (match) { - const index = match.index; - const lineTuple = lines.at(-1); - lineTuple[1] = source.slice(last, index); - last = index + match[0].length; - lines.push([start.offset + last, '']); - match = lineEndingExpression.exec(source); - } - const lineTuple = lines.at(-1); - lineTuple[1] = source.slice(last); - for (const lineTuple of lines) { - const [lineStart, line] = lineTuple; - let index = 0; - while (index < line.length) { - const code = line.charCodeAt(index); - if (code === 91 ) { - ranges.push([ancestors, [lineStart + index]]); - index++; - } - else if (code === 92 ) { - const next = line.charCodeAt(index + 1); - index++; - if (next === 91 || next === 93 ) { - index++; - } - } - else if (code === 93 ) { - const bracketInfo = ranges.at(-1); - if (!bracketInfo) { - index++; - } - else if ( - line.charCodeAt(index + 1) === 91 && - bracketInfo[1].length !== 3 - ) { - index++; - bracketInfo[1].push(lineStart + index, lineStart + index); - index++; - } - else { - index++; - bracketInfo[1].push(lineStart + index); - handleRange(bracketInfo); - ranges.pop(); - } - } - else { - index++; - } - } - } - } - function handleRange(bracketRange) { - const [ancestors, range] = bracketRange; - if (range.length === 1) return - if (range.length === 3) range.length = 2; - if (range.length === 2 && range[0] + 2 === range[1]) return - const label = - value.charCodeAt(range[0] - 1) === 33 - ? 'image' - : value.charCodeAt(range[0] + 1) === 94 - ? 'footnote' - : 'link'; - const offset = range.length === 4 && range[2] + 2 !== range[3] ? 2 : 0; - let id = normalizeIdentifier( - collapseWhiteSpace( - value.slice(range[0 + offset] + 1, range[1 + offset] - 1), - {style: 'html', trim: true} - ) - ); - let defined = definitionIdentifiers; - if (label === 'footnote') { - if (id.includes(' ')) return - defined = footnoteDefinitionIdentifiers; - id = id.slice(1); - } - if ( - (allowShortcutLink && range.length === 2) || - defined.has(id) || - strings.has(id) || - regexes.some(function (regex) { - return regex.test(id) - }) - ) { - return - } - const start = toPoint(range[0]); - const end = toPoint(range[range.length - 1]); - if (end && start) { - file.message( - 'Unexpected reference to undefined definition, expected corresponding definition (`' + - id.toLowerCase() + - '`) for ' + - (label === 'image' ? 'an' : 'a') + - ' ' + - label + - ' or escaped opening bracket (`\\[`) for regular text', - { - ancestors, - place: {start, end} - } - ); - } - } - } -); - -/** - * remark-lint rule to warn when unreferenced definitions are used. - * - * ## What is this? - * - * This package checks that definitions are referenced. - * - * ## When should I use this? - * - * You can use this package to check definitions. - * - * ## API - * - * ### `unified().use(remarkLintNoUnusedDefinitions)` - * - * Warn when unreferenced definitions are used. - * - * ###### Parameters - * - * There are no options. - * - * ###### Returns - * - * Transform ([`Transformer` from `unified`][github-unified-transformer]). - * - * ## Recommendation - * - * Unused definitions do not contribute anything, so they can be removed. - * - * [api-remark-lint-no-unused-definitions]: #unifieduseremarklintnounuseddefinitions - * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer - * - * @module no-unused-definitions - * @author Titus Wormer - * @copyright 2016 Titus Wormer - * @license MIT - * @example - * {"name": "ok.md"} - * - * [Mercury][] - * - * [mercury]: https://example.com/mercury/ - * - * @example - * {"label": "input", "name": "not-ok.md"} - * - * [mercury]: https://example.com/mercury/ - * - * @example - * {"label": "output", "name": "not-ok.md"} - * - * 1:1-1:40: Unexpected unused definition, expected no definition or one or more references to `mercury` - * - * @example - * {"gfm": true, "label": "input", "name": "gfm.md"} - * - * Mercury[^mercury] is a planet. - * - * [^Mercury]: - * **Mercury** is the first planet from the Sun and the smallest - * in the Solar System. - * [^Venus]: - * **Venus** is the second planet from - * the Sun. - * @example - * {"gfm": true, "label": "output", "name": "gfm.md"} - * - * 6:1-8:13: Unexpected unused footnote definition, expected no definition or one or more footnote references to `venus` - */ -const remarkLintNoUnusedDefinitions = lintRule$1( - { - origin: 'remark-lint:no-unused-definitions', - url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-unused-definitions#readme' - }, - function (tree, file) { - const footnoteDefinitions = new Map(); - const definitions = new Map(); - visitParents(tree, function (node, parents) { - if ('identifier' in node) { - const map = - node.type === 'footnoteDefinition' || - node.type === 'footnoteReference' - ? footnoteDefinitions - : definitions; - let entry = map.get(node.identifier); - if (!entry) { - entry = {ancestors: undefined, used: false}; - map.set(node.identifier, entry); - } - if (node.type === 'definition' || node.type === 'footnoteDefinition') { - entry.ancestors = [...parents, node]; - } else if ( - node.type === 'imageReference' || - node.type === 'linkReference' || - node.type === 'footnoteReference' - ) { - entry.used = true; - } - } - }); - const entries = [...footnoteDefinitions.values(), ...definitions.values()]; - for (const entry of entries) { - if (!entry.used) { - ok$1(entry.ancestors); - const node = entry.ancestors.at(-1); - ok$1(node.type === 'footnoteDefinition' || node.type === 'definition'); - if (node.position) { - const prefix = node.type === 'footnoteDefinition' ? 'footnote ' : ''; - file.message( - 'Unexpected unused ' + - prefix + - 'definition, expected no definition or one or more ' + - prefix + - 'references to `' + - node.identifier + - '`', - {ancestors: entry.ancestors, place: node.position} - ); - } - } - } - } -); - -/** - * remark-lint rule to warn when ordered list markers are inconsistent. - * - * ## What is this? - * - * This package checks ordered list markers. - * - * ## When should I use this? - * - * You can use this package to check ordered lists. - * - * ## API - * - * ### `unified().use(remarkLintOrderedListMarkerStyle[, options])` - * - * Warn when ordered list markers are inconsistent. - * - * ###### Parameters - * - * * `options` ([`Options`][api-options], default: `'consistent'`) - * — preferred style or whether to detect the first style and warn for - * further differences - * - * ###### Returns - * - * Transform ([`Transformer` from `unified`][github-unified-transformer]). - * - * ### `Options` - * - * Configuration (TypeScript type). - * - * ###### Type - * - * ```ts - * type Options = Style | 'consistent' - * ``` - * - * ### `Style` - * - * Style (TypeScript type). - * - * ###### Type - * - * ```ts - * type Style = '.' | ')' - * ``` - * - * ## Recommendation - * - * Parens for list markers were not supported in markdown before CommonMark. - * While they should work in most places now, - * not all markdown parsers follow CommonMark. - * So it’s recommended to prefer dots. - * - * ## Fix - * - * [`remark-stringify`][github-remark-stringify] formats ordered lists with - * dots by default. - * Pass `bulletOrdered: ')'` to always use parens. - * - * [api-style]: #style - * [api-options]: #options - * [api-remark-lint-ordered-list-marker-style]: #unifieduseremarklintorderedlistmarkerstyle-options - * [github-remark-stringify]: https://github.com/remarkjs/remark/tree/main/packages/remark-stringify - * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer - * - * @module ordered-list-marker-style - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * - * @example - * {"name": "ok.md"} - * - * 1. Mercury - * - * * Venus - * - * 1. Earth - * - * @example - * {"name": "ok.md", "config": "."} - * - * 1. Mercury - * - * @example - * {"name": "ok.md", "config": ")"} - * - * 1) Mercury - * - * @example - * {"label": "input", "name": "not-ok.md"} - * - * 1. Mercury - * - * 1) Venus - * - * @example - * {"label": "output", "name": "not-ok.md"} - * - * 3:2: Unexpected ordered list marker `)`, expected `.` - * - * @example - * {"name": "not-ok.md", "label": "output", "config": "🌍", "positionless": true} - * - * 1:1: Unexpected value `🌍` for `options`, expected `'.'`, `')'`, or `'consistent'` - */ -const remarkLintOrderedListMarkerStyle = lintRule$1( - { - origin: 'remark-lint:ordered-list-marker-style', - url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-ordered-list-marker-style#readme' - }, - function (tree, file, options) { - const value = String(file); - let expected; - let cause; - if (options === null || options === undefined || options === 'consistent') ; else if (options === '.' || options === ')') { - expected = options; - } else { - file.fail( - 'Unexpected value `' + - options + - "` for `options`, expected `'.'`, `')'`, or `'consistent'`" - ); - } - visitParents(tree, function (node, parents) { - if (phrasing(node)) { - return SKIP - } - if (node.type !== 'listItem') return - const parent = parents.at(-1); - if (!parent || parent.type !== 'list' || !parent.ordered) return - const start = pointStart(node); - if (start && typeof start.offset === 'number') { - let index = start.offset; - let code = value.charCodeAt(index); - while (asciiDigit(code)) { - index++; - code = value.charCodeAt(index); - } - const actual = - code === 41 ? ')' : code === 46 ? '.' : undefined; - if (!actual) return - const place = { - line: start.line, - column: start.column + (index - start.offset), - offset: start.offset + (index - start.offset) - }; - if (expected) { - if (actual !== expected) { - file.message( - 'Unexpected ordered list marker `' + - actual + - '`, expected `' + - expected + - '`', - {ancestors: [...parents, node], cause, place} - ); - } - } else { - expected = actual; - cause = new VFileMessage( - 'Ordered list marker style `' + - expected + - "` first defined for `'consistent'` here", - { - ancestors: [...parents, node], - place, - ruleId: 'ordered-list-marker-style', - source: 'remark-lint' - } - ); - } - } - }); - } -); - -const remarkPresetLintRecommended = { - plugins: [ - remarkLint, - remarkLintFinalNewline, - remarkLintListItemBulletIndent, - [remarkLintListItemIndent, 'one'], - remarkLintNoBlockquoteWithoutMarker, - remarkLintNoLiteralUrls, - [remarkLintOrderedListMarkerStyle, '.'], - remarkLintHardBreakSpaces, - remarkLintNoDuplicateDefinitions, - remarkLintNoHeadingContentIndent, - remarkLintNoShortcutReferenceImage, - remarkLintNoShortcutReferenceLink, - remarkLintNoUndefinedReferences, - remarkLintNoUnusedDefinitions - ] -}; - -/** - * remark-lint rule to warn when block quotes are indented too much or - * too little. - * - * ## What is this? - * - * This package checks the “indent” of block quotes: the `>` (greater than) - * marker *and* the spaces before content. - * - * ## When should I use this? - * - * You can use this rule to check markdown code style. - * - * ## API - * - * ### `unified().use(remarkLintBlockquoteIndentation[, options])` - * - * Warn when block quotes are indented too much or too little. - * - * ###### Parameters - * - * * `options` ([`Options`][api-options], default: `'consistent'`) - * — either a preferred indent or whether to detect the first style - * and warn for further differences - * - * ###### Returns - * - * Transform ([`Transformer` from `unified`][github-unified-transformer]). - * - * ### `Options` - * - * Configuration (TypeScript type). - * - * ###### Type - * - * ```ts - * type Options = number | 'consistent' - * ``` - * - * ## Recommendation - * - * CommonMark specifies that when block quotes are used the `>` markers can be - * followed by an optional space. - * No space at all arguably looks rather ugly: - * - * ```markdown - * >Mars and - * >Venus. - * ``` - * - * There is no specific handling of more that one space, so if 5 spaces were - * used after `>`, then indented code kicks in: - * - * ```markdown - * > neptune() - * ``` - * - * Due to this, it’s recommended to configure this rule with `2`. - * - * [api-options]: #options - * [api-remark-lint-blockquote-indentation]: #unifieduseremarklintblockquoteindentation-options - * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer - * - * @module blockquote-indentation - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * - * @example - * {"config": 2, "name": "ok-2.md"} - * - * > Mercury. - * - * Venus. - * - * > Earth. - * - * @example - * {"config": 4, "name": "ok-4.md"} - * - * > Mercury. - * - * Venus. - * - * > Earth. - * - * @example - * { "name": "ok-tab.md"} - * - * >␉Mercury. - * - * @example - * {"label": "input", "name": "not-ok.md"} - * - * > Mercury. - * - * Venus. - * - * > Earth. - * - * Mars. - * - * > Jupiter - * @example - * {"label": "output", "name": "not-ok.md"} - * - * 5:5: Unexpected `4` spaces between block quote marker and content, expected `3` spaces, remove `1` space - * 9:3: Unexpected `2` spaces between block quote marker and content, expected `3` spaces, add `1` space - * - * @example - * {"config": "🌍", "label": "output", "name": "not-ok-options.md", "positionless": true} - * - * 1:1: Unexpected value `🌍` for `options`, expected `number` or `'consistent'` - */ -const remarkLintBlockquoteIndentation = lintRule$1( - { - origin: 'remark-lint:blockquote-indentation', - url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-blockquote-indentation#readme' - }, - function (tree, file, options) { - let expected; - if (options === null || options === undefined || options === 'consistent') ; else if (typeof options === 'number') { - expected = options; - } else { - file.fail( - 'Unexpected value `' + - options + - "` for `options`, expected `number` or `'consistent'`" - ); - } - visitParents(tree, function (node, parents) { - if (phrasing(node)) { - return SKIP - } - if (node.type !== 'blockquote') return - const start = pointStart(node); - const headStart = pointStart(node.children[0]); - if (headStart && start) { - const actual = headStart.column - start.column; - if (expected) { - const difference = expected - actual; - const differenceAbsolute = Math.abs(difference); - if (difference !== 0) { - file.message( - 'Unexpected `' + - actual + - '` ' + - pluralize('space', actual) + - ' between block quote marker and content, expected `' + - expected + - '` ' + - pluralize('space', expected) + - ', ' + - (difference > 0 ? 'add' : 'remove') + - ' `' + - differenceAbsolute + - '` ' + - pluralize('space', differenceAbsolute), - {ancestors: [...parents, node], place: headStart} - ); - } - } else { - expected = actual; - } - } - }); - } -); - -/** - * remark-lint rule to warn when list item checkboxes violate a given - * style. - * - * ## What is this? - * - * This package checks the character used in checkboxes. - * - * ## When should I use this? - * - * You can use this package to check that the style of GFM tasklists is - * consistent. - * Task lists are a GFM feature enabled with - * [`remark-gfm`][github-remark-gfm]. - * - * ## API - * - * ### `unified().use(remarkLintCheckboxCharacterStyle[, options])` - * - * Warn when list item checkboxes violate a given style. - * - * ###### Parameters - * - * * `options` ([`Options`][api-options], default: `'consistent'`) - * — either preferred values or whether to detect the first styles - * and warn for further differences - * - * ###### Returns - * - * Transform ([`Transformer` from `unified`][github-unified-transformer]). - * - * ### `Options` - * - * Configuration (TypeScript type). - * - * ###### Type - * - * ```ts - * type Options = Styles | 'consistent' - * ``` - * - * ### `Styles` - * - * Styles (TypeScript type). - * - * ###### Fields - * - * * `checked` (`'X'`, `'x'`, or `'consistent'`, default: `'consistent'`) - * — preferred style to use for checked checkboxes - * * `unchecked` (`'␉'` (a tab), `'␠'` (a space), or `'consistent'`, default: - * `'consistent'`) - * — preferred style to use for unchecked checkboxes - * - * ## Recommendation - * - * It’s recommended to set `options.checked` to `'x'` (a lowercase X) as it - * prevents an extra keyboard press and `options.unchecked` to `'␠'` (a space) - * to make all checkboxes align. - * - * ## Fix - * - * [`remark-stringify`][github-remark-stringify] formats checked checkboxes - * using `'x'` (lowercase X) and unchecked checkboxes using `'␠'` (a space). - * - * [api-options]: #options - * [api-remark-lint-checkbox-character-style]: #unifieduseremarklintcheckboxcharacterstyle-options - * [api-styles]: #styles - * [github-remark-gfm]: https://github.com/remarkjs/remark-gfm - * [github-remark-stringify]: https://github.com/remarkjs/remark/tree/main/packages/remark-stringify - * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer - * - * @module checkbox-character-style - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * - * @example - * {"config": {"checked": "x"}, "gfm": true, "name": "ok-x.md"} - * - * - [x] Mercury. - * - [x] Venus. - * - * @example - * {"config": {"checked": "X"}, "gfm": true, "name": "ok-x-upper.md"} - * - * - [X] Mercury. - * - [X] Venus. - * - * @example - * {"config": {"unchecked": " "}, "gfm": true, "name": "ok-space.md"} - * - * - [ ] Mercury. - * - [ ] Venus. - * - [ ]␠␠ - * - [ ] - * - * @example - * {"config": {"unchecked": "\t"}, "gfm": true, "name": "ok-tab.md"} - * - * - [␉] Mercury. - * - [␉] Venus. - * - * @example - * {"label": "input", "gfm": true, "name": "not-ok-default.md"} - * - * - [x] Mercury. - * - [X] Venus. - * - [ ] Earth. - * - [␉] Mars. - * @example - * {"label": "output", "gfm": true, "name": "not-ok-default.md"} - * - * 2:5: Unexpected checked checkbox value `X`, expected `x` - * 4:5: Unexpected unchecked checkbox value `\t`, expected ` ` - * - * @example - * {"config": "🌍", "label": "output", "name": "not-ok-option.md", "positionless": true} - * - * 1:1: Unexpected value `🌍` for `options`, expected an object or `'consistent'` - * - * @example - * {"config": {"unchecked": "🌍"}, "label": "output", "name": "not-ok-option-unchecked.md", "positionless": true} - * - * 1:1: Unexpected value `🌍` for `options.unchecked`, expected `'\t'`, `' '`, or `'consistent'` - * - * @example - * {"config": {"checked": "🌍"}, "label": "output", "name": "not-ok-option-checked.md", "positionless": true} - * - * 1:1: Unexpected value `🌍` for `options.checked`, expected `'X'`, `'x'`, or `'consistent'` - */ -const remarkLintCheckboxCharacterStyle = lintRule$1( - { - origin: 'remark-lint:checkbox-character-style', - url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-checkbox-character-style#readme' - }, - function (tree, file, options) { - const value = String(file); - let checkedExpected; - let checkedConsistentCause; - let uncheckedExpected; - let uncheckedConsistentCause; - if (options === null || options === undefined || options === 'consistent') ; else if (typeof options === 'object') { - if (options.checked === 'X' || options.checked === 'x') { - checkedExpected = options.checked; - } else if (options.checked && options.checked !== 'consistent') { - file.fail( - 'Unexpected value `' + - options.checked + - "` for `options.checked`, expected `'X'`, `'x'`, or `'consistent'`" - ); - } - if (options.unchecked === '\t' || options.unchecked === ' ') { - uncheckedExpected = options.unchecked; - } else if (options.unchecked && options.unchecked !== 'consistent') { - file.fail( - 'Unexpected value `' + - options.unchecked + - "` for `options.unchecked`, expected `'\\t'`, `' '`, or `'consistent'`" - ); - } - } else { - file.fail( - 'Unexpected value `' + - options + - "` for `options`, expected an object or `'consistent'`" - ); - } - visitParents(tree, function (node, parents) { - if (phrasing(node)) { - return SKIP - } - if (node.type !== 'listItem') return - const head = node.children[0]; - const headStart = pointStart(head); - if ( - !head || - !headStart || - typeof node.checked !== 'boolean' || - typeof headStart.offset !== 'number' - ) { - return - } - headStart.offset -= 2; - headStart.column -= 2; - const match = /\[([\t Xx])]/.exec( - value.slice(headStart.offset - 2, headStart.offset + 1) - ); - if (!match) return - const actual = match[1]; - const actualDisplay = actual === '\t' ? '\\t' : actual; - const expected = node.checked ? checkedExpected : uncheckedExpected; - const expectedDisplay = expected === '\t' ? '\\t' : expected; - if (!expected) { - const cause = new VFileMessage( - (node.checked ? 'C' : 'Unc') + - "hecked checkbox style `'" + - actualDisplay + - "'` first defined for `'consistent'` here", - { - ancestors: [...parents, node], - place: headStart, - ruleId: 'checkbox-character-style', - source: 'remark-lint' - } - ); - if (node.checked) { - checkedExpected = (actual); - checkedConsistentCause = cause; - } else { - uncheckedExpected = (actual); - uncheckedConsistentCause = cause; - } - } else if (actual !== expected) { - file.message( - 'Unexpected ' + - (node.checked ? '' : 'un') + - 'checked checkbox value `' + - actualDisplay + - '`, expected `' + - expectedDisplay + - '`', - { - ancestors: [...parents, node], - cause: node.checked - ? checkedConsistentCause - : uncheckedConsistentCause, - place: headStart - } - ); - } - }); - } -); - -/** - * remark-lint rule to warn when GFM tasklist checkboxes are followed by - * more than one space. - * - * ## What is this? - * - * This package checks the space after checkboxes. - * - * ## When should I use this? - * - * You can use this package to check that the style of GFM tasklists is - * a single space. - * - * ## API - * - * ### `unified().use(remarkLintCheckboxContentIndent)` - * - * Warn when GFM tasklist checkboxes are followed by more than one space. - * - * ###### Parameters - * - * There are no options. - * - * ###### Returns - * - * Transform ([`Transformer` from `unified`][github-unified-transformer]). - * - * ## Recommendation - * - * GFM allows zero or more spaces and tabs after checkboxes. - * No space at all arguably looks rather ugly: - * - * ```markdown - * * [x]Pluto - * ``` - * - * More that one space is superfluous: - * - * ```markdown - * * [x] Jupiter - * ``` - * - * Due to this, it’s recommended to turn this rule on. - * - * ## Fix - * - * [`remark-stringify`][github-remark-stringify] formats checkboxes and the - * content after them with a single space between. - * - * [api-remark-lint-checkbox-content-indent]: #unifieduseremarklintcheckboxcontentindent - * [github-remark-stringify]: https://github.com/remarkjs/remark/tree/main/packages/remark-stringify - * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer - * - * @module checkbox-content-indent - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * - * @example - * {"gfm": true, "name": "ok.md"} - * - * - [ ] Mercury. - * + [x] Venus. - * * [X] Earth. - * - [ ] Mars. - * - * @example - * {"gfm": true, "label": "input", "name": "not-ok.md"} - * - * - [ ] Mercury. - * + [x] Venus. - * * [X] Earth. - * - [ ] Mars. - * @example - * {"gfm": true, "label": "output", "name": "not-ok.md"} - * - * 2:8: Unexpected `2` spaces between checkbox and content, expected `1` space, remove `1` space - * 3:9: Unexpected `3` spaces between checkbox and content, expected `1` space, remove `2` spaces - * 4:10: Unexpected `4` spaces between checkbox and content, expected `1` space, remove `3` spaces - * - * @example - * {"gfm": true, "label": "input", "name": "tab.md"} - * - * - [ ]␉Mercury. - * + [x]␉␉Venus. - * @example - * {"gfm": true, "label": "output", "name": "tab.md"} - * - * 2:8: Unexpected `2` spaces between checkbox and content, expected `1` space, remove `1` space - */ -const remarkLintCheckboxContentIndent = lintRule$1( - { - origin: 'remark-lint:checkbox-content-indent', - url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-checkbox-content-indent#readme' - }, - function (tree, file) { - const value = String(file); - visitParents(tree, function (node, parents) { - if (phrasing(node)) { - return SKIP - } - if (node.type !== 'listItem') return - const head = node.children[0]; - const headStart = pointStart(head); - if ( - !head || - !headStart || - typeof node.checked !== 'boolean' || - typeof headStart.offset !== 'number' - ) { - return - } - const match = /\[([\t xX])]/.exec( - value.slice(headStart.offset - 4, headStart.offset + 1) - ); - if (!match) return - let final = headStart.offset; - let code = value.charCodeAt(final); - while (code === 9 || code === 32) { - final++; - code = value.charCodeAt(final); - } - const size = final - headStart.offset; - if (size) { - file.message( - 'Unexpected `' + - (size + 1) + - '` ' + - pluralize('space', size + 1) + - ' between checkbox and content, expected `1` space, remove `' + - size + - '` ' + - pluralize('space', size), - { - ancestors: [...parents, node], - place: { - line: headStart.line, - column: headStart.column + size, - offset: headStart.offset + size - } - } - ); - } - }); - } -); - -/** - * remark-lint rule to warn when code blocks violate a given style. - * - * ## What is this? - * - * This package checks the style of code blocks. - * - * ## When should I use this? - * - * You can use this package to check that the style of code blocks is - * consistent. - * - * ## API - * - * ### `unified().use(remarkLintCodeBlockStyle[, options])` - * - * Warn when code blocks violate a given style. - * - * ###### Parameters - * - * * `options` ([`Options`][api-options], default: `'consistent'`) - * — preferred style or whether to detect the first style and warn for - * further differences - * - * ###### Returns - * - * Transform ([`Transformer` from `unified`][github-unified-transformer]). - * - * ### `Options` - * - * Configuration (TypeScript type). - * - * ###### Type - * - * ```ts - * type Options = Style | 'consistent' - * ``` - * - * ### `Style` - * - * Style (TypeScript type). - * - * ###### Type - * - * ```ts - * type Style = 'indented' | 'fenced' - * ``` - * - * ## Recommendation - * - * Indentation in markdown is complex as lists and indented code interfere in - * unexpected ways. - * Fenced code has more features than indented code: it can specify a - * programming language. - * Since CommonMark took the idea of fenced code from GFM, - * fenced code became widely supported. - * Due to this, it’s recommended to configure this rule with `'fenced'`. - * - * ## Fix - * - * [`remark-stringify`][github-remark-stringify] always formats code blocks as - * fenced. - * Pass `fences: false` to only use fenced code blocks when they have a - * language and as indented code otherwise. - * - * [api-options]: #options - * [api-remark-lint-code-block-style]: #unifieduseremarklintcodeblockstyle-options - * [api-style]: #style - * [github-remark-stringify]: https://github.com/remarkjs/remark/tree/main/packages/remark-stringify - * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer - * - * @module code-block-style - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * - * @example - * {"config": "indented", "name": "ok-indented.md"} - * - * venus() - * - * Mercury. - * - * earth() - * - * @example - * {"config": "fenced", "name": "ok-fenced.md"} - * - * ``` - * venus() - * ``` - * - * Mercury. - * - * ``` - * earth() - * ``` - * - * @example - * {"label": "input", "name": "not-ok-consistent.md"} - * - * venus() - * - * Mercury. - * - * ``` - * earth() - * ``` - * @example - * {"label": "output", "name": "not-ok-consistent.md"} - * - * 5:1-7:4: Unexpected fenced code block, expected indented code blocks - * - * @example - * {"config": "indented", "label": "input", "name": "not-ok-indented.md"} - * - * ``` - * venus() - * ``` - * - * Mercury. - * - * ``` - * earth() - * ``` - * @example - * {"config": "indented", "label": "output", "name": "not-ok-indented.md"} - * - * 1:1-3:4: Unexpected fenced code block, expected indented code blocks - * 7:1-9:4: Unexpected fenced code block, expected indented code blocks - * - * @example - * {"config": "fenced", "label": "input", "name": "not-ok-fenced.md"} - * - * venus() - * - * Mercury. - * - * earth() - * - * @example - * {"config": "fenced", "label": "output", "name": "not-ok-fenced.md"} - * - * 1:1-1:12: Unexpected indented code block, expected fenced code blocks - * 5:1-5:12: Unexpected indented code block, expected fenced code blocks - * - * @example - * {"config": "🌍", "label": "output", "name": "not-ok-options.md", "positionless": true} - * - * 1:1: Unexpected value `🌍` for `options`, expected `'fenced'`, `'indented'`, or `'consistent'` - */ -const remarkLintCodeBlockStyle = lintRule$1( - { - origin: 'remark-lint:code-block-style', - url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-code-block-style#readme' - }, - function (tree, file, options) { - const value = String(file); - let cause; - let expected; - if (options === null || options === undefined || options === 'consistent') ; else if (options === 'indented' || options === 'fenced') { - expected = options; - } else { - file.fail( - 'Unexpected value `' + - options + - "` for `options`, expected `'fenced'`, `'indented'`, or `'consistent'`" - ); - } - visitParents(tree, function (node, parents) { - if (phrasing(node)) { - return SKIP - } - if (node.type !== 'code') return - const end = pointEnd(node); - const start = pointStart(node); - if ( - !start || - !end || - typeof start.offset !== 'number' || - typeof end.offset !== 'number' - ) { - return - } - const actual = - node.lang || /^ {0,3}([`~])/.test(value.slice(start.offset, end.offset)) - ? 'fenced' - : 'indented'; - if (expected) { - if (expected !== actual) { - file.message( - 'Unexpected ' + - actual + - ' code block, expected ' + - expected + - ' code blocks', - {ancestors: [...parents, node], cause, place: {start, end}} - ); - } - } else { - expected = actual; - cause = new VFileMessage( - "Code block style `'" + - actual + - "'` first defined for `'consistent'` here", - { - ancestors: [...parents, node], - place: {start, end}, - source: 'remark-lint', - ruleId: 'code-block-style' - } - ); - } - }); - } -); - -/** - * remark-lint rule to warn when consecutive whitespace is used in - * a definition label. - * - * ## What is this? - * - * This package checks the whitepsace in definition labels. - * - * GFM footnotes are not affected by this rule as footnote labels cannot - * contain whitespace. - * - * ## When should I use this? - * - * You can use this package to check that definition labels are consistent. - * - * ## API - * - * ### `unified().use(remarkLintDefinitionSpacing)` - * - * Warn when consecutive whitespace is used in a definition label. - * - * ###### Parameters - * - * There are no options. - * - * ###### Returns - * - * Transform ([`Transformer` from `unified`][github-unified-transformer]). - * - * ## Recommendation - * - * Definitions and references are matched together by collapsing whitespace. - * Using more whitespace in labels might incorrectly indicate that they are of - * importance. - * Due to this, it’s recommended to use one space and turn this rule on. - * - * [api-remark-lint-definition-spacing]: #unifieduseremarklintdefinitionspacing - * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer - * - * @module definition-spacing - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * - * @example - * {"name": "ok.md"} - * - * The first planet is [planet mercury][]. - * - * [planet mercury]: http://example.com - * - * @example - * {"label": "input", "name": "not-ok-consecutive.md"} - * - * [planet␠␠␠␠mercury]: http://example.com - * @example - * {"label": "output", "name": "not-ok-consecutive.md"} - * - * 1:1-1:40: Unexpected `4` consecutive spaces in definition label, expected `1` space, remove `3` spaces - * - * @example - * {"label": "input", "name": "not-ok-non-space.md"} - * - * [pla␉net␊mer␍cury]: http://e.com - * @example - * {"label": "output", "name": "not-ok-non-space.md"} - * - * 1:1-3:20: Unexpected non-space whitespace character `\t` in definition label, expected `1` space, replace it - * 1:1-3:20: Unexpected non-space whitespace character `\n` in definition label, expected `1` space, replace it - * 1:1-3:20: Unexpected non-space whitespace character `\r` in definition label, expected `1` space, replace it - */ -const remarkLintDefinitionSpacing = lintRule$1( - { - origin: 'remark-lint:definition-spacing', - url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-definition-spacing#readme' - }, - function (tree, file) { - visitParents(tree, function (node, parents) { - if (phrasing(node)) { - return SKIP - } - if (node.type === 'definition' && node.position && node.label) { - const size = longestStreak(node.label, ' '); - if (size > 1) { - file.message( - 'Unexpected `' + - size + - '` consecutive spaces in definition label, expected `1` space, remove `' + - (size - 1) + - '` ' + - pluralize('space', size - 1), - {ancestors: [...parents, node], place: node.position} - ); - } - const disallowed = []; - if (node.label.includes('\t')) disallowed.push('\\t'); - if (node.label.includes('\n')) disallowed.push('\\n'); - if (node.label.includes('\r')) disallowed.push('\\r'); - for (const disallow of disallowed) { - file.message( - 'Unexpected non-space whitespace character `' + - disallow + - '` in definition label, expected `1` space, replace it', - {ancestors: [...parents, node], place: node.position} - ); - } - } - }); - } -); - -const quotation = - ( - function (value, open, close) { - const start = open; - const end = start; - let index = -1; - if (Array.isArray(value)) { - const list = (value); - const result = []; - while (++index < list.length) { - result[index] = start + list[index] + end; - } - return result - } - if (typeof value === 'string') { - return start + value + end - } - throw new TypeError('Expected string or array of strings') - } - ); - -/** - * remark-lint rule to warn when language flags of fenced code - * are not used. - * - * ## What is this? - * - * This package checks the language flags of fenced code blocks, - * whether they exist, - * and optionally what values they hold. - * - * ## When should I use this? - * - * You can use this package to check that the style of language flags of fenced - * code blocks is consistent. - * - * ## API - * - * ### `unified().use(remarkLintFencedCodeFlag[, options])` - * - * Warn when language flags of fenced code are not used. - * - * ###### Parameters - * - * * `options` ([`Options`][api-options] or `Array`, optional) - * — configuration or flags to allow - * - * ###### Returns - * - * Transform ([`Transformer` from `unified`][github-unified-transformer]). - * - * ### `Options` - * - * Configuration (TypeScript type). - * - * ###### Fields - * - * * `allowEmpty` (`boolean`, default: `false`) - * — allow language flags to be omitted - * * `flags` (`Array`, optional) - * — flags to allow, - * other flags will result in a warning - * - * ## Recommendation - * - * While omitting language flags is fine to signal that code is plain text, - * it *could* point to a mistake. - * It’s recommended to instead use a certain flag for plain text (such as - * `txt`) and to turn this rule on. - * - * [api-options]: #options - * [api-remark-lint-fenced-code-flag]: #unifieduseremarklintfencedcodeflag-options - * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer - * - * @module fenced-code-flag - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * - * @example - * {"name": "ok.md"} - * - * Some markdown: - * - * ```markdown - * # Mercury - * ``` - * - * @example - * {"label": "input", "name": "not-ok.md"} - * - * ``` - * mercury() - * ``` - * @example - * {"label": "output", "name": "not-ok.md"} - * - * 1:1-3:4: Unexpected missing fenced code language flag in info string, expected keyword - * - * @example - * {"config": {"allowEmpty": true}, "name": "ok-allow-empty.md"} - * - * ``` - * mercury() - * ``` - * - * @example - * {"config": {"allowEmpty": false}, "label": "input", "name": "not-ok-allow-empty.md"} - * - * ``` - * mercury() - * ``` - * @example - * {"config": {"allowEmpty": false}, "label": "output", "name": "not-ok-allow-empty.md"} - * - * 1:1-3:4: Unexpected missing fenced code language flag in info string, expected keyword - * - * @example - * {"config": ["markdown"], "name": "ok-array.md"} - * - * ```markdown - * # Mercury - * ``` - * - * @example - * {"config": {"flags":["markdown"]}, "name": "ok-options.md"} - * - * ```markdown - * # Mercury - * ``` - * - * @example - * {"config": ["markdown"], "label": "input", "name": "not-ok-array.md"} - * - * ```javascript - * mercury() - * ``` - * @example - * {"config": ["markdown"], "label": "output", "name": "not-ok-array.md"} - * - * 1:1-3:4: Unexpected fenced code language flag `javascript` in info string, expected `markdown` - * - * @example - * {"config": ["javascript", "markdown", "mdx", "typescript"], "label": "input", "name": "not-ok-long-array.md"} - * - * ```html - *

Mercury

- * ``` - * @example - * {"config": ["javascript", "markdown", "mdx", "typescript"], "label": "output", "name": "not-ok-long-array.md"} - * - * 1:1-3:4: Unexpected fenced code language flag `html` in info string, expected `javascript`, `markdown`, `mdx`, … - * - * @example - * {"config": "🌍", "label": "output", "name": "not-ok-options.md", "positionless": true} - * - * 1:1: Unexpected value `🌍` for `options`, expected array or object - */ -const fence = /^ {0,3}([~`])\1{2,}/; -const listFormat$1 = new Intl.ListFormat('en', {type: 'disjunction'}); -const listFormatUnit$1 = new Intl.ListFormat('en', {type: 'unit'}); -const remarkLintFencedCodeFlag = lintRule$1( - { - origin: 'remark-lint:fenced-code-flag', - url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-fenced-code-flag#readme' - }, - function (tree, file, options) { - const value = String(file); - let allowEmpty = false; - let allowed; - if (options === null || options === undefined) ; else if (typeof options === 'object') { - if (Array.isArray(options)) { - const flags = (options); - allowed = flags; - } else { - const settings = (options); - allowEmpty = settings.allowEmpty === true; - if (settings.flags) { - allowed = settings.flags; - } - } - } else { - file.fail( - 'Unexpected value `' + - options + - '` for `options`, expected array or object' - ); - } - let allowedDisplay; - if (allowed) { - allowedDisplay = - allowed.length > 3 - ? listFormatUnit$1.format([...quotation(allowed.slice(0, 3), '`'), '…']) - : listFormat$1.format(quotation(allowed, '`')); - } else { - allowedDisplay = 'keyword'; - } - visitParents(tree, function (node, parents) { - if (phrasing(node)) { - return SKIP - } - if (node.type !== 'code') return - const end = pointEnd(node); - const start = pointStart(node); - if ( - end && - start && - typeof end.offset === 'number' && - typeof start.offset === 'number' - ) { - if (node.lang) { - if (allowed && !allowed.includes(node.lang)) { - file.message( - 'Unexpected fenced code language flag `' + - node.lang + - '` in info string, expected ' + - allowedDisplay, - {ancestors: [...parents, node], place: node.position} - ); - } - } else if (!allowEmpty) { - const slice = value.slice(start.offset, end.offset); - if (fence.test(slice)) { - file.message( - 'Unexpected missing fenced code language flag in info string, expected ' + - allowedDisplay, - {ancestors: [...parents, node], place: node.position} - ); - } - } - } - }); - } -); - -/** - * remark-lint rule to warn when fenced code markers are - * inconsistent. - * - * ## What is this? - * - * This package checks fenced code block markers. - * - * ## When should I use this? - * - * You can use this package to check that fenced code block markers are - * consistent. - * - * ## API - * - * ### `unified().use(remarkLintFencedCodeMarker[, options])` - * - * Warn when fenced code markers are inconsistent. - * - * ###### Parameters - * - * * `options` ([`Options`][api-options], default: `'consistent'`) - * — preferred style or whether to detect the first style and warn for - * further differences - * - * ###### Returns - * - * Transform ([`Transformer` from `unified`][github-unified-transformer]). - * - * ### `Marker` - * - * Marker (TypeScript type). - * - * ###### Type - * - * ```ts - * type Marker = '`' | '~' - * ``` - * - * ### `Options` - * - * Configuration (TypeScript type). - * - * ###### Type - * - * ```ts - * type Options = Marker | 'consistent' - * ``` - * - * ## Recommendation - * - * Tildes are uncommon. - * So it’s recommended to configure this rule with ``'`'``. - * - * ## Fix - * - * [`remark-stringify`][github-remark-stringify] formats fenced code with grave - * accents by default. - * Pass `fence: '~'` to always use tildes. - * - * [api-marker]: #marker - * [api-options]: #options - * [api-remark-lint-fenced-code-marker]: #unifieduseremarklintfencedcodemarker-options - * [github-remark-stringify]: https://github.com/remarkjs/remark/tree/main/packages/remark-stringify - * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer - * - * @module fenced-code-marker - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * - * @example - * {"name": "ok-indented.md"} - * - * Indented code blocks are not affected by this rule: - * - * mercury() - * - * @example - * {"config": "`", "name": "ok-tick.md"} - * - * ```javascript - * mercury() - * ``` - * - * ``` - * venus() - * ``` - * - * @example - * {"config": "~", "name": "ok-tilde.md"} - * - * ~~~javascript - * mercury() - * ~~~ - * - * ~~~ - * venus() - * ~~~ - * - * @example - * {"label": "input", "name": "not-ok-consistent-tick.md"} - * - * ```javascript - * mercury() - * ``` - * - * ~~~ - * venus() - * ~~~ - * @example - * {"label": "output", "name": "not-ok-consistent-tick.md"} - * - * 5:1-7:4: Unexpected fenced code marker `~`, expected `` ` `` - * - * @example - * {"label": "input", "name": "not-ok-consistent-tilde.md"} - * - * ~~~javascript - * mercury() - * ~~~ - * - * ``` - * venus() - * ``` - * @example - * {"label": "output", "name": "not-ok-consistent-tilde.md"} - * - * 5:1-7:4: Unexpected fenced code marker `` ` ``, expected `~` - * - * @example - * {"config": "🌍", "label": "output", "name": "not-ok-incorrect.md", "positionless": true} - * - * 1:1: Unexpected value `🌍` for `options`, expected ``'`'``, `'~'`, or `'consistent'` - */ -const remarkLintFencedCodeMarker = lintRule$1( - { - origin: 'remark-lint:fenced-code-marker', - url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-fenced-code-marker#readme' - }, - function (tree, file, options) { - const value = String(file); - let cause; - let expected; - if (options === null || options === undefined || options === 'consistent') ; else if (options === '`' || options === '~') { - expected = options; - } else { - file.fail( - 'Unexpected value `' + - options + - "` for `options`, expected ``'`'``, `'~'`, or `'consistent'`" - ); - } - visitParents(tree, function (node, parents) { - if (phrasing(node)) { - return SKIP - } - if (node.type !== 'code') return - const start = pointStart(node); - if (start && typeof start.offset === 'number') { - const actual = value - .slice(start.offset, start.offset + 4) - .replace(/^\s+/, '') - .charAt(0); - if (actual !== '`' && actual !== '~') return - if (expected) { - if (actual !== expected) { - file.message( - 'Unexpected fenced code marker ' + - (actual === '~' ? '`~`' : '`` ` ``') + - ', expected ' + - (expected === '~' ? '`~`' : '`` ` ``'), - {ancestors: [...parents, node], cause, place: node.position} - ); - } - } else { - expected = actual; - cause = new VFileMessage( - 'Fenced code marker style ' + - (actual === '~' ? "`'~'`" : "``'`'``") + - " first defined for `'consistent'` here", - { - ancestors: [...parents, node], - place: node.position, - ruleId: 'fenced-code-marker', - source: 'remark-lint' - } - ); - } - } - }); - } -); - -/** - * remark-lint rule to warn for unexpected file extensions. - * - * ## What is this? - * - * This package checks the file extension. - * - * ## When should I use this? - * - * You can use this package to check that file extensions are consistent. - * - * ## API - * - * ### `unified().use(remarkLintFileExtension[, options])` - * - * Warn for unexpected extensions. - * - * ###### Parameters - * - * * `options` ([`Extensions`][api-extensions] or [`Options`][api-options], - * optional) - * — configuration - * - * ###### Returns - * - * Transform ([`Transformer` from `unified`][github-unified-transformer]). - * - * ### `Extensions` - * - * File extension(s) (TypeScript type). - * - * ###### Type - * - * ```ts - * type Extensions = Array | string - * ``` - * - * ### `Options` - * - * Configuration (TypeScript type). - * - * ###### Fields - * - * * `allowExtensionless` (`boolean`, default: `true`) - * — allow no file extension such as `AUTHORS` or `LICENSE` - * * `extensions` ([`Extensions`][api-extensions], default: `['mdx', 'md']`) - * — allowed file extension(s) - * - * ## Recommendation - * - * Use `md` as it’s the most common. - * Also use `md` when your markdown contains common syntax extensions (such as - * GFM, frontmatter, or math). - * Do not use `md` for MDX: use `mdx` instead. - * - * [api-extensions]: #extensions - * [api-options]: #options - * [api-remark-lint-file-extension]: #unifieduseremarklintfileextension-options - * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer - * - * @module file-extension - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * - * @example - * {"name": "readme.md"} - * - * @example - * {"name": "readme.mdx"} - * - * @example - * {"name": "readme"} - * - * @example - * {"config": {"allowExtensionless": false}, "label": "output", "name": "readme", "positionless": true} - * - * 1:1: Unexpected missing file extension, expected `mdx` or `md` - * - * @example - * {"label": "output", "name": "readme.mkd", "positionless": true} - * - * 1:1: Unexpected file extension `mkd`, expected `mdx` or `md` - * - * @example - * {"config": "mkd", "name": "readme.mkd"} - * - * @example - * {"config": ["markdown", "md", "mdown", "mdwn", "mdx", "mkd", "mkdn", "mkdown", "ron"], "label": "input", "name": "readme.css", "positionless": true} - * - * @example - * {"config": ["markdown", "md", "mdown", "mdwn", "mdx", "mkd", "mkdn", "mkdown", "ron"], "label": "output", "name": "readme.css"} - * - * 1:1: Unexpected file extension `css`, expected `markdown`, `md`, `mdown`, … - */ -const defaultExtensions = ['mdx', 'md']; -const listFormat = new Intl.ListFormat('en', {type: 'disjunction'}); -const listFormatUnit = new Intl.ListFormat('en', {type: 'unit'}); -const remarkLintFileExtension = lintRule$1( - { - origin: 'remark-lint:file-extension', - url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-file-extension#readme' - }, - function (_, file, options) { - let expected = defaultExtensions; - let allowExtensionless = true; - let extensionsValue; - if (Array.isArray(options)) { - extensionsValue = (options); - } else if (typeof options === 'string') { - extensionsValue = options; - } else if (options) { - const settings = (options); - extensionsValue = settings.extensions; - if (settings.allowExtensionless === false) { - allowExtensionless = false; - } - } - if (Array.isArray(extensionsValue)) { - expected = (extensionsValue); - } else if (typeof extensionsValue === 'string') { - expected = [extensionsValue]; - } - const extname = file.extname; - const actual = extname ? extname.slice(1) : undefined; - const expectedDisplay = - expected.length > 3 - ? listFormatUnit.format([...quotation(expected.slice(0, 3), '`'), '…']) - : listFormat.format(quotation(expected, '`')); - if (actual ? !expected.includes(actual) : !allowExtensionless) { - file.message( - (actual - ? 'Unexpected file extension `' + actual + '`' - : 'Unexpected missing file extension') + - ', expected ' + - expectedDisplay - ); - } - } -); - -/** - * remark-lint rule to warn when definitions are used *in* the - * document instead of at the end. - * - * ## What is this? - * - * This package checks where definitions are placed. - * - * ## When should I use this? - * - * You can use this package to check that definitions are consistently at the - * end of the document. - * - * ## API - * - * ### `unified().use(remarkLintFinalDefinition)` - * - * Warn when definitions are used *in* the document instead of at the end. - * - * ###### Parameters - * - * There are no options. - * - * ###### Returns - * - * Transform ([`Transformer` from `unified`][github-unified-transformer]). - * - * ## Recommendation - * - * There are different strategies for placing definitions. - * The simplest is perhaps to place them all at the bottem of documents. - * If you prefer that, turn on this rule. - * - * [api-remark-lint-final-definition]: #unifieduseremarklintfinaldefinition - * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer - * - * @module final-definition - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * - * @example - * {"name": "ok.md"} - * - * Mercury. - * - * [venus]: http://example.com - * - * @example - * {"name": "ok.md"} - * - * [mercury]: http://example.com/mercury/ - * [venus]: http://example.com/venus/ - * - * @example - * {"name": "ok-html-comments.md"} - * - * Mercury. - * - * [venus]: http://example.com/venus/ - * - * - * - * [earth]: http://example.com/earth/ - * - * @example - * {"name": "ok-mdx-comments.mdx", "mdx": true} - * - * Mercury. - * - * [venus]: http://example.com/venus/ - * - * {/* Comments in expressions in MDX are ignored. *␀/} - * - * [earth]: http://example.com/earth/ - * - * @example - * {"label": "input", "name": "not-ok.md"} - * - * Mercury. - * - * [venus]: https://example.com/venus/ - * - * Earth. - * @example - * {"label": "output", "name": "not-ok.md"} - * - * 3:1-3:36: Unexpected definition before last content, expected definitions after line `5` - * - * @example - * {"gfm": true, "label": "input", "name": "gfm-nok.md"} - * - * Mercury. - * - * [^venus]: - * **Venus** is the second planet from - * the Sun. - * - * Earth. - * @example - * {"gfm": true, "label": "output", "name": "gfm-nok.md"} - * - * 3:1-5:13: Unexpected footnote definition before last content, expected definitions after line `7` - * - * @example - * {"gfm": true, "name": "gfm-ok.md"} - * - * Mercury. - * - * Earth. - * - * [^venus]: - * **Venus** is the second planet from - * the Sun. - */ -const remarkLintFinalDefinition = lintRule$1( - { - origin: 'remark-lint:final-definition', - url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-final-definition#readme' - }, - function (tree, file) { - const definitionStacks = []; - let contentAncestors; - visitParents(tree, function (node, parents) { - if (phrasing(node)) { - return SKIP - } - if (node.type === 'definition' || node.type === 'footnoteDefinition') { - definitionStacks.push([...parents, node]); - return SKIP - } - if ( - node.type === 'root' || - (node.type === 'html' && /^[\t ]*".length)); - validateMeta(node, file, meta); - } catch (e) { - file.message(e, node); - } - }); -} -const remarkLintNodejsYamlComments = lintRule$1( - "remark-lint:nodejs-yaml-comments", - validateYAMLComments, -); - -function lintRule(meta, rule) { - const id = meta ; - const url = undefined ; - const parts = id.split(':'); - const source = parts[1] ? parts[0] : undefined; - const ruleId = parts[1]; - Object.defineProperty(plugin, 'name', {value: id}); - return plugin - function plugin(config) { - const [severity, options] = coerce(ruleId, config); - if (!severity) return - const fatal = severity === 2; - return (tree, file, next) => { - let index = file.messages.length - 1; - wrap(rule, (error) => { - const messages = file.messages; - if (error && !messages.includes(error)) { - try { - file.fail(error); - } catch {} - } - while (++index < messages.length) { - Object.assign(messages[index], {ruleId, source, fatal, url}); - } - next(); - })(tree, file, options); - } - } -} -function coerce(name, config) { - if (!Array.isArray(config)) return [1, config] - const [severity, ...options] = config; - switch (severity) { - case false: - case 'off': - case 0: { - return [0, ...options] - } - case true: - case 'on': - case 'warn': - case 1: { - return [1, ...options] - } - case 'error': - case 2: { - return [2, ...options] - } - default: { - if (typeof severity !== 'number') return [1, config] - throw new Error( - 'Incorrect severity `' + - severity + - '` for `' + - name + - '`, ' + - 'expected 0, 1, or 2' - ) - } - } -} - -const remarkLintProhibitedStrings = lintRule('remark-lint:prohibited-strings', prohibitedStrings); -function testProhibited (val, content) { - let regexpFlags = 'g'; - let no = val.no; - if (!no) { - no = escapeStringRegexp(val.yes); - regexpFlags += 'i'; - } - let regexpString = '(? escapeStringRegexp(a)).join('|'); - ignoreNextTo = `(?:${parts})`; - } else { - ignoreNextTo = escapeStringRegexp(val.ignoreNextTo); - } - } else { - ignoreNextTo = ''; - } - const replaceCaptureGroups = !!val.replaceCaptureGroups; - if (/^\b/.test(no)) { - regexpString += '\\b'; - } - if (ignoreNextTo) { - regexpString += `(? { - const results = testProhibited(val, content); - if (results.length) { - results.forEach(({ result, index, yes }) => { - const message = val.yes ? `Use "${yes}" instead of "${result}"` : `Do not use "${result}"`; - file.message(message, { - start: myLocation.toPoint(initial + index), - end: myLocation.toPoint(initial + index + [...result].length) - }); - }); - } - }); - } -} - -/** - * remark-lint rule to warn when thematic breaks (horizontal rules) are - * inconsistent. - * - * ## What is this? - * - * This package checks markers and whitespace of thematic rules. - * - * ## When should I use this? - * - * You can use this package to check that thematic breaks are consistent. - * - * ## API - * - * ### `unified().use(remarkLintRuleStyle[, options])` - * - * Warn when thematic breaks (horizontal rules) are inconsistent. - * - * ###### Parameters - * - * * `options` ([`Options`][api-options], default: `'consistent'`) - * — preferred style or whether to detect the first style and warn for - * further differences - * - * ### `Options` - * - * Configuration (TypeScript type). - * - * * `'consistent'` - * — detect the first used style and warn when further rules differ - * * `string` (example: `'** * **'`, `'___'`) - * — thematic break to prefer - * - * ###### Type - * - * ```ts - * type Options = string | 'consistent' - * ``` - * - * ## Recommendation - * - * Rules consist of a `*`, `-`, or `_` character, - * which occurs at least three times with nothing else except for arbitrary - * spaces or tabs on a single line. - * Using spaces, tabs, or more than three markers is unnecessary work to type - * out. - * As asterisks can be used as a marker for more markdown constructs, - * it’s recommended to use that for rules (and lists, emphasis, strong) too. - * So it’s recommended to pass `'***'`. - * - * ## Fix - * - * [`remark-stringify`][github-remark-stringify] formats rules with `***` by - * default. - * There are three settings to control rules: - * - * * `rule` (default: `'*'`) — marker - * * `ruleRepetition` (default: `3`) — repetitions - * * `ruleSpaces` (default: `false`) — use spaces between markers - * - * [api-options]: #options - * [api-remark-lint-rule-style]: #unifieduseremarklintrulestyle-options - * [github-remark-stringify]: https://github.com/remarkjs/remark/tree/main/packages/remark-stringify - * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer - * - * @module rule-style - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * - * @example - * {"name": "ok.md"} - * - * Two rules: - * - * * * * - * - * * * * - * - * @example - * {"config": "_______", "name": "ok.md"} - * - * _______ - * - * _______ - * - * @example - * {"label": "input", "name": "not-ok.md"} - * - * *** - * - * * * * - * @example - * {"label": "output", "name": "not-ok.md"} - * - * 3:1-3:6: Unexpected thematic rule `* * *`, expected `***` - * - * @example - * {"config": "🌍", "label": "output", "name": "not-ok.md", "positionless": true} - * - * 1:1: Unexpected value `🌍` for `options`, expected thematic rule or `'consistent'` - */ -const remarkLintRuleStyle = lintRule$1( - { - origin: 'remark-lint:rule-style', - url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-rule-style#readme' - }, - function (tree, file, options) { - const value = String(file); - let expected; - let cause; - if (options === null || options === undefined || options === 'consistent') ; else if ( - /[^-_* ]/.test(options) || - options.at(0) === ' ' || - options.at(-1) === ' ' || - options.replaceAll(' ', '').length < 3 - ) { - file.fail( - 'Unexpected value `' + - options + - "` for `options`, expected thematic rule or `'consistent'`" - ); - } else { - expected = options; - } - visitParents(tree, function (node, parents) { - if (phrasing(node)) { - return SKIP - } - if (node.type !== 'thematicBreak') return - const end = pointEnd(node); - const start = pointStart(node); - if ( - start && - end && - typeof start.offset === 'number' && - typeof end.offset === 'number' - ) { - const place = {start, end}; - const actual = value.slice(start.offset, end.offset); - if (expected) { - if (actual !== expected) { - file.message( - 'Unexpected thematic rule `' + - actual + - '`, expected `' + - expected + - '`', - {ancestors: [...parents, node], cause, place} - ); - } - } else { - expected = actual; - cause = new VFileMessage( - 'Thematic rule style `' + - expected + - "` first defined for `'consistent'` here", - { - ancestors: [...parents, node], - place, - ruleId: 'rule-style', - source: 'remark-lint' - } - ); - } - } - }); - } -); - -/** - * remark-lint rule to warn when strong markers are inconsistent. - * - * ## What is this? - * - * This package checks the style of strong markers. - * - * ## When should I use this? - * - * You can use this package to check that strong is consistent. - * - * ## API - * - * ### `unified().use(remarkLintStrongMarker[, options])` - * - * Warn when strong markers are inconsistent. - * - * ###### Parameters - * - * * `options` ([`Options`][api-options], default: `'consistent'`) - * — preferred style or whether to detect the first style and warn for - * further differences - * - * ###### Returns - * - * Transform ([`Transformer` from `unified`][github-unified-transformer]). - * - * ### `Marker` - * - * Marker (TypeScript type). - * - * ###### Type - * - * ```ts - * type Marker = '*' | '_' - * ``` - * - * ### `Options` - * - * Configuration (TypeScript type). - * - * ###### Type - * - * ```ts - * type Options = Marker | 'consistent' - * ``` - * - * ## Recommendation - * - * Whether asterisks or underscores are used affects how and whether strong - * works. - * Underscores are sometimes used to represent normal underscores inside words, - * so there are extra rules in markdown to support that. - * Asterisks are not used in natural language, - * so they don’t need these rules, - * and thus can form strong in more cases. - * Asterisks can also be used as the marker of more constructs than underscores: - * lists. - * Due to having simpler parsing rules, - * looking more like syntax, - * and that they can be used for more constructs, - * it’s recommended to prefer asterisks. - * - * ## Fix - * - * [`remark-stringify`][github-remark-stringify] formats strong with asterisks - * by default. - * Pass `strong: '_'` to always use underscores. - * - * [api-marker]: #marker - * [api-options]: #options - * [api-remark-lint-strong-marker]: #unifieduseremarklintstrongmarker-options - * [github-remark-stringify]: https://github.com/remarkjs/remark/tree/main/packages/remark-stringify - * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer - * - * @module strong-marker - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * - * @example - * {"config": "*", "name": "ok-asterisk.md"} - * - * **Mercury**. - * - * @example - * {"config": "*", "label": "input", "name": "not-ok-asterisk.md"} - * - * __Mercury__. - * - * @example - * {"config": "*", "label": "output", "name": "not-ok-asterisk.md"} - * - * 1:1-1:12: Unexpected strong marker `_`, expected `*` - * - * @example - * {"config": "_", "name": "ok-underscore.md"} - * - * __Mercury__. - * - * @example - * {"config": "_", "label": "input", "name": "not-ok-underscore.md"} - * - * **Mercury**. - * - * @example - * {"config": "_", "label": "output", "name": "not-ok-underscore.md"} - * - * 1:1-1:12: Unexpected strong marker `*`, expected `_` - * - * @example - * {"label": "input", "name": "not-ok-consistent.md"} - * - * **Mercury** and __Venus__. - * - * @example - * {"label": "output", "name": "not-ok-consistent.md"} - * - * 1:17-1:26: Unexpected strong marker `_`, expected `*` - * - * @example - * {"config": "🌍", "label": "output", "name": "not-ok.md", "positionless": true} - * - * 1:1: Unexpected value `🌍` for `options`, expected `'*'`, `'_'`, or `'consistent'` - */ -const remarkLintStrongMarker = lintRule$1( - { - origin: 'remark-lint:strong-marker', - url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-strong-marker#readme' - }, - function (tree, file, options) { - const value = String(file); - let cause; - let expected; - if (options === null || options === undefined || options === 'consistent') ; else if (options === '*' || options === '_') { - expected = options; - } else { - file.fail( - 'Unexpected value `' + - options + - "` for `options`, expected `'*'`, `'_'`, or `'consistent'`" - ); - } - visitParents(tree, 'strong', function (node, parents) { - const start = pointStart(node); - if (start && typeof start.offset === 'number') { - const actual = value.charAt(start.offset); - if (actual !== '*' && actual !== '_') return - if (expected) { - if (actual !== expected) { - file.message( - 'Unexpected strong marker `' + - actual + - '`, expected `' + - expected + - '`', - {ancestors: [...parents, node], cause, place: node.position} - ); - } - } else { - expected = actual; - cause = new VFileMessage( - "Strong marker style `'" + - actual + - "'` first defined for `'consistent'` here", - { - ancestors: [...parents, node], - place: node.position, - ruleId: 'strong-marker', - source: 'remark-lint' - } - ); - } - } - }); - } -); - -/** - * remark-lint rule to warn when GFM table cells are padded inconsistently. - * - * ## What is this? - * - * This package checks table cell padding. - * Tables are a GFM feature enabled with [`remark-gfm`][github-remark-gfm]. - * - * ## When should I use this? - * - * You can use this package to check that tables are consistent. - * - * ## API - * - * ### `unified().use(remarkLintTableCellPadding[, options])` - * - * Warn when GFM table cells are padded inconsistently. - * - * ###### Parameters - * - * * `options` ([`Options`][api-options], optional) - * — preferred style or whether to detect the first style and warn for - * further differences - * - * ###### Returns - * - * Transform ([`Transformer` from `unified`][github-unified-transformer]). - * - * ### `Style` - * - * Style (TypeScript type). - * - * * `'compact'` - * — prefer zero spaces between pipes and content - * * `'padded'` - * — prefer at least one space between pipes and content - * - * ###### Type - * - * ```ts - * type Style = 'compact' | 'padded' - * ``` - * - * ### `Options` - * - * Configuration (TypeScript type). - * - * ###### Type - * - * ```ts - * type Options = Style | 'consistent' - * ``` - * - * ## Recommendation - * - * It’s recommended to use at least one space between pipes and content for - * legibility of the markup (`'padded'`). - * - * ## Fix - * - * [`remark-stringify`][github-remark-stringify] with - * [`remark-gfm`][github-remark-gfm] formats all table cells as padded by - * default. - * Pass `tableCellPadding: false` to use a more compact style. - * - * [api-options]: #options - * [api-style]: #style - * [api-remark-lint-table-cell-padding]: #unifieduseremarklinttablecellpadding-options - * [github-remark-gfm]: https://github.com/remarkjs/remark-gfm - * [github-remark-stringify]: https://github.com/remarkjs/remark/tree/main/packages/remark-stringify - * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer - * - * @module table-cell-padding - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * - * @example - * {"config": "padded", "gfm": true, "name": "ok.md"} - * - * | Planet | Symbol | Satellites | Mean anomaly (°) | - * | ------- | :----- | :--------: | ---------------: | - * | Mercury | ☿ | None | 174 796 | - * - * | Planet | Symbol | Satellites | Mean anomaly (°) | - * | - | :- | :-: | -: | - * | Venus | ♀ | None | 50 115 | - * - * @example - * {"config": "padded", "gfm": true, "label": "input", "name": "not-ok.md"} - * - * | Planet | - * | -------| - * | Mercury| - * - * |Planet | - * |------ | - * |Venus | - * - * | Planet | - * | ------ | - * | Venus | - * @example - * {"config": "padded", "gfm": true, "label": "output", "name": "not-ok.md"} - * - * 2:10: Unexpected `0` spaces between cell content and edge, expected `1` space, add `1` space - * 3:10: Unexpected `0` spaces between cell content and edge, expected `1` space, add `1` space - * 5:2: Unexpected `0` spaces between cell edge and content, expected `1` space, add `1` space - * 6:2: Unexpected `0` spaces between cell edge and content, expected `1` space, add `1` space - * 7:2: Unexpected `0` spaces between cell edge and content, expected `1` space, add `1` space - * 9:4: Unexpected `2` spaces between cell edge and content, expected `1` space, remove `1` space - * 9:12: Unexpected `2` spaces between cell content and edge, expected `1` space, remove `1` space - * 10:4: Unexpected `2` spaces between cell edge and content, expected `1` space, remove `1` space - * 10:12: Unexpected `2` spaces between cell content and edge, expected `1` space, remove `1` space - * 11:4: Unexpected `2` spaces between cell edge and content, expected `1` space, remove `1` space - * 11:12: Unexpected `3` spaces between cell content and edge, expected between `1` (unaligned) and `2` (aligned) spaces, remove between `1` and `2` spaces - * - * @example - * {"config": "compact", "gfm": true, "name": "ok.md"} - * - * |Planet |Symbol|Satellites|Mean anomaly (°)| - * |-------|:-----|:--------:|---------------:| - * |Mercury|☿ | None | 174 796| - * - * |Planet|Symbol|Satellites|Mean anomaly (°)| - * |-|:-|:-:|-:| - * |Venus|♀|None|50 115| - * - * @example - * {"config": "compact", "gfm": true, "label": "input", "name": "not-ok.md"} - * - * | Planet | - * | -------| - * | Mercury| - * - * |Planet | - * |------ | - * |Venus | - * - * | Planet | - * | ------ | - * | Venus | - * @example - * {"config": "compact", "gfm": true, "label": "output", "name": "not-ok.md"} - * - * 1:3: Unexpected `1` space between cell edge and content, expected `0` spaces, remove `1` space - * 2:3: Unexpected `1` space between cell edge and content, expected `0` spaces, remove `1` space - * 3:3: Unexpected `1` space between cell edge and content, expected `0` spaces, remove `1` space - * 5:9: Unexpected `1` space between cell content and edge, expected `0` spaces, remove `1` space - * 6:9: Unexpected `1` space between cell content and edge, expected `0` spaces, remove `1` space - * 7:9: Unexpected `2` spaces between cell content and edge, expected between `0` (unaligned) and `1` (aligned) space, remove between `1` and `2` spaces - * 9:4: Unexpected `2` spaces between cell edge and content, expected `0` spaces, remove `2` spaces - * 9:12: Unexpected `2` spaces between cell content and edge, expected `0` spaces, remove `2` spaces - * 10:4: Unexpected `2` spaces between cell edge and content, expected `0` spaces, remove `2` spaces - * 10:12: Unexpected `2` spaces between cell content and edge, expected `0` spaces, remove `2` spaces - * 11:4: Unexpected `2` spaces between cell edge and content, expected `0` spaces, remove `2` spaces - * 11:12: Unexpected `3` spaces between cell content and edge, expected between `0` (unaligned) and `1` (aligned) space, remove between `2` and `3` spaces - * - * @example - * {"gfm": true, "name": "consistent-padded-ok.md"} - * - * | Planet | - * | - | - * - * @example - * {"gfm": true, "label": "input", "name": "consistent-padded-nok.md"} - * - * | Planet| - * | - | - * @example - * {"gfm": true, "label": "output", "name": "consistent-padded-nok.md"} - * - * 1:9: Unexpected `0` spaces between cell content and edge, expected `1` space, add `1` space - * - * @example - * {"gfm": true, "name": "consistent-compact-ok.md"} - * - * |Planet| - * |-| - * - * @example - * {"gfm": true, "label": "input", "name": "consistent-compact-nok.md"} - * - * |Planet | - * |-| - * @example - * {"gfm": true, "label": "output", "name": "consistent-compact-nok.md"} - * - * 1:9: Unexpected `1` space between cell content and edge, expected `0` spaces, remove `1` space - * - * @example - * {"gfm": true, "name": "empty.md"} - * - * | | Satellites | - * | - | - | - * | Mercury | | - * - * @example - * {"gfm": true, "name": "missing-cells.md"} - * - * | Planet | Symbol | Satellites | - * | - | - | - | - * | Mercury | - * | Venus | ♀ | - * | Earth | 🜨 and ♁ | 1 | - * | Mars | ♂ | 2 | 19 412 | - * - * @example - * {"config": "padded", "gfm": true, "label": "input", "name": "missing-fences.md"} - * - * ␠Planet|Symbol|Satellites - * ------:|:-----|---------- - * Mercury|☿ |0 - * - * Planet|Symbol - * -----:|------ - * ␠Venus|♀ - * @example - * {"config": "padded", "gfm": true, "label": "output", "name": "missing-fences.md"} - * - * 1:8: Unexpected `0` spaces between cell content and edge, expected `1` space, add `1` space - * 1:9: Unexpected `0` spaces between cell edge and content, expected `1` space, add `1` space - * 1:15: Unexpected `0` spaces between cell content and edge, expected `1` space, add `1` space - * 1:16: Unexpected `0` spaces between cell edge and content, expected `1` space, add `1` space - * 2:8: Unexpected `0` spaces between cell content and edge, expected `1` space, add `1` space - * 2:9: Unexpected `0` spaces between cell edge and content, expected `1` space, add `1` space - * 2:15: Unexpected `0` spaces between cell content and edge, expected `1` space, add `1` space - * 2:16: Unexpected `0` spaces between cell edge and content, expected `1` space, add `1` space - * 3:8: Unexpected `0` spaces between cell content and edge, expected `1` space, add `1` space - * 3:9: Unexpected `0` spaces between cell edge and content, expected `1` space, add `1` space - * 3:16: Unexpected `0` spaces between cell edge and content, expected `1` space, add `1` space - * 5:7: Unexpected `0` spaces between cell content and edge, expected `1` space, add `1` space - * 5:8: Unexpected `0` spaces between cell edge and content, expected `1` space, add `1` space - * 6:7: Unexpected `0` spaces between cell content and edge, expected `1` space, add `1` space - * 6:8: Unexpected `0` spaces between cell edge and content, expected `1` space, add `1` space - * 7:7: Unexpected `0` spaces between cell content and edge, expected `1` space, add `1` space - * 7:8: Unexpected `0` spaces between cell edge and content, expected `1` space, add `1` space - * - * @example - * {"config": "compact", "gfm": true, "label": "input", "name": "missing-fences.md"} - * - * Planet | Symbol | Satellites - * -: | - | - - * Mercury | ☿ | 0 - * - * Planet | Symbol - * -----: | ------ - * ␠Venus | ♀ - * @example - * {"config": "compact", "gfm": true, "label": "output", "name": "missing-fences.md"} - * - * 1:8: Unexpected `1` space between cell content and edge, expected `0` spaces, remove `1` space - * 1:10: Unexpected `1` space between cell edge and content, expected `0` spaces, remove `1` space - * 1:17: Unexpected `1` space between cell content and edge, expected `0` spaces, remove `1` space - * 1:19: Unexpected `1` space between cell edge and content, expected `0` spaces, remove `1` space - * 2:4: Unexpected `1` space between cell content and edge, expected `0` spaces, remove `1` space - * 2:6: Unexpected `1` space between cell edge and content, expected `0` spaces, remove `1` space - * 2:10: Unexpected `1` space between cell edge and content, expected `0` spaces, remove `1` space - * 3:9: Unexpected `1` space between cell content and edge, expected `0` spaces, remove `1` space - * 3:11: Unexpected `1` space between cell edge and content, expected `0` spaces, remove `1` space - * 3:15: Unexpected `1` space between cell edge and content, expected `0` spaces, remove `1` space - * 5:8: Unexpected `1` space between cell content and edge, expected `0` spaces, remove `1` space - * 5:10: Unexpected `1` space between cell edge and content, expected `0` spaces, remove `1` space - * 6:8: Unexpected `1` space between cell content and edge, expected `0` spaces, remove `1` space - * 6:10: Unexpected `1` space between cell edge and content, expected `0` spaces, remove `1` space - * 7:8: Unexpected `1` space between cell content and edge, expected `0` spaces, remove `1` space - * 7:10: Unexpected `1` space between cell edge and content, expected `0` spaces, remove `1` space - * - * @example - * {"config": "compact", "gfm": true, "label": "input", "name": "trailing-spaces.md"} - * - * Planet | Symbol␠ - * -: | -␠ - * Mercury | ☿␠␠ - * - * | Planet | Symbol |␠ - * | ------ | ------ |␠ - * | Venus | ♀ |␠␠ - * @example - * {"config": "compact", "gfm": true, "label": "output", "name": "trailing-spaces.md"} - * - * 1:8: Unexpected `1` space between cell content and edge, expected `0` spaces, remove `1` space - * 1:10: Unexpected `1` space between cell edge and content, expected `0` spaces, remove `1` space - * 2:4: Unexpected `1` space between cell content and edge, expected `0` spaces, remove `1` space - * 2:6: Unexpected `1` space between cell edge and content, expected `0` spaces, remove `1` space - * 3:9: Unexpected `1` space between cell content and edge, expected `0` spaces, remove `1` space - * 3:11: Unexpected `1` space between cell edge and content, expected `0` spaces, remove `1` space - * 5:3: Unexpected `1` space between cell edge and content, expected `0` spaces, remove `1` space - * 5:10: Unexpected `1` space between cell content and edge, expected `0` spaces, remove `1` space - * 5:12: Unexpected `1` space between cell edge and content, expected `0` spaces, remove `1` space - * 5:19: Unexpected `1` space between cell content and edge, expected `0` spaces, remove `1` space - * 6:3: Unexpected `1` space between cell edge and content, expected `0` spaces, remove `1` space - * 6:10: Unexpected `1` space between cell content and edge, expected `0` spaces, remove `1` space - * 6:12: Unexpected `1` space between cell edge and content, expected `0` spaces, remove `1` space - * 6:19: Unexpected `1` space between cell content and edge, expected `0` spaces, remove `1` space - * 7:3: Unexpected `1` space between cell edge and content, expected `0` spaces, remove `1` space - * 7:10: Unexpected `2` spaces between cell content and edge, expected between `0` (unaligned) and `1` (aligned) space, remove between `1` and `2` spaces - * 7:12: Unexpected `1` space between cell edge and content, expected `0` spaces, remove `1` space - * 7:19: Unexpected `6` spaces between cell content and edge, expected between `0` (unaligned) and `5` (aligned) spaces, remove between `1` and `6` spaces - * - * @example - * {"config": "compact", "gfm": true, "label": "input", "name": "nothing.md"} - * - * | | | | - * | - | - | - | - * | | | | - * @example - * {"config": "compact", "gfm": true, "label": "output", "name": "nothing.md"} - * - * 1:5: Unexpected `3` spaces between cell edge and content, expected between `0` (unaligned) and `1` (aligned) space, remove between `2` and `3` spaces - * 1:9: Unexpected `3` spaces between cell edge and content, expected between `0` (unaligned) and `1` (aligned) space, remove between `2` and `3` spaces - * 1:13: Unexpected `3` spaces between cell edge and content, expected between `0` (unaligned) and `1` (aligned) space, remove between `2` and `3` spaces - * 2:3: Unexpected `1` space between cell edge and content, expected `0` spaces, remove `1` space - * 2:5: Unexpected `1` space between cell content and edge, expected `0` spaces, remove `1` space - * 2:7: Unexpected `1` space between cell edge and content, expected `0` spaces, remove `1` space - * 2:9: Unexpected `1` space between cell content and edge, expected `0` spaces, remove `1` space - * 2:11: Unexpected `1` space between cell edge and content, expected `0` spaces, remove `1` space - * 2:13: Unexpected `1` space between cell content and edge, expected `0` spaces, remove `1` space - * 3:5: Unexpected `3` spaces between cell edge and content, expected between `0` (unaligned) and `1` (aligned) space, remove between `2` and `3` spaces - * 3:9: Unexpected `3` spaces between cell edge and content, expected between `0` (unaligned) and `1` (aligned) space, remove between `2` and `3` spaces - * 3:13: Unexpected `3` spaces between cell edge and content, expected between `0` (unaligned) and `1` (aligned) space, remove between `2` and `3` spaces - * - * @example - * {"config": "padded", "gfm": true, "label": "input", "name": "nothing.md"} - * - * |||| - * |-|-|-| - * |||| - * @example - * {"config": "padded", "gfm": true, "label": "output", "name": "nothing.md"} - * - * 1:2: Unexpected `0` spaces between cell edge and content, expected between `1` (unaligned) and `3` (aligned) spaces, add between `3` and `1` space - * 1:3: Unexpected `0` spaces between cell edge and content, expected between `1` (unaligned) and `3` (aligned) spaces, add between `3` and `1` space - * 1:4: Unexpected `0` spaces between cell edge and content, expected between `1` (unaligned) and `3` (aligned) spaces, add between `3` and `1` space - * 2:2: Unexpected `0` spaces between cell edge and content, expected `1` space, add `1` space - * 2:3: Unexpected `0` spaces between cell content and edge, expected `1` space, add `1` space - * 2:4: Unexpected `0` spaces between cell edge and content, expected `1` space, add `1` space - * 2:5: Unexpected `0` spaces between cell content and edge, expected `1` space, add `1` space - * 2:6: Unexpected `0` spaces between cell edge and content, expected `1` space, add `1` space - * 2:7: Unexpected `0` spaces between cell content and edge, expected `1` space, add `1` space - * 3:2: Unexpected `0` spaces between cell edge and content, expected between `1` (unaligned) and `3` (aligned) spaces, add between `3` and `1` space - * 3:3: Unexpected `0` spaces between cell edge and content, expected between `1` (unaligned) and `3` (aligned) spaces, add between `3` and `1` space - * 3:4: Unexpected `0` spaces between cell edge and content, expected between `1` (unaligned) and `3` (aligned) spaces, add between `3` and `1` space - * - * @example - * {"config": "padded", "gfm": true, "label": "input", "name": "more-weirdness.md"} - * - * Mercury - * |- - * - * Venus - * -| - * @example - * {"config": "padded", "gfm": true, "label": "output", "name": "more-weirdness.md"} - * - * 2:2: Unexpected `0` spaces between cell edge and content, expected `1` space, add `1` space - * 5:2: Unexpected `0` spaces between cell content and edge, expected between `1` (unaligned) and `5` (aligned) spaces, add between `5` and `1` space - * - * @example - * {"config": "padded", "gfm": true, "label": "input", "name": "containers.md"} - * - * > | Mercury| - * > | - | - * - * * | Venus| - * | - | - * - * > * > | Earth| - * > > | - | - * @example - * {"config": "padded", "gfm": true, "label": "output", "name": "containers.md"} - * - * 1:12: Unexpected `0` spaces between cell content and edge, expected `1` space, add `1` space - * 4:10: Unexpected `0` spaces between cell content and edge, expected `1` space, add `1` space - * 7:14: Unexpected `0` spaces between cell content and edge, expected `1` space, add `1` space - * - * @example - * {"config": "padded", "gfm": true, "label": "input", "name": "windows.md"} - * - * | Mercury|␍␊| --- |␍␊| None | - * @example - * {"config": "padded", "gfm": true, "label": "output", "name": "windows.md"} - * - * 1:10: Unexpected `0` spaces between cell content and edge, expected `1` space, add `1` space - * - * @example - * {"config": "🌍", "gfm": true, "label": "output", "name": "not-ok.md", "positionless": true} - * - * 1:1: Unexpected value `🌍` for `options`, expected `'compact'`, `'padded'`, or `'consistent'` - */ -const remarkLintTableCellPadding = lintRule$1( - { - origin: 'remark-lint:table-cell-padding', - url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-table-cell-padding#readme' - }, - function (tree, file, options) { - const value = String(file); - let expected; - let cause; - if (options === null || options === undefined || options === 'consistent') ; else if (options === 'compact' || options === 'padded') { - expected = options; - } else { - file.fail( - 'Unexpected value `' + - options + - "` for `options`, expected `'compact'`, `'padded'`, or `'consistent'`" - ); - } - visitParents(tree, function (table, parents) { - if (phrasing(table)) { - return SKIP - } - if (table.type !== 'table') return - const entries = inferTable([...parents, table]); - const sizes = []; - for (const entry of entries) { - if ( - entry.size && - (sizes[entry.column] === undefined || - entry.size.middle > sizes[entry.column]) - ) { - sizes[entry.column] = entry.size.middle; - } - } - if (!expected) { - for (const info of entries) { - if ( - info.size && - info.size.middle && - info.size.middle === sizes[info.column] - ) { - const node = info.ancestors.at(-1); - expected = info.size.left ? 'padded' : 'compact'; - cause = new VFileMessage( - "Cell padding style `'" + - expected + - "'` first defined for `'consistent'` here", - { - ancestors: info.ancestors, - place: node.position, - ruleId: 'table-cell-padding', - source: 'remark-lint' - } - ); - } - } - } - if (!expected) return - for (const info of entries) { - checkSide('left', info, sizes); - checkSide('right', info, sizes); - } - return SKIP - }); - function checkSide(side, info, sizes) { - if (!info.size) { - return - } - const actual = info.size[side]; - if (actual === undefined) { - return - } - const alignSpaces = sizes[info.column] - info.size.middle; - const min = expected === 'compact' ? 0 : 1; - let max = min; - if (info.align === 'center') { - max += Math.ceil(alignSpaces / 2); - } else if (info.align === 'right' ? side === 'left' : side === 'right') { - max += alignSpaces; - } - if (info.size.middle === 0) { - if (side === 'right') return - max = Math.max(max, sizes[info.column] + 2 * min); - } - if (actual < min || actual > max) { - const differenceMin = min - actual; - const differenceMinAbsolute = Math.abs(differenceMin); - const differenceMax = max - actual; - const differenceMaxAbsolute = Math.abs(differenceMax); - file.message( - 'Unexpected `' + - actual + - '` ' + - pluralize('space', actual) + - ' between cell ' + - (side === 'left' ? 'edge' : 'content') + - ' and ' + - (side === 'left' ? 'content' : 'edge') + - ', expected ' + - (min === max ? '' : 'between `' + min + '` (unaligned) and ') + - '`' + - max + - '` ' + - (min === max ? '' : '(aligned) ') + - pluralize('space', max) + - ', ' + - (differenceMin < 0 ? 'remove' : 'add') + - (differenceMin === differenceMax - ? '' - : ' between `' + differenceMaxAbsolute + '` and') + - ' `' + - differenceMinAbsolute + - '` ' + - pluralize('space', differenceMinAbsolute), - { - ancestors: info.ancestors, - cause, - place: side === 'left' ? info.size.leftPoint : info.size.rightPoint - } - ); - } - } - function inferTable(ancestors) { - const node = ancestors.at(-1); - ok$1(node.type === 'table'); - const align = node.align || []; - const result = []; - let rowIndex = -1; - while (++rowIndex < node.children.length) { - const row = node.children[rowIndex]; - let column = -1; - while (++column < row.children.length) { - const node = row.children[column]; - result.push({ - align: align[column], - ancestors: [...ancestors, row, node], - column, - size: inferSize( - pointStart(node), - pointEnd(node), - column === row.children.length - 1 - ) - }); - } - if (rowIndex === 0) { - const alignRow = inferAlignRow(ancestors, align); - if (alignRow) result.push(...alignRow); - } - } - return result - } - function inferAlignRow(ancestors, align) { - const node = ancestors.at(-1); - ok$1(node.type === 'table'); - const headEnd = pointEnd(node.children[0]); - if (!headEnd || typeof headEnd.offset !== 'number') return - let index = headEnd.offset; - if (value.charCodeAt(index) === 13 ) index++; - if (value.charCodeAt(index) !== 10 ) return - index++; - const result = []; - const line = headEnd.line + 1; - let code = value.charCodeAt(index); - while ( - code === 9 || - code === 32 || - code === 62 - ) { - index++; - code = value.charCodeAt(index); - } - if ( - code !== 45 && - code !== 58 && - code !== 124 - ) { - return - } - let lineEndOffset = value.indexOf('\n', index); - if (lineEndOffset === -1) lineEndOffset = value.length; - if (value.charCodeAt(lineEndOffset - 1) === 13 ) lineEndOffset--; - let column = 0; - let cellStart = index; - let cellEnd = value.indexOf('|', index + (code === 124 ? 1 : 0)); - if (cellEnd === -1 || cellEnd > lineEndOffset) { - cellEnd = lineEndOffset; - } - while (cellStart !== cellEnd) { - let nextCellEnd = value.indexOf('|', cellEnd + 1); - if (nextCellEnd === -1 || nextCellEnd > lineEndOffset) { - nextCellEnd = lineEndOffset; - } - if (nextCellEnd === lineEndOffset) { - let maybeEnd = lineEndOffset; - let code = value.charCodeAt(maybeEnd - 1); - while (code === 9 || code === 32 ) { - maybeEnd--; - code = value.charCodeAt(maybeEnd - 1); - } - if (cellEnd + 1 === maybeEnd) { - cellEnd = lineEndOffset; - } - } - result.push({ - align: align[column], - ancestors, - column, - size: inferSize( - { - line, - column: cellStart - index + 1, - offset: cellStart - }, - {line, column: cellEnd - index + 1, offset: cellEnd}, - cellEnd === lineEndOffset - ) - }); - cellStart = cellEnd; - cellEnd = nextCellEnd; - column++; - } - return result - } - function inferSize(start, end, tailCell) { - if ( - end && - start && - typeof end.offset === 'number' && - typeof start.offset === 'number' - ) { - let leftIndex = start.offset; - let left; - let right; - if (value.charCodeAt(leftIndex) === 124 ) { - left = 0; - leftIndex++; - while (value.charCodeAt(leftIndex) === 32) { - left++; - leftIndex++; - } - } - let rightIndex = end.offset; - if (tailCell) { - while (value.charCodeAt(rightIndex - 1) === 32) { - rightIndex--; - } - if ( - rightIndex > leftIndex && - value.charCodeAt(rightIndex - 1) === 124 - ) { - rightIndex--; - } - else { - rightIndex = end.offset; - } - } - const rightEdgeIndex = rightIndex; - if (value.charCodeAt(rightIndex) === 124 ) { - right = 0; - while ( - rightIndex - 1 > leftIndex && - value.charCodeAt(rightIndex - 1) === 32 - ) { - right++; - rightIndex--; - } - } - return { - left, - leftPoint: { - line: start.line, - column: start.column + (leftIndex - start.offset), - offset: leftIndex - }, - middle: rightIndex - leftIndex, - right, - rightPoint: { - line: end.line, - column: end.column - (end.offset - rightEdgeIndex), - offset: rightEdgeIndex - } - } - } - } - } -); - -/** - * remark-lint rule to warn when GFM table rows have no initial or - * final cell delimiter. - * - * ## What is this? - * - * This package checks that table rows have initial and final delimiters. - * Tables are a GFM feature enabled with [`remark-gfm`][github-remark-gfm]. - * - * ## When should I use this? - * - * You can use this package to check that tables are consistent. - * - * ## API - * - * ### `unified().use(remarkLintTablePipes)` - * - * Warn when GFM table rows have no initial or final cell delimiter. - * - * ###### Parameters - * - * There are no options. - * - * ###### Returns - * - * Transform ([`Transformer` from `unified`][github-unified-transformer]). - * - * ## Recommendation - * - * While tables don’t require initial or final delimiters (the pipes before the - * first and after the last cells in a row), - * it arguably does look weird without. - * - * ## Fix - * - * [`remark-stringify`][github-remark-stringify] with - * [`remark-gfm`][github-remark-gfm] formats all tables with initial and final - * delimiters. - * - * [api-remark-lint-table-pipes]: #unifieduseremarklinttablepipes - * [github-remark-gfm]: https://github.com/remarkjs/remark-gfm - * [github-remark-stringify]: https://github.com/remarkjs/remark/tree/main/packages/remark-stringify - * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer - * - * @module table-pipes - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * - * @example - * {"name": "ok.md", "gfm": true} - * - * Small table: - * - * | Planet | Mean anomaly (°) | - * | :- | -: | - * | Mercury | 174 796 | - * - * @example - * {"name": "not-ok.md", "label": "input", "gfm": true} - * - * Planet | Mean anomaly (°) - * :- | -: - * Mercury | 174 796 - * @example - * {"name": "not-ok.md", "label": "output", "gfm": true} - * - * 1:1: Unexpected missing closing pipe in row, expected `|` - * 1:26: Unexpected missing opening pipe in row, expected `|` - * 2:1: Unexpected missing closing pipe in row, expected `|` - * 2:8: Unexpected missing opening pipe in row, expected `|` - * 3:1: Unexpected missing closing pipe in row, expected `|` - * 3:18: Unexpected missing opening pipe in row, expected `|` - * - * @example - * {"gfm": true, "label": "input", "name": "missing-cells.md"} - * - * Planet | Symbol | Satellites - * :- | - | - - * Mercury - * Venus | ♀ - * Earth | ♁ | 1 - * Mars | ♂ | 2 | 19 412 - * @example - * {"gfm": true, "label": "output", "name": "missing-cells.md"} - * - * 1:1: Unexpected missing closing pipe in row, expected `|` - * 1:29: Unexpected missing opening pipe in row, expected `|` - * 2:1: Unexpected missing closing pipe in row, expected `|` - * 2:11: Unexpected missing opening pipe in row, expected `|` - * 3:1: Unexpected missing closing pipe in row, expected `|` - * 3:8: Unexpected missing opening pipe in row, expected `|` - * 4:1: Unexpected missing closing pipe in row, expected `|` - * 4:10: Unexpected missing opening pipe in row, expected `|` - * 5:1: Unexpected missing closing pipe in row, expected `|` - * 5:14: Unexpected missing opening pipe in row, expected `|` - * 6:1: Unexpected missing closing pipe in row, expected `|` - * 6:22: Unexpected missing opening pipe in row, expected `|` - * - * @example - * {"gfm": true, "label": "input", "name": "trailing-spaces.md"} - * - * ␠␠Planet␠␠ - * ␠-:␠ - * - * ␠␠| Planet |␠␠ - * ␠| -: |␠ - * @example - * {"gfm": true, "label": "output", "name": "trailing-spaces.md"} - * - * 1:3: Unexpected missing closing pipe in row, expected `|` - * 1:11: Unexpected missing opening pipe in row, expected `|` - * 2:2: Unexpected missing closing pipe in row, expected `|` - * 2:5: Unexpected missing opening pipe in row, expected `|` - * - * @example - * {"gfm": true, "label": "input", "name": "windows.md"} - * - * Mercury␍␊:-␍␊None - * @example - * {"gfm": true, "label": "output", "name": "windows.md"} - * - * 1:1: Unexpected missing closing pipe in row, expected `|` - * 1:8: Unexpected missing opening pipe in row, expected `|` - * 2:1: Unexpected missing closing pipe in row, expected `|` - * 2:3: Unexpected missing opening pipe in row, expected `|` - * 3:1: Unexpected missing closing pipe in row, expected `|` - * 3:5: Unexpected missing opening pipe in row, expected `|` - */ -const remarkLintTablePipes = lintRule$1( - { - origin: 'remark-lint:table-pipes', - url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-table-pipes#readme' - }, - function (tree, file) { - const value = String(file); - visitParents(tree, function (node, parents) { - if (phrasing(node)) { - return SKIP - } - if (node.type !== 'table') return - let index = -1; - while (++index < node.children.length) { - const row = node.children[index]; - const start = pointStart(row); - const end = pointEnd(row); - if (start && typeof start.offset === 'number') { - checkStart(start.offset, start, [...parents, node, row]); - } - if (end && typeof end.offset === 'number') { - checkEnd(end.offset, end, [...parents, node, row]); - if (index === 0) { - let index = end.offset; - if (value.charCodeAt(index) === 13 ) index++; - if (value.charCodeAt(index) !== 10 ) continue - index++; - const lineStart = index; - let code = value.charCodeAt(index); - while ( - code === 9 || - code === 32 || - code === 62 - ) { - index++; - code = value.charCodeAt(index); - } - checkStart( - index, - { - line: end.line + 1, - column: index - lineStart + 1, - offset: index - }, - [...parents, node] - ); - index = value.indexOf('\n', index); - if (index === -1) index = value.length; - if (value.charCodeAt(index - 1) === 13 ) index--; - checkEnd( - index, - { - line: end.line + 1, - column: index - lineStart + 1, - offset: index - }, - [...parents, node] - ); - } - } - } - return SKIP - }); - function checkStart(index, place, ancestors) { - let code = value.charCodeAt(index); - while (code === 9 || code === 32 ) { - code = value.charCodeAt(++index); - } - if (code !== 124 ) { - file.message('Unexpected missing closing pipe in row, expected `|`', { - ancestors, - place - }); - } - } - function checkEnd(index, place, ancestors) { - let code = value.charCodeAt(index - 1); - while (code === 9 || code === 32 ) { - index--; - code = value.charCodeAt(index - 1); - } - if (code !== 124 ) { - file.message('Unexpected missing opening pipe in row, expected `|`', { - ancestors, - place - }); - } - } - } -); - -/** - * remark-lint rule to warn when unordered list markers are inconsistent. - * - * ## What is this? - * - * This package checks unordered list markers. - * - * ## When should I use this? - * - * You can use this package to check unordered lists. - * - * ## API - * - * ### `unified().use(remarkLintUnorderedListMarkerStyle[, options])` - * - * Warn when unordered list markers are inconsistent. - * - * ###### Parameters - * - * * `options` ([`Options`][api-options], default: `'consistent'`) - * — preferred style or whether to detect the first style and warn for - * further differences - * - * ###### Returns - * - * Transform ([`Transformer` from `unified`][github-unified-transformer]). - * - * ### `Options` - * - * Configuration (TypeScript type). - * - * ###### Type - * - * ```ts - * type Options = Style | 'consistent' - * ``` - * - * ### `Style` - * - * Style (TypeScript type). - * - * ###### Type - * - * ```ts - * type Style = '*' | '+' | '-' - * ``` - * - * ## Recommendation - * - * Because asterisks can be used as a marker for more markdown constructs, - * it’s recommended to use that for lists (and thematic breaks, emphasis, - * strong) too. - * - * ## Fix - * - * [`remark-stringify`][github-remark-stringify] formats unordered lists with - * asterisks by default. - * Pass `bullet: '+'` or `bullet: '-'` to use a different marker. - * - * [api-options]: #options - * [api-style]: #style - * [api-remark-lint-unordered-list-marker-style]: #unifieduseremarklintunorderedlistmarkerstyle-options - * [github-remark-stringify]: https://github.com/remarkjs/remark/tree/main/packages/remark-stringify - * [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer - * - * @module unordered-list-marker-style - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @example - * {"name": "ok.md"} - * - * * Mercury - * - * 1. Venus - * - * * Earth - * - * @example - * {"name": "ok.md", "config": "*"} - * - * * Mercury - * - * @example - * {"name": "ok.md", "config": "-"} - * - * - Mercury - * - * @example - * {"name": "ok.md", "config": "+"} - * - * + Mercury - * - * @example - * {"name": "not-ok.md", "label": "input"} - * - * * Mercury - * - * - Venus - * - * + Earth - * @example - * {"name": "not-ok.md", "label": "output"} - * - * 3:1: Unexpected unordered list marker `-`, expected `*` - * 5:1: Unexpected unordered list marker `+`, expected `*` - * - * @example - * {"name": "not-ok.md", "label": "output", "config": "🌍", "positionless": true} - * - * 1:1: Unexpected value `🌍` for `options`, expected `'*'`, `'+'`, `'-'`, or `'consistent'` - */ -const remarkLintUnorderedListMarkerStyle = lintRule$1( - { - origin: 'remark-lint:unordered-list-marker-style', - url: 'https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-unordered-list-marker-style#readme' - }, - function (tree, file, options) { - const value = String(file); - let expected; - let cause; - if (options === null || options === undefined || options === 'consistent') ; else if (options === '*' || options === '+' || options === '-') { - expected = options; - } else { - file.fail( - 'Unexpected value `' + - options + - "` for `options`, expected `'*'`, `'+'`, `'-'`, or `'consistent'`" - ); - } - visitParents(tree, function (node, parents) { - if (phrasing(node)) { - return SKIP - } - if (node.type !== 'listItem') return - const parent = parents.at(-1); - if (!parent || parent.type !== 'list' || parent.ordered) return - const place = pointStart(node); - if (!place || typeof place.offset !== 'number') return - const code = value.charCodeAt(place.offset); - const actual = - code === 42 - ? '*' - : code === 43 - ? '+' - : code === 45 - ? '-' - : - undefined; - if (!actual) return - if (expected) { - if (actual !== expected) { - file.message( - 'Unexpected unordered list marker `' + - actual + - '`, expected `' + - expected + - '`', - {ancestors: [...parents, node], cause, place} - ); - } - } else { - expected = actual; - cause = new VFileMessage( - 'Unordered list marker style `' + - expected + - "` first defined for `'consistent'` here", - { - ancestors: [...parents, node], - place, - ruleId: 'unordered-list-marker-style', - source: 'remark-lint' - } - ); - } - }); - } -); - -const plugins = [ - remarkGfm, - remarkPresetLintRecommended, - [remarkLintBlockquoteIndentation, 2], - [remarkLintCheckboxCharacterStyle, { checked: "x", unchecked: " " }], - remarkLintCheckboxContentIndent, - [remarkLintCodeBlockStyle, "fenced"], - remarkLintDefinitionSpacing, - [ - remarkLintFencedCodeFlag, - { - flags: [ - "bash", - "c", - "cjs", - "coffee", - "console", - "cpp", - "diff", - "http", - "js", - "json", - "markdown", - "mjs", - "powershell", - "r", - "text", - "ts", - ], - }, - ], - [remarkLintFencedCodeMarker, "`"], - [remarkLintFileExtension, "md"], - remarkLintFinalDefinition, - [remarkLintFirstHeadingLevel, 1], - [remarkLintHeadingStyle, "atx"], - [remarkLintMaximumLineLength, 120], - remarkLintNoConsecutiveBlankLines, - remarkLintNoFileNameArticles, - remarkLintNoFileNameConsecutiveDashes, - remarkLintNofileNameOuterDashes, - remarkLintNoHeadingIndent, - remarkLintNoMultipleToplevelHeadings, - remarkLintNoShellDollars, - remarkLintNoTableIndentation, - remarkLintNoTabs, - rule, - remarkLintNodejsLinks, - remarkLintNodejsYamlComments, - [ - remarkLintProhibitedStrings, - [ - { yes: "End-of-Life" }, - { no: "filesystem", yes: "file system" }, - { yes: "GitHub" }, - { no: "hostname", yes: "host name" }, - { yes: "JavaScript" }, - { no: "[Ll]ong[ -][Tt]erm [Ss]upport", yes: "Long Term Support" }, - { no: "Node", yes: "Node.js", ignoreNextTo: "-API" }, - { yes: "Node.js" }, - { no: "Node[Jj][Ss]", yes: "Node.js" }, - { no: "Node\\.js's?", yes: "the Node.js" }, - { no: "[Nn]ote that", yes: "" }, - { yes: "RFC" }, - { no: "[Rr][Ff][Cc]\\d+", yes: "RFC " }, - { yes: "TypeScript" }, - { yes: "Unix" }, - { yes: "Valgrind" }, - { yes: "V8" }, - ], - ], - remarkLintRuleStyle, - [remarkLintStrongMarker, "*"], - [remarkLintTableCellPadding, "padded"], - remarkLintTablePipes, - [remarkLintUnorderedListMarkerStyle, "*"], -]; -const settings = { - emphasis: "_", - tightDefinitions: true, -}; -const remarkPresetLintNode = { plugins, settings }; - -function read(description, options, callback) { - const file = toVFile(description); - { - return new Promise(executor) - } - function executor(resolve, reject) { - let fp; - try { - fp = minpath.resolve(file.cwd, file.path); - } catch (error) { - const exception = (error); - return reject(exception) - } - fs$1.readFile(fp, options, done); - function done(error, result) { - if (error) { - reject(error); - } else { - file.value = result; - resolve(file); - } - } - } -} -function toVFile(description) { - if (typeof description === 'string' || description instanceof URL) { - description = {path: description}; - } else if (isUint8Array(description)) { - description = {path: new TextDecoder().decode(description)}; - } - return looksLikeAVFile(description) ? description : new VFile(description) -} -function looksLikeAVFile(value) { - return Boolean( - value && - typeof value === 'object' && - 'message' in value && - 'messages' in value - ) -} -function isUint8Array(value) { - return Boolean( - value && - typeof value === 'object' && - 'byteLength' in value && - 'byteOffset' in value - ) -} - -function ansiRegex({onlyFirst = false} = {}) { - const ST = '(?:\\u0007|\\u001B\\u005C|\\u009C)'; - const pattern = [ - `[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`, - '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))', - ].join('|'); - return new RegExp(pattern, onlyFirst ? undefined : 'g'); -} - -const regex = ansiRegex(); -function stripAnsi(string) { - if (typeof string !== 'string') { - throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``); - } - return string.replace(regex, ''); -} - -var eastasianwidth = {exports: {}}; - -var hasRequiredEastasianwidth; -function requireEastasianwidth () { - if (hasRequiredEastasianwidth) return eastasianwidth.exports; - hasRequiredEastasianwidth = 1; - (function (module) { - var eaw = {}; - { - module.exports = eaw; - } - eaw.eastAsianWidth = function(character) { - var x = character.charCodeAt(0); - var y = (character.length == 2) ? character.charCodeAt(1) : 0; - var codePoint = x; - if ((0xD800 <= x && x <= 0xDBFF) && (0xDC00 <= y && y <= 0xDFFF)) { - x &= 0x3FF; - y &= 0x3FF; - codePoint = (x << 10) | y; - codePoint += 0x10000; - } - if ((0x3000 == codePoint) || - (0xFF01 <= codePoint && codePoint <= 0xFF60) || - (0xFFE0 <= codePoint && codePoint <= 0xFFE6)) { - return 'F'; - } - if ((0x20A9 == codePoint) || - (0xFF61 <= codePoint && codePoint <= 0xFFBE) || - (0xFFC2 <= codePoint && codePoint <= 0xFFC7) || - (0xFFCA <= codePoint && codePoint <= 0xFFCF) || - (0xFFD2 <= codePoint && codePoint <= 0xFFD7) || - (0xFFDA <= codePoint && codePoint <= 0xFFDC) || - (0xFFE8 <= codePoint && codePoint <= 0xFFEE)) { - return 'H'; - } - if ((0x1100 <= codePoint && codePoint <= 0x115F) || - (0x11A3 <= codePoint && codePoint <= 0x11A7) || - (0x11FA <= codePoint && codePoint <= 0x11FF) || - (0x2329 <= codePoint && codePoint <= 0x232A) || - (0x2E80 <= codePoint && codePoint <= 0x2E99) || - (0x2E9B <= codePoint && codePoint <= 0x2EF3) || - (0x2F00 <= codePoint && codePoint <= 0x2FD5) || - (0x2FF0 <= codePoint && codePoint <= 0x2FFB) || - (0x3001 <= codePoint && codePoint <= 0x303E) || - (0x3041 <= codePoint && codePoint <= 0x3096) || - (0x3099 <= codePoint && codePoint <= 0x30FF) || - (0x3105 <= codePoint && codePoint <= 0x312D) || - (0x3131 <= codePoint && codePoint <= 0x318E) || - (0x3190 <= codePoint && codePoint <= 0x31BA) || - (0x31C0 <= codePoint && codePoint <= 0x31E3) || - (0x31F0 <= codePoint && codePoint <= 0x321E) || - (0x3220 <= codePoint && codePoint <= 0x3247) || - (0x3250 <= codePoint && codePoint <= 0x32FE) || - (0x3300 <= codePoint && codePoint <= 0x4DBF) || - (0x4E00 <= codePoint && codePoint <= 0xA48C) || - (0xA490 <= codePoint && codePoint <= 0xA4C6) || - (0xA960 <= codePoint && codePoint <= 0xA97C) || - (0xAC00 <= codePoint && codePoint <= 0xD7A3) || - (0xD7B0 <= codePoint && codePoint <= 0xD7C6) || - (0xD7CB <= codePoint && codePoint <= 0xD7FB) || - (0xF900 <= codePoint && codePoint <= 0xFAFF) || - (0xFE10 <= codePoint && codePoint <= 0xFE19) || - (0xFE30 <= codePoint && codePoint <= 0xFE52) || - (0xFE54 <= codePoint && codePoint <= 0xFE66) || - (0xFE68 <= codePoint && codePoint <= 0xFE6B) || - (0x1B000 <= codePoint && codePoint <= 0x1B001) || - (0x1F200 <= codePoint && codePoint <= 0x1F202) || - (0x1F210 <= codePoint && codePoint <= 0x1F23A) || - (0x1F240 <= codePoint && codePoint <= 0x1F248) || - (0x1F250 <= codePoint && codePoint <= 0x1F251) || - (0x20000 <= codePoint && codePoint <= 0x2F73F) || - (0x2B740 <= codePoint && codePoint <= 0x2FFFD) || - (0x30000 <= codePoint && codePoint <= 0x3FFFD)) { - return 'W'; - } - if ((0x0020 <= codePoint && codePoint <= 0x007E) || - (0x00A2 <= codePoint && codePoint <= 0x00A3) || - (0x00A5 <= codePoint && codePoint <= 0x00A6) || - (0x00AC == codePoint) || - (0x00AF == codePoint) || - (0x27E6 <= codePoint && codePoint <= 0x27ED) || - (0x2985 <= codePoint && codePoint <= 0x2986)) { - return 'Na'; - } - if ((0x00A1 == codePoint) || - (0x00A4 == codePoint) || - (0x00A7 <= codePoint && codePoint <= 0x00A8) || - (0x00AA == codePoint) || - (0x00AD <= codePoint && codePoint <= 0x00AE) || - (0x00B0 <= codePoint && codePoint <= 0x00B4) || - (0x00B6 <= codePoint && codePoint <= 0x00BA) || - (0x00BC <= codePoint && codePoint <= 0x00BF) || - (0x00C6 == codePoint) || - (0x00D0 == codePoint) || - (0x00D7 <= codePoint && codePoint <= 0x00D8) || - (0x00DE <= codePoint && codePoint <= 0x00E1) || - (0x00E6 == codePoint) || - (0x00E8 <= codePoint && codePoint <= 0x00EA) || - (0x00EC <= codePoint && codePoint <= 0x00ED) || - (0x00F0 == codePoint) || - (0x00F2 <= codePoint && codePoint <= 0x00F3) || - (0x00F7 <= codePoint && codePoint <= 0x00FA) || - (0x00FC == codePoint) || - (0x00FE == codePoint) || - (0x0101 == codePoint) || - (0x0111 == codePoint) || - (0x0113 == codePoint) || - (0x011B == codePoint) || - (0x0126 <= codePoint && codePoint <= 0x0127) || - (0x012B == codePoint) || - (0x0131 <= codePoint && codePoint <= 0x0133) || - (0x0138 == codePoint) || - (0x013F <= codePoint && codePoint <= 0x0142) || - (0x0144 == codePoint) || - (0x0148 <= codePoint && codePoint <= 0x014B) || - (0x014D == codePoint) || - (0x0152 <= codePoint && codePoint <= 0x0153) || - (0x0166 <= codePoint && codePoint <= 0x0167) || - (0x016B == codePoint) || - (0x01CE == codePoint) || - (0x01D0 == codePoint) || - (0x01D2 == codePoint) || - (0x01D4 == codePoint) || - (0x01D6 == codePoint) || - (0x01D8 == codePoint) || - (0x01DA == codePoint) || - (0x01DC == codePoint) || - (0x0251 == codePoint) || - (0x0261 == codePoint) || - (0x02C4 == codePoint) || - (0x02C7 == codePoint) || - (0x02C9 <= codePoint && codePoint <= 0x02CB) || - (0x02CD == codePoint) || - (0x02D0 == codePoint) || - (0x02D8 <= codePoint && codePoint <= 0x02DB) || - (0x02DD == codePoint) || - (0x02DF == codePoint) || - (0x0300 <= codePoint && codePoint <= 0x036F) || - (0x0391 <= codePoint && codePoint <= 0x03A1) || - (0x03A3 <= codePoint && codePoint <= 0x03A9) || - (0x03B1 <= codePoint && codePoint <= 0x03C1) || - (0x03C3 <= codePoint && codePoint <= 0x03C9) || - (0x0401 == codePoint) || - (0x0410 <= codePoint && codePoint <= 0x044F) || - (0x0451 == codePoint) || - (0x2010 == codePoint) || - (0x2013 <= codePoint && codePoint <= 0x2016) || - (0x2018 <= codePoint && codePoint <= 0x2019) || - (0x201C <= codePoint && codePoint <= 0x201D) || - (0x2020 <= codePoint && codePoint <= 0x2022) || - (0x2024 <= codePoint && codePoint <= 0x2027) || - (0x2030 == codePoint) || - (0x2032 <= codePoint && codePoint <= 0x2033) || - (0x2035 == codePoint) || - (0x203B == codePoint) || - (0x203E == codePoint) || - (0x2074 == codePoint) || - (0x207F == codePoint) || - (0x2081 <= codePoint && codePoint <= 0x2084) || - (0x20AC == codePoint) || - (0x2103 == codePoint) || - (0x2105 == codePoint) || - (0x2109 == codePoint) || - (0x2113 == codePoint) || - (0x2116 == codePoint) || - (0x2121 <= codePoint && codePoint <= 0x2122) || - (0x2126 == codePoint) || - (0x212B == codePoint) || - (0x2153 <= codePoint && codePoint <= 0x2154) || - (0x215B <= codePoint && codePoint <= 0x215E) || - (0x2160 <= codePoint && codePoint <= 0x216B) || - (0x2170 <= codePoint && codePoint <= 0x2179) || - (0x2189 == codePoint) || - (0x2190 <= codePoint && codePoint <= 0x2199) || - (0x21B8 <= codePoint && codePoint <= 0x21B9) || - (0x21D2 == codePoint) || - (0x21D4 == codePoint) || - (0x21E7 == codePoint) || - (0x2200 == codePoint) || - (0x2202 <= codePoint && codePoint <= 0x2203) || - (0x2207 <= codePoint && codePoint <= 0x2208) || - (0x220B == codePoint) || - (0x220F == codePoint) || - (0x2211 == codePoint) || - (0x2215 == codePoint) || - (0x221A == codePoint) || - (0x221D <= codePoint && codePoint <= 0x2220) || - (0x2223 == codePoint) || - (0x2225 == codePoint) || - (0x2227 <= codePoint && codePoint <= 0x222C) || - (0x222E == codePoint) || - (0x2234 <= codePoint && codePoint <= 0x2237) || - (0x223C <= codePoint && codePoint <= 0x223D) || - (0x2248 == codePoint) || - (0x224C == codePoint) || - (0x2252 == codePoint) || - (0x2260 <= codePoint && codePoint <= 0x2261) || - (0x2264 <= codePoint && codePoint <= 0x2267) || - (0x226A <= codePoint && codePoint <= 0x226B) || - (0x226E <= codePoint && codePoint <= 0x226F) || - (0x2282 <= codePoint && codePoint <= 0x2283) || - (0x2286 <= codePoint && codePoint <= 0x2287) || - (0x2295 == codePoint) || - (0x2299 == codePoint) || - (0x22A5 == codePoint) || - (0x22BF == codePoint) || - (0x2312 == codePoint) || - (0x2460 <= codePoint && codePoint <= 0x24E9) || - (0x24EB <= codePoint && codePoint <= 0x254B) || - (0x2550 <= codePoint && codePoint <= 0x2573) || - (0x2580 <= codePoint && codePoint <= 0x258F) || - (0x2592 <= codePoint && codePoint <= 0x2595) || - (0x25A0 <= codePoint && codePoint <= 0x25A1) || - (0x25A3 <= codePoint && codePoint <= 0x25A9) || - (0x25B2 <= codePoint && codePoint <= 0x25B3) || - (0x25B6 <= codePoint && codePoint <= 0x25B7) || - (0x25BC <= codePoint && codePoint <= 0x25BD) || - (0x25C0 <= codePoint && codePoint <= 0x25C1) || - (0x25C6 <= codePoint && codePoint <= 0x25C8) || - (0x25CB == codePoint) || - (0x25CE <= codePoint && codePoint <= 0x25D1) || - (0x25E2 <= codePoint && codePoint <= 0x25E5) || - (0x25EF == codePoint) || - (0x2605 <= codePoint && codePoint <= 0x2606) || - (0x2609 == codePoint) || - (0x260E <= codePoint && codePoint <= 0x260F) || - (0x2614 <= codePoint && codePoint <= 0x2615) || - (0x261C == codePoint) || - (0x261E == codePoint) || - (0x2640 == codePoint) || - (0x2642 == codePoint) || - (0x2660 <= codePoint && codePoint <= 0x2661) || - (0x2663 <= codePoint && codePoint <= 0x2665) || - (0x2667 <= codePoint && codePoint <= 0x266A) || - (0x266C <= codePoint && codePoint <= 0x266D) || - (0x266F == codePoint) || - (0x269E <= codePoint && codePoint <= 0x269F) || - (0x26BE <= codePoint && codePoint <= 0x26BF) || - (0x26C4 <= codePoint && codePoint <= 0x26CD) || - (0x26CF <= codePoint && codePoint <= 0x26E1) || - (0x26E3 == codePoint) || - (0x26E8 <= codePoint && codePoint <= 0x26FF) || - (0x273D == codePoint) || - (0x2757 == codePoint) || - (0x2776 <= codePoint && codePoint <= 0x277F) || - (0x2B55 <= codePoint && codePoint <= 0x2B59) || - (0x3248 <= codePoint && codePoint <= 0x324F) || - (0xE000 <= codePoint && codePoint <= 0xF8FF) || - (0xFE00 <= codePoint && codePoint <= 0xFE0F) || - (0xFFFD == codePoint) || - (0x1F100 <= codePoint && codePoint <= 0x1F10A) || - (0x1F110 <= codePoint && codePoint <= 0x1F12D) || - (0x1F130 <= codePoint && codePoint <= 0x1F169) || - (0x1F170 <= codePoint && codePoint <= 0x1F19A) || - (0xE0100 <= codePoint && codePoint <= 0xE01EF) || - (0xF0000 <= codePoint && codePoint <= 0xFFFFD) || - (0x100000 <= codePoint && codePoint <= 0x10FFFD)) { - return 'A'; - } - return 'N'; - }; - eaw.characterLength = function(character) { - var code = this.eastAsianWidth(character); - if (code == 'F' || code == 'W' || code == 'A') { - return 2; - } else { - return 1; - } - }; - function stringToArray(string) { - return string.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || []; - } - eaw.length = function(string) { - var characters = stringToArray(string); - var len = 0; - for (var i = 0; i < characters.length; i++) { - len = len + this.characterLength(characters[i]); - } - return len; - }; - eaw.slice = function(text, start, end) { - textLen = eaw.length(text); - start = start ? start : 0; - end = end ? end : 1; - if (start < 0) { - start = textLen + start; - } - if (end < 0) { - end = textLen + end; - } - var result = ''; - var eawLen = 0; - var chars = stringToArray(text); - for (var i = 0; i < chars.length; i++) { - var char = chars[i]; - var charLen = eaw.length(char); - if (eawLen >= start - (charLen == 2 ? 1 : 0)) { - if (eawLen + charLen <= end) { - result += char; - } else { - break; - } - } - eawLen += charLen; - } - return result; - }; - } (eastasianwidth)); - return eastasianwidth.exports; -} - -var eastasianwidthExports = requireEastasianwidth(); -var eastAsianWidth = /*@__PURE__*/getDefaultExportFromCjs(eastasianwidthExports); - -var emojiRegex = () => { - return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g; -}; - -function stringWidth(string, options) { - if (typeof string !== 'string' || string.length === 0) { - return 0; - } - options = { - ambiguousIsNarrow: true, - countAnsiEscapeCodes: false, - ...options, - }; - if (!options.countAnsiEscapeCodes) { - string = stripAnsi(string); - } - if (string.length === 0) { - return 0; - } - const ambiguousCharacterWidth = options.ambiguousIsNarrow ? 1 : 2; - let width = 0; - for (const {segment: character} of new Intl.Segmenter().segment(string)) { - const codePoint = character.codePointAt(0); - if (codePoint <= 0x1F || (codePoint >= 0x7F && codePoint <= 0x9F)) { - continue; - } - if (codePoint >= 0x3_00 && codePoint <= 0x3_6F) { - continue; - } - if (emojiRegex().test(character)) { - width += 2; - continue; - } - const code = eastAsianWidth.eastAsianWidth(character); - switch (code) { - case 'F': - case 'W': { - width += 2; - break; - } - case 'A': { - width += ambiguousCharacterWidth; - break; - } - default: { - width += 1; - } - } - } - return width; -} - -function compareFile(a, b) { - return compareString(a, b, 'path') -} -function compareMessage(a, b) { - return ( - compareNumber(a, b, 'line') || - compareNumber(a, b, 'column') || - compareBoolean(a, b, 'fatal') || - compareString(a, b, 'source') || - compareString(a, b, 'ruleId') || - compareString(a, b, 'reason') - ) -} -function compareBoolean(a, b, field) { - return scoreNullableBoolean(a[field]) - scoreNullableBoolean(b[field]) -} -function compareNumber(a, b, field) { - return (a[field] || 0) - (b[field] || 0) -} -function compareString(a, b, field) { - return String(a[field] || '').localeCompare(String(b[field] || '')) -} -function scoreNullableBoolean(value) { - return value ? 0 : value === false ? 1 : 2 -} - -function statistics(value) { - const result = {fatal: 0, warn: 0, info: 0}; - if (!value) { - throw new TypeError( - 'Expected file or message for `value`, not `' + value + '`' - ) - } - if (Array.isArray(value)) { - list(value); - } else { - one(value); - } - return { - fatal: result.fatal, - nonfatal: result.warn + result.info, - warn: result.warn, - info: result.info, - total: result.fatal + result.warn + result.info - } - function list(value) { - let index = -1; - while (++index < value.length) { - one(value[index]); - } - } - function one(value) { - if ('messages' in value) return list(value.messages) - result[value.fatal ? 'fatal' : value.fatal === false ? 'warn' : 'info']++; - } -} - -function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process$1.argv) { - const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--'); - const position = argv.indexOf(prefix + flag); - const terminatorPosition = argv.indexOf('--'); - return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition); -} -const {env} = process$1; -let flagForceColor; -if ( - hasFlag('no-color') - || hasFlag('no-colors') - || hasFlag('color=false') - || hasFlag('color=never') -) { - flagForceColor = 0; -} else if ( - hasFlag('color') - || hasFlag('colors') - || hasFlag('color=true') - || hasFlag('color=always') -) { - flagForceColor = 1; -} -function envForceColor() { - if ('FORCE_COLOR' in env) { - if (env.FORCE_COLOR === 'true') { - return 1; - } - if (env.FORCE_COLOR === 'false') { - return 0; - } - return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3); - } -} -function translateLevel(level) { - if (level === 0) { - return false; - } - return { - level, - hasBasic: true, - has256: level >= 2, - has16m: level >= 3, - }; -} -function _supportsColor(haveStream, {streamIsTTY, sniffFlags = true} = {}) { - const noFlagForceColor = envForceColor(); - if (noFlagForceColor !== undefined) { - flagForceColor = noFlagForceColor; - } - const forceColor = sniffFlags ? flagForceColor : noFlagForceColor; - if (forceColor === 0) { - return 0; - } - if (sniffFlags) { - if (hasFlag('color=16m') - || hasFlag('color=full') - || hasFlag('color=truecolor')) { - return 3; - } - if (hasFlag('color=256')) { - return 2; - } - } - if ('TF_BUILD' in env && 'AGENT_NAME' in env) { - return 1; - } - if (haveStream && !streamIsTTY && forceColor === undefined) { - return 0; - } - const min = forceColor || 0; - if (env.TERM === 'dumb') { - return min; - } - if (process$1.platform === 'win32') { - const osRelease = os.release().split('.'); - if ( - Number(osRelease[0]) >= 10 - && Number(osRelease[2]) >= 10_586 - ) { - return Number(osRelease[2]) >= 14_931 ? 3 : 2; - } - return 1; - } - if ('CI' in env) { - if ('GITHUB_ACTIONS' in env || 'GITEA_ACTIONS' in env) { - return 3; - } - if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'BUILDKITE', 'DRONE'].some(sign => sign in env) || env.CI_NAME === 'codeship') { - return 1; - } - return min; - } - if ('TEAMCITY_VERSION' in env) { - return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; - } - if (env.COLORTERM === 'truecolor') { - return 3; - } - if (env.TERM === 'xterm-kitty') { - return 3; - } - if ('TERM_PROGRAM' in env) { - const version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); - switch (env.TERM_PROGRAM) { - case 'iTerm.app': { - return version >= 3 ? 3 : 2; - } - case 'Apple_Terminal': { - return 2; - } - } - } - if (/-256(color)?$/i.test(env.TERM)) { - return 2; - } - if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { - return 1; - } - if ('COLORTERM' in env) { - return 1; - } - return min; -} -function createSupportsColor(stream, options = {}) { - const level = _supportsColor(stream, { - streamIsTTY: stream && stream.isTTY, - ...options, - }); - return translateLevel(level); -} -const supportsColor = { - stdout: createSupportsColor({isTTY: tty.isatty(1)}), - stderr: createSupportsColor({isTTY: tty.isatty(2)}), -}; - -const color = supportsColor.stderr.hasBasic; - -const eol = /\r?\n|\r/; -function reporter(files, options) { - if ( - !files || - ('name' in files && 'message' in files) - ) { - throw new TypeError( - 'Unexpected value for `files`, expected one or more `VFile`s' - ) - } - const settings = {}; - const colorEnabled = - typeof settings.color === 'boolean' ? settings.color : color; - let oneFileMode = false; - if (Array.isArray(files)) ; else { - oneFileMode = true; - files = [files]; - } - return serializeRows( - createRows( - { - defaultName: settings.defaultName || undefined, - oneFileMode, - quiet: settings.quiet || false, - silent: settings.silent || false, - traceLimit: - typeof settings.traceLimit === 'number' ? settings.traceLimit : 10, - verbose: settings.verbose || false, - bold: colorEnabled ? '\u001B[1m' : '', - underline: colorEnabled ? '\u001B[4m' : '', - normalIntensity: colorEnabled ? '\u001B[22m' : '', - noUnderline: colorEnabled ? '\u001B[24m' : '', - red: colorEnabled ? '\u001B[31m' : '', - cyan: colorEnabled ? '\u001B[36m' : '', - green: colorEnabled ? '\u001B[32m' : '', - yellow: colorEnabled ? '\u001B[33m' : '', - defaultColor: colorEnabled ? '\u001B[39m' : '' - }, - files - ) - ) -} -function createAncestorsLines(state, ancestors) { - const min = - ancestors.length > state.traceLimit - ? ancestors.length - state.traceLimit - : 0; - let index = ancestors.length; - const lines = []; - if (index > min) { - lines.unshift(' ' + state.bold + '[trace]' + state.normalIntensity + ':'); - } - while (index-- > min) { - const node = ancestors[index]; - const value = node; - const name = - typeof value.tagName === 'string' - ? value.tagName - : - typeof value.name === 'string' - ? value.name - : undefined; - const position = stringifyPosition(node.position); - lines.push( - ' at ' + - state.yellow + - node.type + - (name ? '<' + name + '>' : '') + - state.defaultColor + - (position ? ' (' + position + ')' : '') - ); - } - return lines -} -function createByline(state, stats) { - let result = ''; - if (stats.fatal) { - result = - state.red + - '✖' + - state.defaultColor + - ' ' + - stats.fatal + - ' ' + - (fatalToLabel(true) + (stats.fatal === 1 ? '' : 's')); - } - if (stats.warn) { - result = - (result ? result + ', ' : '') + - (state.yellow + '⚠' + state.defaultColor) + - ' ' + - stats.warn + - ' ' + - (fatalToLabel(false) + (stats.warn === 1 ? '' : 's')); - } - if (stats.total !== stats.fatal && stats.total !== stats.warn) { - result = stats.total + ' messages (' + result + ')'; - } - return result -} -function createCauseLines(state, cause) { - const lines = [' ' + state.bold + '[cause]' + state.normalIntensity + ':']; - let foundReasonableCause = false; - if (cause !== null && typeof cause === 'object') { - const stackValue = - ('stack' in cause ? String(cause.stack) : undefined) || - ('message' in cause ? String(cause.message) : undefined); - if (typeof stackValue === 'string') { - foundReasonableCause = true; - let causeLines; - if ('file' in cause && 'fatal' in cause) { - causeLines = createMessageLine( - state, - (cause) - ); - } - else { - causeLines = stackValue.split(eol); - if ('cause' in cause && cause.cause) { - causeLines.push(...createCauseLines(state, cause.cause)); - } - } - const head = causeLines[0]; - if (typeof head === 'string') { - causeLines[0] = ' ' + head; - } else { - head[0] = ' ' + head[0]; - } - lines.push(...causeLines); - } - } - if (!foundReasonableCause) { - lines.push(' ' + cause); - } - return lines -} -function createFileLine(state, file) { - const stats = statistics(file.messages); - const fromPath = file.history[0]; - const toPath = file.path; - let left = ''; - let right = ''; - if (!state.oneFileMode || state.defaultName || fromPath) { - const name = fromPath || state.defaultName || ''; - left = - state.underline + - (stats.fatal ? state.red : stats.total ? state.yellow : state.green) + - name + - state.defaultColor + - state.noUnderline + - (file.stored && name !== toPath ? ' > ' + toPath : ''); - } - if (file.stored) { - right = state.yellow + 'written' + state.defaultColor; - } else if (!stats.total) { - right = 'no issues found'; - } - return left && right ? left + ': ' + right : left + right -} -function createNoteLines(state, note) { - const noteLines = note.split(eol); - let index = -1; - while (++index < noteLines.length) { - noteLines[index] = ' ' + noteLines[index]; - } - return [ - ' ' + state.bold + '[note]' + state.normalIntensity + ':', - ...noteLines - ] -} -function createMessageLine(state, message) { - const label = fatalToLabel(message.fatal); - let reason = message.stack || message.message; - const match = eol.exec(reason); - let rest = []; - if (match) { - rest = reason.slice(match.index + 1).split(eol); - reason = reason.slice(0, match.index); - } - const place = message.place || message.position; - const row = [ - stringifyPosition(place), - (label === 'error' ? state.red : state.yellow) + label + state.defaultColor, - formatReason(state, reason), - message.ruleId || '', - message.source || '' - ]; - if (message.cause) { - rest.push(...createCauseLines(state, message.cause)); - } - if (state.verbose && message.url) { - rest.push(...createUrlLines(state, message.url)); - } - if (state.verbose && message.note) { - rest.push(...createNoteLines(state, message.note)); - } - if (state.verbose && message.ancestors) { - rest.push(...createAncestorsLines(state, message.ancestors)); - } - return [row, ...rest] -} -function createRows(state, files) { - const sortedFiles = [...files].sort(compareFile); - const all = []; - let index = -1; - const rows = []; - let lastWasMessage = false; - while (++index < sortedFiles.length) { - const file = sortedFiles[index]; - const messages = [...file.messages].sort(compareMessage); - const messageRows = []; - let offset = -1; - while (++offset < messages.length) { - const message = messages[offset]; - if (!state.silent || message.fatal) { - all.push(message); - messageRows.push(...createMessageLine(state, message)); - } - } - if ((!state.quiet && !state.silent) || messageRows.length > 0) { - const line = createFileLine(state, file); - if (lastWasMessage && line) rows.push(''); - if (line) rows.push(line); - if (messageRows.length > 0) rows.push(...messageRows); - lastWasMessage = messageRows.length > 0; - } - } - const stats = statistics(all); - if (stats.fatal || stats.warn) { - rows.push('', createByline(state, stats)); - } - return rows -} -function createUrlLines(state, url) { - return [ - ' ' + state.bold + '[url]' + state.normalIntensity + ':', - ' ' + url - ] -} -function formatReason(state, reason) { - const result = []; - const splits = []; - let index = reason.indexOf('`'); - while (index !== -1) { - const split = {index, size: 1}; - splits.push(split); - while (reason.codePointAt(index + 1) === 96) { - split.size++; - index++; - } - index = reason.indexOf('`', index + 1); - } - index = -1; - let textStart = 0; - while (++index < splits.length) { - let closeIndex = index; - let close; - while (++closeIndex < splits.length) { - if (splits[index].size === splits[closeIndex].size) { - close = splits[closeIndex]; - break - } - } - if (close) { - const codeStart = splits[index].index; - const codeEnd = close.index + close.size; - result.push( - reason.slice(textStart, codeStart) + - state.cyan + - reason.slice(codeStart, codeEnd) + - state.defaultColor - ); - textStart = codeEnd; - index = closeIndex; - } - } - result.push(reason.slice(textStart)); - return state.bold + result.join('') + state.normalIntensity -} -function fatalToLabel(value) { - return value ? 'error' : value === false ? 'warning' : 'info' -} -function serializeRows(rows) { - const sizes = []; - let index = -1; - while (++index < rows.length) { - const row = rows[index]; - if (typeof row === 'string') ; else { - let cellIndex = -1; - while (++cellIndex < row.length) { - const current = sizes[cellIndex] || 0; - const size = stringWidth(row[cellIndex]); - if (size > current) { - sizes[cellIndex] = size; - } - } - } - } - const lines = []; - index = -1; - while (++index < rows.length) { - const row = rows[index]; - let line = ''; - if (typeof row === 'string') { - line = row; - } else { - let cellIndex = -1; - while (++cellIndex < row.length) { - const cell = row[cellIndex] || ''; - const max = (sizes[cellIndex] || 0) + 1; - line += cell + ' '.repeat(max - stringWidth(cell)); - } - } - lines.push(line.trimEnd()); - } - return lines.join('\n') -} +import { unified } from 'unified'; +import remarkParse from 'remark-parse'; +import remarkStringify from 'remark-stringify'; +import presetLintNode from 'remark-preset-lint-node'; +import { read } from 'to-vfile'; +import { reporter } from 'vfile-reporter'; const paths = process.argv.slice(2); + if (!paths.length) { console.error('Usage: lint-md.mjs [ ...]'); process.exit(1); } + let format = false; + if (paths[0] === '--format') { paths.shift(); format = true; } + const linter = unified() .use(remarkParse) - .use(remarkPresetLintNode) + .use(presetLintNode) .use(remarkStringify); + paths.forEach(async (path) => { const file = await read(path); + // We need to calculate `fileContents` before running `linter.process(files)` + // because `linter.process(files)` mutates `file` and returns it as `result`. + // So we won't be able to use `file` after that to see if its contents have + // changed as they will have been altered to the changed version. const fileContents = file.toString(); const result = await linter.process(file); const isDifferent = fileContents !== result.toString(); diff --git a/tools/lint-md/lint-md.src.mjs b/tools/lint-md/lint-md.src.mjs deleted file mode 100644 index 4116d7e803b..00000000000 --- a/tools/lint-md/lint-md.src.mjs +++ /dev/null @@ -1,53 +0,0 @@ -import fs from 'fs'; - -import { unified } from 'unified'; -import remarkParse from 'remark-parse'; -import remarkStringify from 'remark-stringify'; -import presetLintNode from 'remark-preset-lint-node'; -import { read } from 'to-vfile'; -import { reporter } from 'vfile-reporter'; - -const paths = process.argv.slice(2); - -if (!paths.length) { - console.error('Usage: lint-md.mjs [ ...]'); - process.exit(1); -} - -let format = false; - -if (paths[0] === '--format') { - paths.shift(); - format = true; -} - -const linter = unified() - .use(remarkParse) - .use(presetLintNode) - .use(remarkStringify); - -paths.forEach(async (path) => { - const file = await read(path); - // We need to calculate `fileContents` before running `linter.process(files)` - // because `linter.process(files)` mutates `file` and returns it as `result`. - // So we won't be able to use `file` after that to see if its contents have - // changed as they will have been altered to the changed version. - const fileContents = file.toString(); - const result = await linter.process(file); - const isDifferent = fileContents !== result.toString(); - if (format) { - if (isDifferent) { - fs.writeFileSync(path, result.toString()); - } - } else { - if (isDifferent) { - process.exitCode = 1; - const cmd = process.platform === 'win32' ? 'vcbuild' : 'make'; - console.error(`${path} is not formatted. Please run '${cmd} format-md'.`); - } - if (result.messages.length) { - process.exitCode = 1; - console.error(reporter(result)); - } - } -}); diff --git a/tools/lint-md/package-lock.json b/tools/lint-md/package-lock.json index 0958904e2d0..75355b8c78c 100644 --- a/tools/lint-md/package-lock.json +++ b/tools/lint-md/package-lock.json @@ -14,316 +14,13 @@ "to-vfile": "^8.0.0", "unified": "^11.0.5", "vfile-reporter": "^8.1.1" - }, - "devDependencies": { - "@rollup/plugin-commonjs": "^28.0.1", - "@rollup/plugin-node-resolve": "^15.3.0", - "rollup": "^4.24.0", - "rollup-plugin-cleanup": "^3.2.1" } }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", - "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", - "dev": true - }, - "node_modules/@rollup/plugin-commonjs": { - "version": "28.0.1", - "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-28.0.1.tgz", - "integrity": "sha512-+tNWdlWKbpB3WgBN7ijjYkq9X5uhjmcvyjEght4NmH5fAU++zfQzAJ6wumLS+dNcvwEZhKx2Z+skY8m7v0wGSA==", - "dev": true, - "dependencies": { - "@rollup/pluginutils": "^5.0.1", - "commondir": "^1.0.1", - "estree-walker": "^2.0.2", - "fdir": "^6.2.0", - "is-reference": "1.2.1", - "magic-string": "^0.30.3", - "picomatch": "^4.0.2" - }, - "engines": { - "node": ">=16.0.0 || 14 >= 14.17" - }, - "peerDependencies": { - "rollup": "^2.68.0||^3.0.0||^4.0.0" - }, - "peerDependenciesMeta": { - "rollup": { - "optional": true - } - } - }, - "node_modules/@rollup/plugin-node-resolve": { - "version": "15.3.0", - "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-15.3.0.tgz", - "integrity": "sha512-9eO5McEICxMzJpDW9OnMYSv4Sta3hmt7VtBFz5zR9273suNOydOyq/FrGeGy+KsTRFm8w0SLVhzig2ILFT63Ag==", - "dev": true, - "dependencies": { - "@rollup/pluginutils": "^5.0.1", - "@types/resolve": "1.20.2", - "deepmerge": "^4.2.2", - "is-module": "^1.0.0", - "resolve": "^1.22.1" - }, - "engines": { - "node": ">=14.0.0" - }, - "peerDependencies": { - "rollup": "^2.78.0||^3.0.0||^4.0.0" - }, - "peerDependenciesMeta": { - "rollup": { - "optional": true - } - } - }, - "node_modules/@rollup/pluginutils": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.1.2.tgz", - "integrity": "sha512-/FIdS3PyZ39bjZlwqFnWqCOVnW7o963LtKMwQOD0NhQqw22gSr2YY1afu3FxRip4ZCZNsD5jq6Aaz6QV3D/Njw==", - "dev": true, - "dependencies": { - "@types/estree": "^1.0.0", - "estree-walker": "^2.0.2", - "picomatch": "^2.3.1" - }, - "engines": { - "node": ">=14.0.0" - }, - "peerDependencies": { - "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" - }, - "peerDependenciesMeta": { - "rollup": { - "optional": true - } - } - }, - "node_modules/@rollup/pluginutils/node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true, - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.24.0.tgz", - "integrity": "sha512-Q6HJd7Y6xdB48x8ZNVDOqsbh2uByBhgK8PiQgPhwkIw/HC/YX5Ghq2mQY5sRMZWHb3VsFkWooUVOZHKr7DmDIA==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ] - }, - "node_modules/@rollup/rollup-android-arm64": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.24.0.tgz", - "integrity": "sha512-ijLnS1qFId8xhKjT81uBHuuJp2lU4x2yxa4ctFPtG+MqEE6+C5f/+X/bStmxapgmwLwiL3ih122xv8kVARNAZA==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ] - }, - "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.24.0.tgz", - "integrity": "sha512-bIv+X9xeSs1XCk6DVvkO+S/z8/2AMt/2lMqdQbMrmVpgFvXlmde9mLcbQpztXm1tajC3raFDqegsH18HQPMYtA==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.24.0.tgz", - "integrity": "sha512-X6/nOwoFN7RT2svEQWUsW/5C/fYMBe4fnLK9DQk4SX4mgVBiTA9h64kjUYPvGQ0F/9xwJ5U5UfTbl6BEjaQdBQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.24.0.tgz", - "integrity": "sha512-0KXvIJQMOImLCVCz9uvvdPgfyWo93aHHp8ui3FrtOP57svqrF/roSSR5pjqL2hcMp0ljeGlU4q9o/rQaAQ3AYA==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.24.0.tgz", - "integrity": "sha512-it2BW6kKFVh8xk/BnHfakEeoLPv8STIISekpoF+nBgWM4d55CZKc7T4Dx1pEbTnYm/xEKMgy1MNtYuoA8RFIWw==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.24.0.tgz", - "integrity": "sha512-i0xTLXjqap2eRfulFVlSnM5dEbTVque/3Pi4g2y7cxrs7+a9De42z4XxKLYJ7+OhE3IgxvfQM7vQc43bwTgPwA==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.24.0.tgz", - "integrity": "sha512-9E6MKUJhDuDh604Qco5yP/3qn3y7SLXYuiC0Rpr89aMScS2UAmK1wHP2b7KAa1nSjWJc/f/Lc0Wl1L47qjiyQw==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.24.0.tgz", - "integrity": "sha512-2XFFPJ2XMEiF5Zi2EBf4h73oR1V/lycirxZxHZNc93SqDN/IWhYYSYj8I9381ikUFXZrz2v7r2tOVk2NBwxrWw==", - "cpu": [ - "ppc64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.24.0.tgz", - "integrity": "sha512-M3Dg4hlwuntUCdzU7KjYqbbd+BLq3JMAOhCKdBE3TcMGMZbKkDdJ5ivNdehOssMCIokNHFOsv7DO4rlEOfyKpg==", - "cpu": [ - "riscv64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.24.0.tgz", - "integrity": "sha512-mjBaoo4ocxJppTorZVKWFpy1bfFj9FeCMJqzlMQGjpNPY9JwQi7OuS1axzNIk0nMX6jSgy6ZURDZ2w0QW6D56g==", - "cpu": [ - "s390x" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.24.0.tgz", - "integrity": "sha512-ZXFk7M72R0YYFN5q13niV0B7G8/5dcQ9JDp8keJSfr3GoZeXEoMHP/HlvqROA3OMbMdfr19IjCeNAnPUG93b6A==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.24.0.tgz", - "integrity": "sha512-w1i+L7kAXZNdYl+vFvzSZy8Y1arS7vMgIy8wusXJzRrPyof5LAb02KGr1PD2EkRcl73kHulIID0M501lN+vobQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.24.0.tgz", - "integrity": "sha512-VXBrnPWgBpVDCVY6XF3LEW0pOU51KbaHhccHw6AS6vBWIC60eqsH19DAeeObl+g8nKAz04QFdl/Cefta0xQtUQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.24.0.tgz", - "integrity": "sha512-xrNcGDU0OxVcPTH/8n/ShH4UevZxKIO6HJFK0e15XItZP2UcaiLFd5kiX7hJnqCbSztUF8Qot+JWBC/QXRPYWQ==", - "cpu": [ - "ia32" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.24.0.tgz", - "integrity": "sha512-fbMkAF7fufku0N2dE5TBXcNlg0pt0cJue4xBRE2Qc5Vqikxr4VCgKj/ht6SMdFcOacVA9rqF70APJ8RN/4vMJw==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ] - }, "node_modules/@types/debug": { "version": "4.1.12", "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz", "integrity": "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==", + "license": "MIT", "dependencies": { "@types/ms": "*" } @@ -331,12 +28,14 @@ "node_modules/@types/estree": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", - "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==" + "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", + "license": "MIT" }, "node_modules/@types/estree-jsx": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/@types/estree-jsx/-/estree-jsx-1.0.5.tgz", "integrity": "sha512-52CcUVNFyfb1A2ALocQw/Dd1BQFNmSdkuC3BkZ6iqhdMfQz7JWOFRuJFloOzjk+6WijU56m9oKXFAXc7o3Towg==", + "license": "MIT", "dependencies": { "@types/estree": "*" } @@ -345,6 +44,7 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz", "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==", + "license": "MIT", "dependencies": { "@types/unist": "*" } @@ -353,6 +53,7 @@ "version": "4.0.4", "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.4.tgz", "integrity": "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==", + "license": "MIT", "dependencies": { "@types/unist": "*" } @@ -360,28 +61,26 @@ "node_modules/@types/ms": { "version": "0.7.34", "resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.34.tgz", - "integrity": "sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g==" - }, - "node_modules/@types/resolve": { - "version": "1.20.2", - "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.20.2.tgz", - "integrity": "sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==", - "dev": true + "integrity": "sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g==", + "license": "MIT" }, "node_modules/@types/supports-color": { "version": "8.1.3", "resolved": "https://registry.npmjs.org/@types/supports-color/-/supports-color-8.1.3.tgz", - "integrity": "sha512-Hy6UMpxhE3j1tLpl27exp1XqHD7n8chAiNPzWfz16LPZoMMoSc4dzLl6w9qijkEb/r5O1ozdu1CWGA2L83ZeZg==" + "integrity": "sha512-Hy6UMpxhE3j1tLpl27exp1XqHD7n8chAiNPzWfz16LPZoMMoSc4dzLl6w9qijkEb/r5O1ozdu1CWGA2L83ZeZg==", + "license": "MIT" }, "node_modules/@types/unist": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", - "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==" + "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", + "license": "MIT" }, "node_modules/ansi-regex": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", + "license": "MIT", "engines": { "node": ">=12" }, @@ -392,12 +91,14 @@ "node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "license": "Python-2.0" }, "node_modules/bail": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/bail/-/bail-2.0.2.tgz", "integrity": "sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==", + "license": "MIT", "funding": { "type": "github", "url": "https://github.com/sponsors/wooorm" @@ -407,6 +108,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz", "integrity": "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==", + "license": "MIT", "funding": { "type": "github", "url": "https://github.com/sponsors/wooorm" @@ -416,6 +118,7 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-2.0.2.tgz", "integrity": "sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==", + "license": "MIT", "funding": { "type": "github", "url": "https://github.com/sponsors/wooorm" @@ -425,6 +128,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-2.1.0.tgz", "integrity": "sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==", + "license": "MIT", "funding": { "type": "github", "url": "https://github.com/sponsors/wooorm" @@ -434,6 +138,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz", "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==", + "license": "MIT", "funding": { "type": "github", "url": "https://github.com/sponsors/wooorm" @@ -443,6 +148,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-2.0.1.tgz", "integrity": "sha512-iBZ4F4wRbyORVsu0jPV7gXkOsGYjGHPmAyv+HiHG8gi5PtC9KI2j1+v8/tlibRvjoWX027ypmG/n0HtO5t7unw==", + "license": "MIT", "funding": { "type": "github", "url": "https://github.com/sponsors/wooorm" @@ -452,21 +158,17 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/collapse-white-space/-/collapse-white-space-2.1.0.tgz", "integrity": "sha512-loKTxY1zCOuG4j9f6EPnuyyYkf58RnhhWTvRoZEokgB+WbdXehfjFviyOVYkqzEWz1Q5kRiZdBYS5SwxbQYwzw==", + "license": "MIT", "funding": { "type": "github", "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/commondir": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", - "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==", - "dev": true - }, "node_modules/debug": { "version": "4.3.7", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "license": "MIT", "dependencies": { "ms": "^2.1.3" }, @@ -483,6 +185,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.0.2.tgz", "integrity": "sha512-O8x12RzrUF8xyVcY0KJowWsmaJxQbmy0/EtnNtHRpsOcT7dFk5W598coHqBVpmWo1oQQfsCqfCmkZN5DJrZVdg==", + "license": "MIT", "dependencies": { "character-entities": "^2.0.0" }, @@ -491,19 +194,11 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/deepmerge": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", - "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/dequal": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", + "license": "MIT", "engines": { "node": ">=6" } @@ -512,6 +207,7 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/devlop/-/devlop-1.1.0.tgz", "integrity": "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==", + "license": "MIT", "dependencies": { "dequal": "^2.0.0" }, @@ -523,17 +219,20 @@ "node_modules/eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", - "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==" + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "license": "MIT" }, "node_modules/emoji-regex": { "version": "10.4.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.4.0.tgz", - "integrity": "sha512-EC+0oUMY1Rqm4O6LLrgjtYDvcVYTy7chDnM4Q7030tP4Kwj3u/pR6gP9ygnp2CJMK5Gq+9Q2oqmrFJAz01DXjw==" + "integrity": "sha512-EC+0oUMY1Rqm4O6LLrgjtYDvcVYTy7chDnM4Q7030tP4Kwj3u/pR6gP9ygnp2CJMK5Gq+9Q2oqmrFJAz01DXjw==", + "license": "MIT" }, "node_modules/escape-string-regexp": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", + "license": "MIT", "engines": { "node": ">=12" }, @@ -541,70 +240,17 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/estree-walker": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", - "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", - "dev": true - }, "node_modules/extend": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" - }, - "node_modules/fdir": { - "version": "6.4.2", - "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.2.tgz", - "integrity": "sha512-KnhMXsKSPZlAhp7+IjUkRZKPb4fUyccpDrdFXbi4QL1qkmFh9kVY09Yox+n4MaOb3lHZ1Tv829C3oaaXoMYPDQ==", - "dev": true, - "peerDependencies": { - "picomatch": "^3 || ^4" - }, - "peerDependenciesMeta": { - "picomatch": { - "optional": true - } - } - }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "dev": true, - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/function-bind": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", - "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/hasown": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", - "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", - "dev": true, - "dependencies": { - "function-bind": "^1.1.2" - }, - "engines": { - "node": ">= 0.4" - } + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "license": "MIT" }, "node_modules/is-alphabetical": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-2.0.1.tgz", "integrity": "sha512-FWyyY60MeTNyeSRpkM2Iry0G9hpr7/9kD40mD/cGQEuilcZYS4okz8SN2Q6rLCJ8gbCt6fN+rC+6tMGS99LaxQ==", + "license": "MIT", "funding": { "type": "github", "url": "https://github.com/sponsors/wooorm" @@ -614,6 +260,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-2.0.1.tgz", "integrity": "sha512-hmbYhX/9MUMF5uh7tOXyK/n0ZvWpad5caBA17GsC6vyuCqaWliRG5K1qS9inmUhEMaOBIW7/whAnSwveW/LtZw==", + "license": "MIT", "dependencies": { "is-alphabetical": "^2.0.0", "is-decimal": "^2.0.0" @@ -641,29 +288,16 @@ "url": "https://feross.org/support" } ], + "license": "MIT", "engines": { "node": ">=4" } }, - "node_modules/is-core-module": { - "version": "2.15.1", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.15.1.tgz", - "integrity": "sha512-z0vtXSwucUJtANQWldhbtbt7BnL0vxiFjIdDLAatwhDYty2bad6s+rijD6Ri4YuYJubLzIJLUidCh09e1djEVQ==", - "dev": true, - "dependencies": { - "hasown": "^2.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-decimal": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-2.0.1.tgz", "integrity": "sha512-AAB9hiomQs5DXWcRB1rqsxGUstbRroFOPPVAomNk/3XHR5JyEZChOyTWe2oayKnsSsr/kcGqF+z6yuH6HHpN0A==", + "license": "MIT", "funding": { "type": "github", "url": "https://github.com/sponsors/wooorm" @@ -673,21 +307,17 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-2.0.1.tgz", "integrity": "sha512-DgZQp241c8oO6cA1SbTEWiXeoxV42vlcJxgH+B3hi1AiqqKruZR3ZGF8In3fj4+/y/7rHvlOZLZtgJ/4ttYGZg==", + "license": "MIT", "funding": { "type": "github", "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/is-module": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", - "integrity": "sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==", - "dev": true - }, "node_modules/is-plain-obj": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz", "integrity": "sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==", + "license": "MIT", "engines": { "node": ">=12" }, @@ -695,42 +325,11 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-reference": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz", - "integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==", - "dev": true, - "dependencies": { - "@types/estree": "*" - } - }, - "node_modules/js-cleanup": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/js-cleanup/-/js-cleanup-1.2.0.tgz", - "integrity": "sha512-JeDD0yiiSt80fXzAVa/crrS0JDPQljyBG/RpOtaSbyDq03VHa9szJWMaWOYU/bcTn412uMN2MxApXq8v79cUiQ==", - "dev": true, - "dependencies": { - "magic-string": "^0.25.7", - "perf-regexes": "^1.0.1", - "skip-regex": "^1.0.2" - }, - "engines": { - "node": "^10.14.2 || >=12.0.0" - } - }, - "node_modules/js-cleanup/node_modules/magic-string": { - "version": "0.25.9", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz", - "integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==", - "dev": true, - "dependencies": { - "sourcemap-codec": "^1.4.8" - } - }, "node_modules/js-yaml": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "license": "MIT", "dependencies": { "argparse": "^2.0.1" }, @@ -742,24 +341,17 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-3.1.0.tgz", "integrity": "sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g==", + "license": "MIT", "funding": { "type": "github", "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/magic-string": { - "version": "0.30.12", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.12.tgz", - "integrity": "sha512-Ea8I3sQMVXr8JhN4z+H/d8zwo+tYDgHE9+5G4Wnrwhs0gaK9fXTKx0Tw5Xwsd/bCPTTZNRAdpyzvoeORe9LYpw==", - "dev": true, - "dependencies": { - "@jridgewell/sourcemap-codec": "^1.5.0" - } - }, "node_modules/markdown-table": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-3.0.3.tgz", - "integrity": "sha512-Z1NL3Tb1M9wH4XESsCDEksWoKTdlUafKc4pt0GRwjUyXaCFZ+dc3g2erqB6zm3szA2IUSi7VnPI+o/9jnxh9hw==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-3.0.4.tgz", + "integrity": "sha512-wiYz4+JrLyb/DqW2hkFJxP7Vd7JuTDm77fvbM8VfEQdmSMqcImWeeRbHwZjBjIFki/VaMK2BhFi7oUUZeM5bqw==", + "license": "MIT", "funding": { "type": "github", "url": "https://github.com/sponsors/wooorm" @@ -769,6 +361,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/mdast-comment-marker/-/mdast-comment-marker-3.0.0.tgz", "integrity": "sha512-bt08sLmTNg00/UtVDiqZKocxqvQqqyQZAg1uaRuO/4ysXV5motg7RolF5o5yy/sY1rG0v2XgZEqFWho1+2UquA==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-mdx-expression": "^2.0.0" @@ -782,6 +375,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/mdast-util-directive/-/mdast-util-directive-3.0.0.tgz", "integrity": "sha512-JUpYOqKI4mM3sZcNxmF/ox04XYFFkNwr0CFlrQIkCwbvH0xzMCqkMqAde9wRd80VAhaUrwFwKm2nxretdT1h7Q==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "@types/unist": "^3.0.0", @@ -801,6 +395,7 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/mdast-util-find-and-replace/-/mdast-util-find-and-replace-3.0.1.tgz", "integrity": "sha512-SG21kZHGC3XRTSUhtofZkBzZTJNM5ecCi0SK2IMKmSXR8vO3peL+kb1O0z7Zl83jKtutG4k5Wv/W7V3/YHvzPA==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "escape-string-regexp": "^5.0.0", @@ -816,6 +411,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-2.0.1.tgz", "integrity": "sha512-aJEUyzZ6TzlsX2s5B4Of7lN7EQtAxvtradMMglCQDyaTFgse6CmtmdJ15ElnVRlCg1vpNyVtbem0PWzlNieZsA==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "@types/unist": "^3.0.0", @@ -839,6 +435,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/mdast-util-gfm/-/mdast-util-gfm-3.0.0.tgz", "integrity": "sha512-dgQEX5Amaq+DuUqf26jJqSK9qgixgd6rYDHAv4aTBuA92cTknZlKpPfa86Z/s8Dj8xsAQpFfBmPUHWJBWqS4Bw==", + "license": "MIT", "dependencies": { "mdast-util-from-markdown": "^2.0.0", "mdast-util-gfm-autolink-literal": "^2.0.0", @@ -857,6 +454,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/mdast-util-gfm-autolink-literal/-/mdast-util-gfm-autolink-literal-2.0.1.tgz", "integrity": "sha512-5HVP2MKaP6L+G6YaxPNjuL0BPrq9orG3TsrZ9YXbA3vDw/ACI4MEsnoDpn6ZNm7GnZgtAcONJyPhOP8tNJQavQ==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "ccount": "^2.0.0", @@ -873,6 +471,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/mdast-util-gfm-footnote/-/mdast-util-gfm-footnote-2.0.0.tgz", "integrity": "sha512-5jOT2boTSVkMnQ7LTrd6n/18kqwjmuYqo7JUPe+tRCY6O7dAuTFMtTPauYYrMPpox9hlN0uOx/FL8XvEfG9/mQ==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "devlop": "^1.1.0", @@ -889,6 +488,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/mdast-util-gfm-strikethrough/-/mdast-util-gfm-strikethrough-2.0.0.tgz", "integrity": "sha512-mKKb915TF+OC5ptj5bJ7WFRPdYtuHv0yTRxK2tJvi+BDqbkiG7h7u/9SI89nRAYcmap2xHQL9D+QG/6wSrTtXg==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-from-markdown": "^2.0.0", @@ -903,6 +503,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/mdast-util-gfm-table/-/mdast-util-gfm-table-2.0.0.tgz", "integrity": "sha512-78UEvebzz/rJIxLvE7ZtDd/vIQ0RHv+3Mh5DR96p7cS7HsBhYIICDBCu8csTNWNO6tBWfqXPWekRuj2FNOGOZg==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "devlop": "^1.0.0", @@ -919,6 +520,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/mdast-util-gfm-task-list-item/-/mdast-util-gfm-task-list-item-2.0.0.tgz", "integrity": "sha512-IrtvNvjxC1o06taBAVJznEnkiHxLFTzgonUdy8hzFVeDun0uTjxxrRGVaNFqkU1wJR3RBPEfsxmU6jDWPofrTQ==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "devlop": "^1.0.0", @@ -934,6 +536,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/mdast-util-heading-style/-/mdast-util-heading-style-3.0.0.tgz", "integrity": "sha512-tsUfM9Kj9msjlemA/38Z3pvraQay880E3zP2NgIthMoGcpU9bcPX9oSM6QC/+eFXGGB4ba+VCB1dKAPHB7Veug==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0" }, @@ -946,6 +549,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/mdast-util-mdx/-/mdast-util-mdx-3.0.0.tgz", "integrity": "sha512-JfbYLAW7XnYTTbUsmpu0kdBUVe+yKVJZBItEjwyYJiDJuZ9w4eeaqks4HQO+R7objWgS2ymV60GYpI14Ug554w==", + "license": "MIT", "dependencies": { "mdast-util-from-markdown": "^2.0.0", "mdast-util-mdx-expression": "^2.0.0", @@ -962,6 +566,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/mdast-util-mdx-expression/-/mdast-util-mdx-expression-2.0.1.tgz", "integrity": "sha512-J6f+9hUp+ldTZqKRSg7Vw5V6MqjATc+3E4gf3CFNcuZNWD8XdyI6zQ8GqH7f8169MM6P7hMBRDVGnn7oHB9kXQ==", + "license": "MIT", "dependencies": { "@types/estree-jsx": "^1.0.0", "@types/hast": "^3.0.0", @@ -979,6 +584,7 @@ "version": "3.1.3", "resolved": "https://registry.npmjs.org/mdast-util-mdx-jsx/-/mdast-util-mdx-jsx-3.1.3.tgz", "integrity": "sha512-bfOjvNt+1AcbPLTFMFWY149nJz0OjmewJs3LQQ5pIyVGxP4CdOqNVJL6kTaM5c68p8q82Xv3nCyFfUnuEcH3UQ==", + "license": "MIT", "dependencies": { "@types/estree-jsx": "^1.0.0", "@types/hast": "^3.0.0", @@ -1002,6 +608,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/mdast-util-mdxjs-esm/-/mdast-util-mdxjs-esm-2.0.1.tgz", "integrity": "sha512-EcmOpxsZ96CvlP03NghtH1EsLtr0n9Tm4lPUJUBccV9RwUOneqSycg19n5HGzCf+10LozMRSObtVr3ee1WoHtg==", + "license": "MIT", "dependencies": { "@types/estree-jsx": "^1.0.0", "@types/hast": "^3.0.0", @@ -1019,6 +626,7 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/mdast-util-phrasing/-/mdast-util-phrasing-4.1.0.tgz", "integrity": "sha512-TqICwyvJJpBwvGAMZjj4J2n0X8QWp21b9l0o7eXyVJ25YNWYbJDVIyD1bZXE6WtV6RmKJVYmQAKWa0zWOABz2w==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "unist-util-is": "^6.0.0" @@ -1032,6 +640,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-2.1.0.tgz", "integrity": "sha512-SR2VnIEdVNCJbP6y7kVTJgPLifdr8WEU440fQec7qHoHOUz/oJ2jmNRqdDQ3rbiStOXb2mCDGTuwsK5OPUgYlQ==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "@types/unist": "^3.0.0", @@ -1051,6 +660,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-4.0.0.tgz", "integrity": "sha512-0H44vDimn51F0YwvxSJSm0eCDOJTRlmN0R1yBh4HLj9wiV1Dn0QoXGbvFAWj2hSItVTlCmBF1hqKlIyUBVFLPg==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0" }, @@ -1073,6 +683,7 @@ "url": "https://opencollective.com/unified" } ], + "license": "MIT", "dependencies": { "@types/debug": "^4.0.0", "debug": "^4.0.0", @@ -1107,6 +718,7 @@ "url": "https://opencollective.com/unified" } ], + "license": "MIT", "dependencies": { "decode-named-character-reference": "^1.0.0", "devlop": "^1.0.0", @@ -1130,6 +742,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/micromark-extension-gfm/-/micromark-extension-gfm-3.0.0.tgz", "integrity": "sha512-vsKArQsicm7t0z2GugkCKtZehqUm31oeGBV/KVSorWSy8ZlNAv7ytjFhvaryUiCUJYqs+NoE6AFhpQvBTM6Q4w==", + "license": "MIT", "dependencies": { "micromark-extension-gfm-autolink-literal": "^2.0.0", "micromark-extension-gfm-footnote": "^2.0.0", @@ -1149,6 +762,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/micromark-extension-gfm-autolink-literal/-/micromark-extension-gfm-autolink-literal-2.1.0.tgz", "integrity": "sha512-oOg7knzhicgQ3t4QCjCWgTmfNhvQbDDnJeVu9v81r7NltNCVmhPy1fJRX27pISafdjL+SVc4d3l48Gb6pbRypw==", + "license": "MIT", "dependencies": { "micromark-util-character": "^2.0.0", "micromark-util-sanitize-uri": "^2.0.0", @@ -1164,6 +778,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/micromark-extension-gfm-footnote/-/micromark-extension-gfm-footnote-2.1.0.tgz", "integrity": "sha512-/yPhxI1ntnDNsiHtzLKYnE3vf9JZ6cAisqVDauhp4CEHxlb4uoOTxOCJ+9s51bIB8U1N1FJ1RXOKTIlD5B/gqw==", + "license": "MIT", "dependencies": { "devlop": "^1.0.0", "micromark-core-commonmark": "^2.0.0", @@ -1183,6 +798,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/micromark-extension-gfm-strikethrough/-/micromark-extension-gfm-strikethrough-2.1.0.tgz", "integrity": "sha512-ADVjpOOkjz1hhkZLlBiYA9cR2Anf8F4HqZUO6e5eDcPQd0Txw5fxLzzxnEkSkfnD0wziSGiv7sYhk/ktvbf1uw==", + "license": "MIT", "dependencies": { "devlop": "^1.0.0", "micromark-util-chunked": "^2.0.0", @@ -1200,6 +816,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/micromark-extension-gfm-table/-/micromark-extension-gfm-table-2.1.0.tgz", "integrity": "sha512-Ub2ncQv+fwD70/l4ou27b4YzfNaCJOvyX4HxXU15m7mpYY+rjuWzsLIPZHJL253Z643RpbcP1oeIJlQ/SKW67g==", + "license": "MIT", "dependencies": { "devlop": "^1.0.0", "micromark-factory-space": "^2.0.0", @@ -1216,6 +833,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/micromark-extension-gfm-tagfilter/-/micromark-extension-gfm-tagfilter-2.0.0.tgz", "integrity": "sha512-xHlTOmuCSotIA8TW1mDIM6X2O1SiX5P9IuDtqGonFhEK0qgRI4yeC6vMxEV2dgyr2TiD+2PQ10o+cOhdVAcwfg==", + "license": "MIT", "dependencies": { "micromark-util-types": "^2.0.0" }, @@ -1228,6 +846,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/micromark-extension-gfm-task-list-item/-/micromark-extension-gfm-task-list-item-2.1.0.tgz", "integrity": "sha512-qIBZhqxqI6fjLDYFTBIa4eivDMnP+OZqsNwmQ3xNLE4Cxwc+zfQEfbs6tzAo2Hjq+bh6q5F+Z8/cksrLFYWQQw==", + "license": "MIT", "dependencies": { "devlop": "^1.0.0", "micromark-factory-space": "^2.0.0", @@ -1254,6 +873,7 @@ "url": "https://opencollective.com/unified" } ], + "license": "MIT", "dependencies": { "micromark-util-character": "^2.0.0", "micromark-util-symbol": "^2.0.0", @@ -1274,6 +894,7 @@ "url": "https://opencollective.com/unified" } ], + "license": "MIT", "dependencies": { "devlop": "^1.0.0", "micromark-util-character": "^2.0.0", @@ -1295,6 +916,7 @@ "url": "https://opencollective.com/unified" } ], + "license": "MIT", "dependencies": { "micromark-util-character": "^2.0.0", "micromark-util-types": "^2.0.0" @@ -1314,6 +936,7 @@ "url": "https://opencollective.com/unified" } ], + "license": "MIT", "dependencies": { "micromark-factory-space": "^2.0.0", "micromark-util-character": "^2.0.0", @@ -1335,6 +958,7 @@ "url": "https://opencollective.com/unified" } ], + "license": "MIT", "dependencies": { "micromark-factory-space": "^2.0.0", "micromark-util-character": "^2.0.0", @@ -1356,6 +980,7 @@ "url": "https://opencollective.com/unified" } ], + "license": "MIT", "dependencies": { "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0" @@ -1375,6 +1000,7 @@ "url": "https://opencollective.com/unified" } ], + "license": "MIT", "dependencies": { "micromark-util-symbol": "^2.0.0" } @@ -1393,6 +1019,7 @@ "url": "https://opencollective.com/unified" } ], + "license": "MIT", "dependencies": { "micromark-util-character": "^2.0.0", "micromark-util-symbol": "^2.0.0", @@ -1413,6 +1040,7 @@ "url": "https://opencollective.com/unified" } ], + "license": "MIT", "dependencies": { "micromark-util-chunked": "^2.0.0", "micromark-util-types": "^2.0.0" @@ -1432,6 +1060,7 @@ "url": "https://opencollective.com/unified" } ], + "license": "MIT", "dependencies": { "micromark-util-symbol": "^2.0.0" } @@ -1450,6 +1079,7 @@ "url": "https://opencollective.com/unified" } ], + "license": "MIT", "dependencies": { "decode-named-character-reference": "^1.0.0", "micromark-util-character": "^2.0.0", @@ -1470,7 +1100,8 @@ "type": "OpenCollective", "url": "https://opencollective.com/unified" } - ] + ], + "license": "MIT" }, "node_modules/micromark-util-html-tag-name": { "version": "2.0.0", @@ -1485,7 +1116,8 @@ "type": "OpenCollective", "url": "https://opencollective.com/unified" } - ] + ], + "license": "MIT" }, "node_modules/micromark-util-normalize-identifier": { "version": "2.0.0", @@ -1501,6 +1133,7 @@ "url": "https://opencollective.com/unified" } ], + "license": "MIT", "dependencies": { "micromark-util-symbol": "^2.0.0" } @@ -1519,6 +1152,7 @@ "url": "https://opencollective.com/unified" } ], + "license": "MIT", "dependencies": { "micromark-util-types": "^2.0.0" } @@ -1537,6 +1171,7 @@ "url": "https://opencollective.com/unified" } ], + "license": "MIT", "dependencies": { "micromark-util-character": "^2.0.0", "micromark-util-encode": "^2.0.0", @@ -1557,6 +1192,7 @@ "url": "https://opencollective.com/unified" } ], + "license": "MIT", "dependencies": { "devlop": "^1.0.0", "micromark-util-chunked": "^2.0.0", @@ -1577,7 +1213,8 @@ "type": "OpenCollective", "url": "https://opencollective.com/unified" } - ] + ], + "license": "MIT" }, "node_modules/micromark-util-types": { "version": "2.0.0", @@ -1592,17 +1229,20 @@ "type": "OpenCollective", "url": "https://opencollective.com/unified" } - ] + ], + "license": "MIT" }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" }, "node_modules/parse-entities": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-4.0.1.tgz", "integrity": "sha512-SWzvYcSJh4d/SGLIOQfZ/CoNv6BTlI6YEQ7Nj82oDVnRpwe/Z/F1EMx42x3JAOwGBlCjeCH0BRJQbQ/opHL17w==", + "license": "MIT", "dependencies": { "@types/unist": "^2.0.0", "character-entities": "^2.0.0", @@ -1621,39 +1261,14 @@ "node_modules/parse-entities/node_modules/@types/unist": { "version": "2.0.11", "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.11.tgz", - "integrity": "sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==" - }, - "node_modules/path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "dev": true - }, - "node_modules/perf-regexes": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/perf-regexes/-/perf-regexes-1.0.1.tgz", - "integrity": "sha512-L7MXxUDtqr4PUaLFCDCXBfGV/6KLIuSEccizDI7JxT+c9x1G1v04BQ4+4oag84SHaCdrBgQAIs/Cqn+flwFPng==", - "dev": true, - "engines": { - "node": ">=6.14" - } - }, - "node_modules/picomatch": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz", - "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } + "integrity": "sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==", + "license": "MIT" }, "node_modules/pluralize": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz", "integrity": "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==", + "license": "MIT", "engines": { "node": ">=4" } @@ -1662,6 +1277,7 @@ "version": "2.0.3", "resolved": "https://registry.npmjs.org/quotation/-/quotation-2.0.3.tgz", "integrity": "sha512-yEc24TEgCFLXx7D4JHJJkK4JFVtatO8fziwUxY4nB/Jbea9o9CVS3gt22mA0W7rPYAGW2fWzYDSOtD94PwOyqA==", + "license": "MIT", "funding": { "type": "github", "url": "https://github.com/sponsors/wooorm" @@ -1671,6 +1287,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/remark-gfm/-/remark-gfm-4.0.0.tgz", "integrity": "sha512-U92vJgBPkbw4Zfu/IiW2oTZLSL3Zpv+uI7My2eq8JxKgqraFdU8YUGicEJCEgSbeaG+QDFqIcwwfMTOEelPxuA==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-gfm": "^3.0.0", @@ -1688,6 +1305,7 @@ "version": "10.0.0", "resolved": "https://registry.npmjs.org/remark-lint/-/remark-lint-10.0.0.tgz", "integrity": "sha512-E8yHHDOJ8b+qI0G49BRu24pe8t0fNNBWv8ENQJpCGNrVeTeyBIGEbaUe1yuF7OG8faA6PVpcN/pqWjzW9fcBWQ==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "remark-message-control": "^8.0.0", @@ -1702,6 +1320,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/remark-lint-blockquote-indentation/-/remark-lint-blockquote-indentation-4.0.0.tgz", "integrity": "sha512-hdUvn+KsJbBKpY9jLY01PmfpJ/WGhLu9GJMXQGU8ADXJc+F5DWSgKAr6GQ1IUKqvGYdEML/KZ61WomWFUuecVA==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-phrasing": "^4.0.0", @@ -1719,6 +1338,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/remark-lint-checkbox-character-style/-/remark-lint-checkbox-character-style-5.0.0.tgz", "integrity": "sha512-K0G/Nok59fb2q5KUxcemBVt+ymnhTkDVLJAatZ4PAh9At8y0DGctHdU27jWsuvO0Fs7Zy62Usk7IJE2VO89p1w==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-phrasing": "^4.0.0", @@ -1736,6 +1356,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/remark-lint-checkbox-content-indent/-/remark-lint-checkbox-content-indent-5.0.0.tgz", "integrity": "sha512-7L25a7TEfdogFSh4HDOnB+GTTTEiXJDMlceUPft9bzIjElI8Hm2+a2D8jUQn4ahj+j/3LmdZW4GjAeyfdPuqTA==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-phrasing": "^4.0.0", @@ -1753,6 +1374,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/remark-lint-code-block-style/-/remark-lint-code-block-style-4.0.0.tgz", "integrity": "sha512-LKBKMVruEO0tzDnnnqi1TfUcnwY6Mo7cVtZM4E4pKt3KMhtvgU2wD68/MxDOEJd0pmnLrEgIadv74bY0gWhZpg==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-phrasing": "^4.0.0", @@ -1770,6 +1392,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/remark-lint-definition-spacing/-/remark-lint-definition-spacing-4.0.0.tgz", "integrity": "sha512-t6nP8unz6z/DLBTWeOmDFHPFbX3E2PbNgt2fTazRbVnMC6z3o25hBzg5hI6DL0MPt2ZTRX++rJsGRjb+vgh/tQ==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "longest-streak": "^3.0.0", @@ -1787,6 +1410,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/remark-lint-fenced-code-flag/-/remark-lint-fenced-code-flag-4.0.0.tgz", "integrity": "sha512-Zs0wJd4nRvBo/9NWQVfWg5Ykapbo0Zzw/SyZc3f0h73S1gTZZcfeU+bA5oDivlBdcUgLBsyHRE0QaoaVvN3/Wg==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-phrasing": "^4.0.0", @@ -1804,6 +1428,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/remark-lint-fenced-code-marker/-/remark-lint-fenced-code-marker-4.0.0.tgz", "integrity": "sha512-WFN88Rx78m4/HSbW3Kx2XAYbVfzYns4bJd9qpwDD90DA3nc59zciYd01xi6Bk3n9vSs5gIlmG7xkwxVHHJ8KCA==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-phrasing": "^4.0.0", @@ -1821,6 +1446,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/remark-lint-file-extension/-/remark-lint-file-extension-3.0.0.tgz", "integrity": "sha512-wrOKiGvcl/ftB7FkeX2/l13ALvhKXV77HGR8AXo86cVY2pD+K0WdOC52DV3ldgpUXpWzE9kcgF8bbkxwzKpFFg==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "quotation": "^2.0.0", @@ -1835,6 +1461,7 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/remark-lint-final-definition/-/remark-lint-final-definition-4.0.1.tgz", "integrity": "sha512-51T9oSdA7wuhjSdgGo0snO1BY39Igt9cJQi7XpgtgFsbfQk8zSSAUAc/rLabY6+YCTpcPs6qmwvLXZ4mPX6Qlg==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "devlop": "^1.0.0", @@ -1854,6 +1481,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/remark-lint-final-newline/-/remark-lint-final-newline-3.0.0.tgz", "integrity": "sha512-NaPyn6FiOn3IV/6gIcwWfJmgraPT2IaVLjhakfPglZkKVfn/FrOfETyY8Bp+HLoSRI9967OH0yRDnK7/pPIWeQ==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "devlop": "^1.0.0", @@ -1869,6 +1497,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/remark-lint-first-heading-level/-/remark-lint-first-heading-level-4.0.0.tgz", "integrity": "sha512-CAMSDt03MwzGD1bgOZ+UaE0lN1xZXtJZGRXwMg7OmGazLVDtTsRkMEK0YY2LUyozdHBUFoq6FQt5pKyYdt/Tmw==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-mdx": "^3.0.0", @@ -1884,6 +1513,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/remark-lint-hard-break-spaces/-/remark-lint-hard-break-spaces-4.0.0.tgz", "integrity": "sha512-zCTq7/xfM0ZL3bMopXse9DH2nk38wE1LrxmYwnTrqASBLnEAJWE2U2//tRGVMEBfSAnNvmIo96twz6zkLWjbGA==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "unified-lint-rule": "^3.0.0", @@ -1899,6 +1529,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/remark-lint-heading-style/-/remark-lint-heading-style-4.0.0.tgz", "integrity": "sha512-dQ6Jul5K0+aNUvrq4W7H0+osSoC9hsmwHZqBFq000+eMP/hWJqI8tuudw1rap8HHYuOsKLRbB5q+Fr7G+3Vw+Q==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-heading-style": "^3.0.0", @@ -1917,6 +1548,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/remark-lint-list-item-bullet-indent/-/remark-lint-list-item-bullet-indent-5.0.0.tgz", "integrity": "sha512-qq22QaxsDjfsL7aWGIPmP3P0N99CJBQQW1+iSrhYAMCDzqVlw6I3wPNAeR6s8mcoeHT8YlT6eQH3V8xJ0SlW6w==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "pluralize": "^8.0.0", @@ -1932,6 +1564,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/remark-lint-list-item-indent/-/remark-lint-list-item-indent-4.0.0.tgz", "integrity": "sha512-Yd6/g8CH9e4vlPAPNgl7F575uKhP+pTo/qwGkE61GOcgEVNJ/529hjumUhyQ4sOAX0YAPAjxvq6fJvb4AhVOOA==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-phrasing": "^4.0.0", @@ -1949,6 +1582,7 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/remark-lint-maximum-line-length/-/remark-lint-maximum-line-length-4.0.1.tgz", "integrity": "sha512-hQlh8UrRfhkO4FU7z7t1Bu5ethj1y2iBncO5AOWF38RAmlHaZdB2lQxNA8IvUZITGJYpT1aThdFTEf+58lv08Q==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-mdx": "^3.0.0", @@ -1966,6 +1600,7 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/remark-lint-no-blockquote-without-marker/-/remark-lint-no-blockquote-without-marker-6.0.0.tgz", "integrity": "sha512-fBhoTpkWcl5tG4FdwPdJIyb8XLrdr6MdLk1+K2BQ6Rom3rRsIYvuox4ohxOunNrXuth8xyw8kC6wDmODR44oFw==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "devlop": "^1.0.0", @@ -1986,6 +1621,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/remark-lint-no-consecutive-blank-lines/-/remark-lint-no-consecutive-blank-lines-5.0.0.tgz", "integrity": "sha512-HsDZbFlelBVO3mEJDXd9v4z0HLB8pqxWnsV+I4ILYFp5lKYf6NxJaLBWFtP1gAg1+95WxityGLkGtYqmicDjpg==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-directive": "^3.0.0", @@ -2005,6 +1641,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/remark-lint-no-duplicate-definitions/-/remark-lint-no-duplicate-definitions-4.0.0.tgz", "integrity": "sha512-21fcOACkCyhNsHkedKlpvqIywYx+5zGR507bW8e59gzdGhTbnBwQ9du4ACmN9jxPTfIBhUVMz0bWezkGrHE7Bg==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "devlop": "^1.0.0", @@ -2022,6 +1659,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/remark-lint-no-file-name-articles/-/remark-lint-no-file-name-articles-3.0.0.tgz", "integrity": "sha512-il4IseupahbV2TVfFjfDVL/EQw7jBWVlMVsv4K2cgl5uPIjiCjFGQypqKnWl6pZDN0oNOs/DE8gBdyuDjldJaA==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "unified-lint-rule": "^3.0.0" @@ -2035,6 +1673,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/remark-lint-no-file-name-consecutive-dashes/-/remark-lint-no-file-name-consecutive-dashes-3.0.0.tgz", "integrity": "sha512-3vSI1LOQlu8NSCpWLsKELa8dS9HU+YVZE0U43/DNkdEcnZmlJLpTHQjBTMZUHQipRgoOO+TOSyXFyN/H+2lbuQ==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "unified-lint-rule": "^3.0.0" @@ -2048,6 +1687,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/remark-lint-no-file-name-outer-dashes/-/remark-lint-no-file-name-outer-dashes-3.0.0.tgz", "integrity": "sha512-3kgamCp39mdlCtqF/+JLwwS4VpSj5wvVwRythUfrpW7993I9kF67dBsaU545aEzWSK+UJZqjb40i0m2VfnBRfQ==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "unified-lint-rule": "^3.0.0" @@ -2061,6 +1701,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/remark-lint-no-heading-content-indent/-/remark-lint-no-heading-content-indent-5.0.0.tgz", "integrity": "sha512-psYSlD2BjcVkgpeXOLwPcYFBrbtJWp8E8JX1J4vSfoHPeY6aIxgYxXkf57cjGTApfRL8xawBmMDiF1FgQvpZYg==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-phrasing": "^4.0.0", @@ -2078,6 +1719,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/remark-lint-no-heading-indent/-/remark-lint-no-heading-indent-5.0.0.tgz", "integrity": "sha512-JWGIWhaEzH00HywI0DHex92tJ5Mw7l11shQ6/MGhRjYsHMRWcwWcVeOuktVMe/BiQbg0hRoE4+g0z2VgUD6Cqw==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-phrasing": "^4.0.0", @@ -2095,6 +1737,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/remark-lint-no-literal-urls/-/remark-lint-no-literal-urls-4.0.0.tgz", "integrity": "sha512-rl/3Ai4Ax9IH/fRpOJZuXk1HgYX6oFTauhmBOilpqbq/YT2kN3FuXaneXdRfKv1bgMdHaLKxHWxGj/mDyA2n8w==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-to-string": "^4.0.0", @@ -2112,6 +1755,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/remark-lint-no-multiple-toplevel-headings/-/remark-lint-no-multiple-toplevel-headings-4.0.0.tgz", "integrity": "sha512-JW11iYxza7asDdhQuKfr8SH1u4NBOCQ4U7Ru0HrKCPcT4y/AB1C1il5uMQzbcervgYPBq69xzyQ24+AJeL0t3A==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "devlop": "^1.0.0", @@ -2129,6 +1773,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/remark-lint-no-shell-dollars/-/remark-lint-no-shell-dollars-4.0.0.tgz", "integrity": "sha512-ye2h8FzjsgqqQV0HHN2g9N4FqI3eD9Gpgu7tU5ADIJyQ3mUJdwBoFn7IlGnpmumR1fb/l6u/AhRavIZxXYqG+Q==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "collapse-white-space": "^2.0.0", @@ -2145,6 +1790,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/remark-lint-no-shortcut-reference-image/-/remark-lint-no-shortcut-reference-image-4.0.0.tgz", "integrity": "sha512-YEiCpW5F/8/LZyxlOuVK2L/n0NJ1AB0AJK7oP39OVyEk3Xl7w+JQi6nZ3KiH6REh+PWGqKn6M0KEPL9cT/iAOw==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "unified-lint-rule": "^3.0.0", @@ -2159,6 +1805,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/remark-lint-no-shortcut-reference-link/-/remark-lint-no-shortcut-reference-link-4.0.0.tgz", "integrity": "sha512-6jka2Zz3I6G2MvDcKrwADYhTOxHMFMK854u1cfBEIH5/XnCCXROtoqiiDtbZw+NJqbmwsBKvGL4t2gnmEJUmgg==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "unified-lint-rule": "^3.0.0", @@ -2173,6 +1820,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/remark-lint-no-table-indentation/-/remark-lint-no-table-indentation-5.0.0.tgz", "integrity": "sha512-MaLmnzgirpnRiRjWwrsyOX0RmP2eG4YAv169MtsxTVa6O3CpUDwTuTzivudE9L0kVvTlyF9DXEmdyjm85LDyVA==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "devlop": "^1.0.0", @@ -2192,6 +1840,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/remark-lint-no-tabs/-/remark-lint-no-tabs-4.0.0.tgz", "integrity": "sha512-rQR7LDdcw047ajB3D+v9uzdB8aZfZtEdlUJvQXKkcVDteWiuXGC3PcIrmM/8n3J/wlFMuwoAaW2IcdlJf8HzXQ==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "unified-lint-rule": "^3.0.0", @@ -2206,6 +1855,7 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/remark-lint-no-trailing-spaces/-/remark-lint-no-trailing-spaces-3.0.2.tgz", "integrity": "sha512-4KxOdzZ+BlCZDu9yYsKGOfB8fknukxYD+9VhI1I5l7Ns7TgqdYq4k/qwUfTHpQ4TF9aokL/tOpsEGOc4PGKTKw==", + "license": "MIT", "dependencies": { "unified-lint-rule": "^3.0.0", "vfile-location": "^5.0.3" @@ -2215,6 +1865,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/remark-lint-no-undefined-references/-/remark-lint-no-undefined-references-5.0.0.tgz", "integrity": "sha512-O0q8bHpRHK1T85oqO+uep4BkvQnZZp3y+wahDeeLLq9dCJfF56sq6Tt5OOTt1BAOZlpobS3OPQHUiJWYP6hX1w==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "collapse-white-space": "^2.0.0", @@ -2234,6 +1885,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/remark-lint-no-unused-definitions/-/remark-lint-no-unused-definitions-4.0.0.tgz", "integrity": "sha512-YCZ6k575NCTx7mnN+9ls0G6YgMsZHi0LYQqfLW8MNVHBtbpTBvfmk8I39bmsvuKWeBD98weZoXSDqIiIGg+Q/g==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "devlop": "^1.0.0", @@ -2249,6 +1901,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/remark-lint-ordered-list-marker-style/-/remark-lint-ordered-list-marker-style-4.0.0.tgz", "integrity": "sha512-xZ7Xppy5fzACH4b9h1b4lTzVtNY2AlUkNTfl1Oe6cIKN8tk3juFxN0wL2RpktPtSZ7iRIabzFmg6l8WPhlASJA==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-phrasing": "^4.0.0", @@ -2267,6 +1920,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/remark-lint-prohibited-strings/-/remark-lint-prohibited-strings-4.0.0.tgz", "integrity": "sha512-dfLF4da5v3klRAdkHBLpNIC7WpvNdN7Eylgf+p19HPJn53CaxqlGjFvAQDAJU83xXEPWAmdonlx04GIS5ryLow==", + "license": "MIT", "dependencies": { "escape-string-regexp": "^5.0.0", "unified-lint-rule": "^2.0.0", @@ -2278,12 +1932,14 @@ "node_modules/remark-lint-prohibited-strings/node_modules/@types/unist": { "version": "2.0.11", "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.11.tgz", - "integrity": "sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==" + "integrity": "sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==", + "license": "MIT" }, "node_modules/remark-lint-prohibited-strings/node_modules/unified": { "version": "10.1.2", "resolved": "https://registry.npmjs.org/unified/-/unified-10.1.2.tgz", "integrity": "sha512-pUSWAi/RAnVy1Pif2kAoeWNBa3JVrx0MId2LASj8G+7AiHWoKZNTomq6LG326T68U7/e263X6fTdcXIy7XnF7Q==", + "license": "MIT", "dependencies": { "@types/unist": "^2.0.0", "bail": "^2.0.0", @@ -2302,6 +1958,7 @@ "version": "2.1.2", "resolved": "https://registry.npmjs.org/unified-lint-rule/-/unified-lint-rule-2.1.2.tgz", "integrity": "sha512-JWudPtRN7TLFHVLEVZ+Rm8FUb6kCAtHxEXFgBGDxRSdNMnGyTU5zyYvduHSF/liExlFB3vdFvsAHnNVE/UjAwA==", + "license": "MIT", "dependencies": { "@types/unist": "^2.0.0", "trough": "^2.0.0", @@ -2317,6 +1974,7 @@ "version": "3.0.3", "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-3.0.3.tgz", "integrity": "sha512-k5GzIBZ/QatR8N5X2y+drfpWG8IDBzdnVj6OInRNWm1oXrzydiaAT2OQiA8DPRRZyAKb9b6I2a6PxYklZD0gKg==", + "license": "MIT", "dependencies": { "@types/unist": "^2.0.0" }, @@ -2329,6 +1987,7 @@ "version": "5.3.7", "resolved": "https://registry.npmjs.org/vfile/-/vfile-5.3.7.tgz", "integrity": "sha512-r7qlzkgErKjobAmyNIkkSpizsFPYiUPuJb5pNW1RB4JcYVZhs4lIbVqk8XPk033CV/1z8ss5pkax8SuhGpcG8g==", + "license": "MIT", "dependencies": { "@types/unist": "^2.0.0", "is-buffer": "^2.0.0", @@ -2344,6 +2003,7 @@ "version": "3.1.4", "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-3.1.4.tgz", "integrity": "sha512-fa0Z6P8HUrQN4BZaX05SIVXic+7kE3b05PWAtPuYP9QLHsLKYR7/AlLW3NtOrpXRLeawpDLMsVkmk5DG0NXgWw==", + "license": "MIT", "dependencies": { "@types/unist": "^2.0.0", "unist-util-stringify-position": "^3.0.0" @@ -2357,6 +2017,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/remark-lint-rule-style/-/remark-lint-rule-style-4.0.0.tgz", "integrity": "sha512-Kt7IHMB5IbLgRFKaFUmB895sV3PTD0MBgN9CvXKxr1wHFF43S6tabjFIBSoQqyJRlhH0S3rK6Lvopofa009gLg==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-phrasing": "^4.0.0", @@ -2374,6 +2035,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/remark-lint-strong-marker/-/remark-lint-strong-marker-4.0.0.tgz", "integrity": "sha512-YcvuzakYhQWdCH+1E30sUY+wyvq+PNa77NZAMAYO/cS/pZczFB+q4Ccttw4Q+No/chX8oMfe0GYtm8dDWLei/g==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "unified-lint-rule": "^3.0.0", @@ -2390,6 +2052,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/remark-lint-table-cell-padding/-/remark-lint-table-cell-padding-5.0.0.tgz", "integrity": "sha512-LNyiHDQZBIOqcQGG1tYsZHW7g0v8OyRmRgDrD5WEsMaAYfM6EiECUokN/Q4py9h4oM/2KUSrdZbtfuZmy87/kA==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "@types/unist": "^3.0.0", @@ -2410,6 +2073,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/remark-lint-table-pipes/-/remark-lint-table-pipes-5.0.0.tgz", "integrity": "sha512-e7jzAScDrt5+eMomh099TZJBN2K9ldDxBu9iYhNu5C0YsdAvnckJkgilsuClxFpmx4LCVYaX0EGbt/hQ3LB3xg==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "@types/unist": "^3.0.0", @@ -2427,6 +2091,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/remark-lint-unordered-list-marker-style/-/remark-lint-unordered-list-marker-style-4.0.0.tgz", "integrity": "sha512-XlP4Wr4KJNovyWVv0H5axfUlF23iE9Kt2SxaVq4+ieum5YcMmKE6KsL+aqt3kiJb60SH1u6a0bxKFvdM/9riOA==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-phrasing": "^4.0.0", @@ -2444,6 +2109,7 @@ "version": "8.0.0", "resolved": "https://registry.npmjs.org/remark-message-control/-/remark-message-control-8.0.0.tgz", "integrity": "sha512-brpzOO+jdyE/mLqvqqvbogmhGxKygjpCUCG/PwSCU43+JZQ+RM+sSzkCWBcYvgF3KIAVNIoPsvXjBkzO7EdsYQ==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-comment-marker": "^3.0.0", @@ -2459,6 +2125,7 @@ "version": "11.0.0", "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-11.0.0.tgz", "integrity": "sha512-FCxlKLNGknS5ba/1lmpYijMUzX2esxW5xQqjWxw2eHFfS2MSdaHVINFmhjo+qN1WhZhNimq0dZATN9pH0IDrpA==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-from-markdown": "^2.0.0", @@ -2474,6 +2141,7 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/remark-preset-lint-node/-/remark-preset-lint-node-5.1.2.tgz", "integrity": "sha512-ukBPfLqD05AomGL+Z3tbmBCKTaEM+9Dv8Pn0r/0vok8F95Z0wj/AY70cFhm038ID1vKBD07anky11dvigDAHlw==", + "license": "MIT", "dependencies": { "js-yaml": "^4.1.0", "remark-gfm": "^4.0.0", @@ -2518,6 +2186,7 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/remark-preset-lint-recommended/-/remark-preset-lint-recommended-7.0.0.tgz", "integrity": "sha512-A9aPDL78OO12xG2a83DVd+M2QzdBMjn545fbXj40BFJdpt9t//MADkPAwRfpMCBkKi+iECPUTFCb3Jm8SsFG2w==", + "license": "MIT", "dependencies": { "remark-lint": "^10.0.0", "remark-lint-final-newline": "^3.0.0", @@ -2544,6 +2213,7 @@ "version": "11.0.0", "resolved": "https://registry.npmjs.org/remark-stringify/-/remark-stringify-11.0.0.tgz", "integrity": "sha512-1OSmLd3awB/t8qdoEOMazZkNsfVTeY4fTsgzcQFdXNq8ToTN4ZGwrMnlda4K6smTFKD+GRV6O48i6Z4iKgPPpw==", + "license": "MIT", "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-to-markdown": "^2.0.0", @@ -2554,93 +2224,11 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/resolve": { - "version": "1.22.8", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", - "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", - "dev": true, - "dependencies": { - "is-core-module": "^2.13.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - }, - "bin": { - "resolve": "bin/resolve" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/rollup": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.24.0.tgz", - "integrity": "sha512-DOmrlGSXNk1DM0ljiQA+i+o0rSLhtii1je5wgk60j49d1jHT5YYttBv1iWOnYSTG+fZZESUOSNiAl89SIet+Cg==", - "dev": true, - "dependencies": { - "@types/estree": "1.0.6" - }, - "bin": { - "rollup": "dist/bin/rollup" - }, - "engines": { - "node": ">=18.0.0", - "npm": ">=8.0.0" - }, - "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.24.0", - "@rollup/rollup-android-arm64": "4.24.0", - "@rollup/rollup-darwin-arm64": "4.24.0", - "@rollup/rollup-darwin-x64": "4.24.0", - "@rollup/rollup-linux-arm-gnueabihf": "4.24.0", - "@rollup/rollup-linux-arm-musleabihf": "4.24.0", - "@rollup/rollup-linux-arm64-gnu": "4.24.0", - "@rollup/rollup-linux-arm64-musl": "4.24.0", - "@rollup/rollup-linux-powerpc64le-gnu": "4.24.0", - "@rollup/rollup-linux-riscv64-gnu": "4.24.0", - "@rollup/rollup-linux-s390x-gnu": "4.24.0", - "@rollup/rollup-linux-x64-gnu": "4.24.0", - "@rollup/rollup-linux-x64-musl": "4.24.0", - "@rollup/rollup-win32-arm64-msvc": "4.24.0", - "@rollup/rollup-win32-ia32-msvc": "4.24.0", - "@rollup/rollup-win32-x64-msvc": "4.24.0", - "fsevents": "~2.3.2" - } - }, - "node_modules/rollup-plugin-cleanup": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/rollup-plugin-cleanup/-/rollup-plugin-cleanup-3.2.1.tgz", - "integrity": "sha512-zuv8EhoO3TpnrU8MX8W7YxSbO4gmOR0ny06Lm3nkFfq0IVKdBUtHwhVzY1OAJyNCIAdLiyPnOrU0KnO0Fri1GQ==", - "dev": true, - "dependencies": { - "js-cleanup": "^1.2.0", - "rollup-pluginutils": "^2.8.2" - }, - "engines": { - "node": "^10.14.2 || >=12.0.0" - }, - "peerDependencies": { - "rollup": ">=2.0" - } - }, - "node_modules/rollup-pluginutils": { - "version": "2.8.2", - "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz", - "integrity": "sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==", - "dev": true, - "dependencies": { - "estree-walker": "^0.6.1" - } - }, - "node_modules/rollup-pluginutils/node_modules/estree-walker": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz", - "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==", - "dev": true - }, "node_modules/semver": { "version": "7.6.3", "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "license": "ISC", "bin": { "semver": "bin/semver.js" }, @@ -2648,26 +2236,11 @@ "node": ">=10" } }, - "node_modules/skip-regex": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/skip-regex/-/skip-regex-1.0.2.tgz", - "integrity": "sha512-pEjMUbwJ5Pl/6Vn6FsamXHXItJXSRftcibixDmNCWbWhic0hzHrwkMZo0IZ7fMRH9KxcWDFSkzhccB4285PutA==", - "dev": true, - "engines": { - "node": ">=4.2" - } - }, - "node_modules/sourcemap-codec": { - "version": "1.4.8", - "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", - "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", - "deprecated": "Please use @jridgewell/sourcemap-codec instead", - "dev": true - }, "node_modules/space-separated-tokens": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz", "integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==", + "license": "MIT", "funding": { "type": "github", "url": "https://github.com/sponsors/wooorm" @@ -2677,6 +2250,7 @@ "version": "6.1.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-6.1.0.tgz", "integrity": "sha512-k01swCJAgQmuADB0YIc+7TuatfNvTBVOoaUWJjTB9R4VJzR5vNWzf5t42ESVZFPS8xTySF7CAdV4t/aaIm3UnQ==", + "license": "MIT", "dependencies": { "eastasianwidth": "^0.2.0", "emoji-regex": "^10.2.1", @@ -2693,6 +2267,7 @@ "version": "4.0.4", "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.4.tgz", "integrity": "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==", + "license": "MIT", "dependencies": { "character-entities-html4": "^2.0.0", "character-entities-legacy": "^3.0.0" @@ -2706,6 +2281,7 @@ "version": "7.1.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "license": "MIT", "dependencies": { "ansi-regex": "^6.0.1" }, @@ -2720,6 +2296,7 @@ "version": "9.4.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-9.4.0.tgz", "integrity": "sha512-VL+lNrEoIXww1coLPOmiEmK/0sGigko5COxI09KzHc2VJXJsQ37UaQ+8quuxjDeA7+KnLGTWRyOXSLLR2Wb4jw==", + "license": "MIT", "engines": { "node": ">=12" }, @@ -2727,22 +2304,11 @@ "url": "https://github.com/chalk/supports-color?sponsor=1" } }, - "node_modules/supports-preserve-symlinks-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", - "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", - "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/to-vfile": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/to-vfile/-/to-vfile-8.0.0.tgz", "integrity": "sha512-IcmH1xB5576MJc9qcfEC/m/nQCFt3fzMHz45sSlgJyTWjRbKW1HAkJpuf3DgE57YzIlZcwcBZA5ENQbBo4aLkg==", + "license": "MIT", "dependencies": { "vfile": "^6.0.0" }, @@ -2755,6 +2321,7 @@ "version": "2.2.0", "resolved": "https://registry.npmjs.org/trough/-/trough-2.2.0.tgz", "integrity": "sha512-tmMpK00BjZiUyVyvrBK7knerNgmgvcV/KLVyuma/SC+TQN167GrMRciANTz09+k3zW8L8t60jWO1GpfkZdjTaw==", + "license": "MIT", "funding": { "type": "github", "url": "https://github.com/sponsors/wooorm" @@ -2764,6 +2331,7 @@ "version": "11.0.5", "resolved": "https://registry.npmjs.org/unified/-/unified-11.0.5.tgz", "integrity": "sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA==", + "license": "MIT", "dependencies": { "@types/unist": "^3.0.0", "bail": "^2.0.0", @@ -2782,6 +2350,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/unified-lint-rule/-/unified-lint-rule-3.0.0.tgz", "integrity": "sha512-Sz96ILLsTy3djsG3H44zFb2b77MFf9CQVYnV3PWkxgRX8/n31fFrr+JnzUaJ6cbOHTtZnL1A71+YodsTjzwAew==", + "license": "MIT", "dependencies": { "@types/unist": "^3.0.0", "trough": "^2.0.0", @@ -2797,6 +2366,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/unified-message-control/-/unified-message-control-5.0.0.tgz", "integrity": "sha512-B2cSAkpuMVVmPP90KCfKdBhm1e9KYJ+zK3x5BCa0N65zpq1Ybkc9C77+M5qwR8FWO7RF3LM5QRRPZtgjW6DUCw==", + "license": "MIT", "dependencies": { "@types/unist": "^3.0.0", "devlop": "^1.0.0", @@ -2816,6 +2386,7 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.0.tgz", "integrity": "sha512-2qCTHimwdxLfz+YzdGfkqNlH0tLi9xjTnHddPmJwtIG9MGsdbutfTc4P+haPD7l7Cjxf/WZj+we5qfVPvvxfYw==", + "license": "MIT", "dependencies": { "@types/unist": "^3.0.0" }, @@ -2828,6 +2399,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-5.0.0.tgz", "integrity": "sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==", + "license": "MIT", "dependencies": { "@types/unist": "^3.0.0" }, @@ -2840,6 +2412,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-4.0.0.tgz", "integrity": "sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==", + "license": "MIT", "dependencies": { "@types/unist": "^3.0.0" }, @@ -2852,6 +2425,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-5.0.0.tgz", "integrity": "sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg==", + "license": "MIT", "dependencies": { "@types/unist": "^3.0.0", "unist-util-is": "^6.0.0", @@ -2866,6 +2440,7 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-6.0.1.tgz", "integrity": "sha512-L/PqWzfTP9lzzEa6CKs0k2nARxTdZduw3zyh8d2NVBnsyvHjSX4TWse388YrrQKbvI8w20fGjGlhgT96WwKykw==", + "license": "MIT", "dependencies": { "@types/unist": "^3.0.0", "unist-util-is": "^6.0.0" @@ -2879,6 +2454,7 @@ "version": "6.0.3", "resolved": "https://registry.npmjs.org/vfile/-/vfile-6.0.3.tgz", "integrity": "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==", + "license": "MIT", "dependencies": { "@types/unist": "^3.0.0", "vfile-message": "^4.0.0" @@ -2892,6 +2468,7 @@ "version": "5.0.3", "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-5.0.3.tgz", "integrity": "sha512-5yXvWDEgqeiYiBe1lbxYF7UMAIm/IcopxMHrMQDq3nvKcjPKIhZklUKL+AE7J7uApI4kwe2snsK+eI6UTj9EHg==", + "license": "MIT", "dependencies": { "@types/unist": "^3.0.0", "vfile": "^6.0.0" @@ -2905,6 +2482,7 @@ "version": "4.0.2", "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-4.0.2.tgz", "integrity": "sha512-jRDZ1IMLttGj41KcZvlrYAaI3CfqpLpfpf+Mfig13viT6NKvRzWZ+lXz0Y5D60w6uJIBAOGq9mSHf0gktF0duw==", + "license": "MIT", "dependencies": { "@types/unist": "^3.0.0", "unist-util-stringify-position": "^4.0.0" @@ -2918,6 +2496,7 @@ "version": "8.1.1", "resolved": "https://registry.npmjs.org/vfile-reporter/-/vfile-reporter-8.1.1.tgz", "integrity": "sha512-qxRZcnFSQt6pWKn3PAk81yLK2rO2i7CDXpy8v8ZquiEOMLSnPw6BMSi9Y1sUCwGGl7a9b3CJT1CKpnRF7pp66g==", + "license": "MIT", "dependencies": { "@types/supports-color": "^8.0.0", "string-width": "^6.0.0", @@ -2937,6 +2516,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/vfile-sort/-/vfile-sort-4.0.0.tgz", "integrity": "sha512-lffPI1JrbHDTToJwcq0rl6rBmkjQmMuXkAxsZPRS9DXbaJQvc642eCg6EGxcX2i1L+esbuhq+2l9tBll5v8AeQ==", + "license": "MIT", "dependencies": { "vfile": "^6.0.0", "vfile-message": "^4.0.0" @@ -2950,6 +2530,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/vfile-statistics/-/vfile-statistics-3.0.0.tgz", "integrity": "sha512-/qlwqwWBWFOmpXujL/20P+Iuydil0rZZNglR+VNm6J0gpLHwuVM5s7g2TfVoswbXjZ4HuIhLMySEyIw5i7/D8w==", + "license": "MIT", "dependencies": { "vfile": "^6.0.0", "vfile-message": "^4.0.0" @@ -2963,6 +2544,7 @@ "version": "2.0.4", "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz", "integrity": "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==", + "license": "MIT", "funding": { "type": "github", "url": "https://github.com/sponsors/wooorm" diff --git a/tools/lint-md/package.json b/tools/lint-md/package.json index dbc66273025..f7272f493d6 100644 --- a/tools/lint-md/package.json +++ b/tools/lint-md/package.json @@ -2,9 +2,6 @@ "name": "lint-md", "description": "markdown linting", "version": "1.0.0", - "scripts": { - "build": "rollup -f es -p '@rollup/plugin-node-resolve={exportConditions: [\"node\"]}' -p @rollup/plugin-commonjs -p rollup-plugin-cleanup lint-md.src.mjs --file lint-md.mjs" - }, "dependencies": { "remark-parse": "^11.0.0", "remark-preset-lint-node": "^5.1.2", @@ -12,11 +9,5 @@ "to-vfile": "^8.0.0", "unified": "^11.0.5", "vfile-reporter": "^8.1.1" - }, - "devDependencies": { - "@rollup/plugin-commonjs": "^28.0.1", - "@rollup/plugin-node-resolve": "^15.3.0", - "rollup": "^4.24.0", - "rollup-plugin-cleanup": "^3.2.1" } } diff --git a/vcbuild.bat b/vcbuild.bat index 6bd6b6a2e98..8b53e7f0675 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -122,7 +122,6 @@ if /i "%1"=="lint-js-build" set lint_js_build=1&goto arg-ok if /i "%1"=="lint-js-fix" set lint_js_fix=1&goto arg-ok if /i "%1"=="jslint" set lint_js=1&echo Please use lint-js instead of jslint&goto arg-ok if /i "%1"=="lint-md" set lint_md=1&goto arg-ok -if /i "%1"=="lint-md-build" set lint_md_build=1&goto arg-ok if /i "%1"=="lint" set lint_cpp=1&set lint_js=1&set lint_md=1&goto arg-ok if /i "%1"=="lint-ci" set lint_cpp=1&set lint_js_ci=1&goto arg-ok if /i "%1"=="format-md" set format_md=1&goto arg-ok @@ -750,24 +749,21 @@ echo running lint-js goto lint-js-fix :lint-js-fix -if not defined lint_js_fix goto lint-md-build +if not defined lint_js_fix goto lint-md if not exist tools\eslint\node_modules\eslint goto no-lint echo running lint-js-fix %node_exe% tools\eslint\node_modules\eslint\bin\eslint.js --cache --max-warnings=0 --report-unused-disable-directives --rule "@stylistic/js/linebreak-style: 0" eslint.config.mjs benchmark doc lib test tools --fix goto lint-md-build -:no-lint -echo Linting is not available through the source tarball. -echo Use the git repo instead: $ git clone https://github.com/nodejs/node.git -goto lint-md-build - :lint-md-build -if not defined lint_md_build goto lint-md -echo "Deprecated no-op target 'lint_md_build'" -goto lint-md +if not defined lint_md if not defined format_md goto lint-md +cd tools\lint-md +%npm_exe% ci +cd ..\.. :lint-md if not defined lint_md goto format-md +if not exist tools\lint-md\node_modules goto no-lint echo Running Markdown linter on docs... SETLOCAL ENABLEDELAYEDEXPANSION set lint_md_files= @@ -782,6 +778,7 @@ goto format-md :format-md if not defined format_md goto exit +if not exist tools\lint-md\node_modules goto no-lint echo Running Markdown formatter on docs... SETLOCAL ENABLEDELAYEDEXPANSION set lint_md_files= @@ -792,6 +789,10 @@ for /D %%D IN (doc\*) do ( ) %node_exe% tools\lint-md\lint-md.mjs --format %lint_md_files% ENDLOCAL + +:no-lint +echo Linting is not available through the source tarball. +echo Use the git repo instead: $ git clone https://github.com/nodejs/node.git goto exit :create-msvs-files-failed