mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
Convert markdownlint library to an ECMAScript module, replace markdownlint-micromark with micromark, stop publishing (large) markdownlint-browser.js, see https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c for guidance.
This commit is contained in:
parent
191226f070
commit
1e71f6f44e
140 changed files with 1087 additions and 10428 deletions
|
@ -4,6 +4,11 @@
|
|||
|
||||
const { newLineRe } = require("../helpers");
|
||||
|
||||
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/52529
|
||||
/** @typedef {import("./markdownlint.mjs").MarkdownItToken} MarkdownItToken */
|
||||
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/52529
|
||||
/** @typedef {import("./markdownlint.mjs").Plugin} Plugin */
|
||||
|
||||
/**
|
||||
* @callback InlineCodeSpanCallback
|
||||
* @param {string} code Code content.
|
||||
|
@ -67,7 +72,7 @@ function forEachInlineCodeSpan(input, handler) {
|
|||
/**
|
||||
* Freeze all freeze-able members of a token and its children.
|
||||
*
|
||||
* @param {import("./markdownlint").MarkdownItToken} token A markdown-it token.
|
||||
* @param {MarkdownItToken} token A markdown-it token.
|
||||
* @returns {void}
|
||||
*/
|
||||
function freezeToken(token) {
|
||||
|
@ -98,8 +103,7 @@ function freezeToken(token) {
|
|||
*/
|
||||
function annotateAndFreezeTokens(tokens, lines) {
|
||||
let trMap = null;
|
||||
// eslint-disable-next-line jsdoc/valid-types
|
||||
/** @type import("./markdownlint").MarkdownItToken[] */
|
||||
/** @type {MarkdownItToken[]} */
|
||||
// @ts-ignore
|
||||
const markdownItTokens = tokens;
|
||||
for (const token of markdownItTokens) {
|
||||
|
@ -148,10 +152,10 @@ function annotateAndFreezeTokens(tokens, lines) {
|
|||
/**
|
||||
* Gets an array of markdown-it tokens for the input.
|
||||
*
|
||||
* @param {import("./markdownlint").Plugin[]} markdownItPlugins Additional plugins.
|
||||
* @param {Plugin[]} markdownItPlugins Additional plugins.
|
||||
* @param {string} content Markdown content.
|
||||
* @param {string[]} lines Lines of Markdown content.
|
||||
* @returns {import("../lib/markdownlint").MarkdownItToken} Array of markdown-it tokens.
|
||||
* @returns {MarkdownItToken} Array of markdown-it tokens.
|
||||
*/
|
||||
function getMarkdownItTokens(markdownItPlugins, content, lines) {
|
||||
const markdownit = require("markdown-it");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue