Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

markdownlint

Package Overview
Dependencies
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

markdownlint - npm Package Compare versions

Comparing version 0.20.2 to 0.20.3

0

CONTRIBUTING.md

@@ -0,0 +0,0 @@ # Contributing

@@ -0,0 +0,0 @@ # Custom Rules

@@ -0,0 +0,0 @@ # Rules

28

helpers/helpers.js

@@ -28,5 +28,8 @@ // @ts-check

// Regular expression for emphasis markers
const emphasisMarkersRe = /[_*]+/g;
// Regular expression for all instances of emphasis markers
const emphasisMarkersRe = /[_*]/g;
// Regular expression for inline links and shortcut reference links
const linkRe = /\[(?:[^[\]]|\[[^\]]*\])*\](?:\(\S*\))?/g;
// readFile options for reading with the UTF-8 encoding

@@ -256,3 +259,3 @@ module.exports.utf8Encoding = { "encoding": "utf8" };

lineMetadata.forEach(function forMetadata(metadata) {
// Parameters: line, lineIndex, inCode, onFence, inTable, inBreak
// Parameters: line, lineIndex, inCode, onFence, inTable, inItem, inBreak
handler(...metadata);

@@ -499,3 +502,3 @@ });

/**
* Returns a list of emphasis markers in code spans.
* Returns a list of emphasis markers in code spans and links.
*

@@ -505,5 +508,6 @@ * @param {Object} params RuleParams instance.

*/
function emphasisMarkersInCodeSpans(params) {
function emphasisMarkersInContent(params) {
const { lines } = params;
const byLine = new Array(lines.length);
// Search code spans
filterTokens(params, "inline", (token) => {

@@ -531,5 +535,17 @@ const { children, lineNumber, map } = token;

});
// Search links
lines.forEach((tokenLine, tokenLineIndex) => {
let linkMatch = null;
while ((linkMatch = linkRe.exec(tokenLine))) {
let markerMatch = null;
while ((markerMatch = emphasisMarkersRe.exec(linkMatch[0]))) {
const inLine = byLine[tokenLineIndex] || [];
inLine.push(linkMatch.index + markerMatch.index);
byLine[tokenLineIndex] = inLine;
}
}
});
return byLine;
}
module.exports.emphasisMarkersInCodeSpans = emphasisMarkersInCodeSpans;
module.exports.emphasisMarkersInContent = emphasisMarkersInContent;

@@ -536,0 +552,0 @@ /**

{
"name": "markdownlint-rule-helpers",
"version": "0.9.0",
"version": "0.10.0",
"description": "A collection of markdownlint helper functions for custom rules",

@@ -5,0 +5,0 @@ "main": "helpers.js",

@@ -0,0 +0,0 @@ # markdownlint-rule-helpers

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ export = markdownlint;

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ // @ts-check

@@ -5,8 +5,8 @@ // @ts-check

const { addErrorContext, emphasisMarkersInCodeSpans, forEachLine,
includesSorted, isBlankLine } = require("../helpers");
const { addErrorContext, emphasisMarkersInContent, forEachLine, isBlankLine } =
require("../helpers");
const { lineMetadata } = require("./cache");
const emphasisRe = /(^|[^\\])(?:(\*\*?\*?)|(__?_?))/g;
const asteriskListItemMarkerRe = /^(\s*)\*(\s+)/;
const emphasisRe = /(^|[^\\]|\\\\)(?:(\*\*?\*?)|(__?_?))/g;
const asteriskListItemMarkerRe = /^([\s>]*)\*(\s+)/;
const leftSpaceRe = /^\s+/;

@@ -70,3 +70,3 @@ const rightSpaceRe = /\s+$/;

// Initialize
const ignoreMarkersByLine = emphasisMarkersInCodeSpans(params);
const ignoreMarkersByLine = emphasisMarkersInContent(params);
resetRunTracking();

@@ -94,4 +94,4 @@ forEachLine(

const matchIndex = match.index + match[1].length;
if (includesSorted(ignoreMarkersForLine, matchIndex)) {
// Ignore emphasis markers inside code spans
if (ignoreMarkersForLine.includes(matchIndex)) {
// Ignore emphasis markers inside code spans and links
continue;

@@ -107,27 +107,34 @@ }

effectiveEmphasisLength = matchLength;
} else if (
(matchLength === effectiveEmphasisLength) &&
(matchKind === emphasisKind)
) {
// Ending an existing run, report any pending error
if (pendingError) {
addErrorContext(...pendingError);
pendingError = null;
} else if (matchKind === emphasisKind) {
// Matching emphasis markers
if (matchLength === effectiveEmphasisLength) {
// Ending an existing run, report any pending error
if (pendingError) {
addErrorContext(...pendingError);
pendingError = null;
}
const error = handleRunEnd(
line, lineIndex, effectiveEmphasisLength, match, matchIndex);
if (error) {
addErrorContext(...error);
}
// Reset
resetRunTracking();
} else if (matchLength === 3) {
// Swap internal run length (1->2 or 2->1)
effectiveEmphasisLength = matchLength - effectiveEmphasisLength;
} else if (effectiveEmphasisLength === 3) {
// Downgrade internal run (3->1 or 3->2)
effectiveEmphasisLength -= matchLength;
} else {
// Upgrade to internal run (1->3 or 2->3)
effectiveEmphasisLength += matchLength;
}
const error = handleRunEnd(
line, lineIndex, effectiveEmphasisLength, match, matchIndex);
if (error) {
addErrorContext(...error);
}
// Reset
resetRunTracking();
} else if (matchLength === 3) {
// Swap internal run length (1->2 or 2->1)
effectiveEmphasisLength = matchLength - effectiveEmphasisLength;
} else if (effectiveEmphasisLength === 3) {
// Downgrade internal run (3->1 or 3->2)
effectiveEmphasisLength -= matchLength;
} else {
// Upgrade to internal run (1->3 or 2->3)
effectiveEmphasisLength += matchLength;
// Back up one character so RegExp has a chance to match the
// next marker (ex: "**star**_underscore_")
emphasisRe.lastIndex--;
} else if (emphasisRe.lastIndex > 1) {
// Back up one character so RegExp has a chance to match the
// mis-matched marker (ex: "*text_*")
emphasisRe.lastIndex--;
}

@@ -134,0 +141,0 @@ }

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ // @ts-check

@@ -43,3 +43,10 @@ // @ts-check

}
const range = [ matchIndex + 1, matchLength ];
const range = (matchIndex === -1) ?
null :
[ matchIndex + 1, matchLength ];
const fixInfo = (matchIndex === -1) ? null : {
"editColumn": matchIndex + 1,
"deleteCount": matchLength,
"insertText": name
};
addErrorDetailIf(

@@ -53,7 +60,3 @@ onError,

range,
{
"editColumn": matchIndex + 1,
"deleteCount": matchLength,
"insertText": name
}
fixInfo
);

@@ -60,0 +63,0 @@ }

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ // @ts-check

{
"name": "markdownlint",
"version": "0.20.2",
"version": "0.20.3",
"description": "A Node.js style checker and lint tool for Markdown/CommonMark files.",

@@ -27,3 +27,7 @@ "main": "lib/markdownlint.js",

"build-example": "npm install --no-save --ignore-scripts grunt grunt-cli gulp through2",
"example": "cd example && node standalone.js && grunt markdownlint --force && gulp markdownlint"
"example": "cd example && node standalone.js && grunt markdownlint --force && gulp markdownlint",
"clone-test-repos": "make-dir test-repos && cd test-repos && git clone https://github.com/eslint/eslint eslint-eslint --depth 1 --no-tags --quiet && git clone https://github.com/mkdocs/mkdocs mkdocs-mkdocs --depth 1 --no-tags --quiet && git clone https://github.com/pi-hole/docs pi-hole-docs --depth 1 --no-tags --quiet",
"clone-test-repos-large": "npm run clone-test-repos && cd test-repos && git clone https://github.com/dotnet/docs dotnet-docs --depth 1 --no-tags --quiet",
"lint-test-repos": "node test/markdownlint-test-repos.js",
"clean-test-repos": "rimraf test-repos"
},

@@ -39,8 +43,9 @@ "engines": {

"browserify": "~16.5.1",
"c8": "~7.1.0",
"c8": "~7.1.2",
"cpy-cli": "~3.1.0",
"eslint": "~6.8.0",
"eslint-plugin-jsdoc": "~22.1.0",
"glob": "~7.1.6",
"globby": "~11.0.0",
"js-yaml": "~3.13.1",
"make-dir-cli": "~2.0.0",
"markdown-it-for-inline": "~0.1.1",

@@ -52,2 +57,3 @@ "markdown-it-katex": "~2.0.3",

"rimraf": "~3.0.2",
"strip-json-comments": "~3.1.0",
"tape": "~4.13.2",

@@ -54,0 +60,0 @@ "tape-player": "~0.1.0",

@@ -782,2 +782,3 @@ # markdownlint

* [Garden React Components](https://garden.zendesk.com/react-components/) ([Search repository](https://github.com/zendeskgarden/react-components/search?q=markdownlint))
* [MkDocs](https://www.mkdocs.org/) ([Search repository](https://github.com/mkdocs/mkdocs/search?q=markdownlint))
* [Mocha](https://mochajs.org/) ([Search repository](https://github.com/mochajs/mocha/search?q=markdownlint))

@@ -861,7 +862,8 @@ * [Reactable](https://glittershark.github.io/reactable/) ([Search repository](https://github.com/glittershark/reactable/search?q=markdownlint))

comments, update dependencies.
* 0.20.0 - Add `markdownlint-configure-file` inline comment,
improve MD005/MD007/MD013/MD018/MD029/MD031/MD034/MD037/MD038/MD039, improve HTML
* 0.20.0 - Add `markdownlint-configure-file` inline comment, reimplement MD037,
improve MD005/MD007/MD013/MD018/MD029/MD031/MD034/MD038/MD039, improve HTML
comment handling, update dependencies.
* 0.20.1 - Fix regression in MD037.
* 0.20.2 - Fix regression in MD037, improve MD038.
* 0.20.3 - Fix regression in MD037, improve MD044, add automatic regression testing.

@@ -868,0 +870,0 @@ [npm-image]: https://img.shields.io/npm/v/markdownlint.svg

@@ -0,0 +0,0 @@ // @ts-check

@@ -0,0 +0,0 @@ {

@@ -0,0 +0,0 @@ {

@@ -0,0 +0,0 @@ {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc