mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 22:10:13 +01:00
Improve type safety by strongly-typing the micromark token type property everywhere.
This commit is contained in:
parent
828ae3541a
commit
28e1b23955
7 changed files with 106 additions and 50 deletions
10
lib/md051.js
10
lib/md051.js
|
|
@ -19,15 +19,11 @@ const tokensInclude = new Set(
|
|||
[ "characterEscapeValue", "codeTextData", "data" ]
|
||||
);
|
||||
|
||||
/**
|
||||
* @typedef {import("../helpers/micromark.cjs").Token} Token
|
||||
*/
|
||||
|
||||
/**
|
||||
* Converts a Markdown heading into an HTML fragment according to the rules
|
||||
* used by GitHub.
|
||||
*
|
||||
* @param {Token} headingText Heading text token.
|
||||
* @param {import("../helpers/micromark.cjs").Token} headingText Heading text token.
|
||||
* @returns {string} Fragment string for heading.
|
||||
*/
|
||||
function convertHeadingToHTMLFragment(headingText) {
|
||||
|
|
@ -56,7 +52,7 @@ function convertHeadingToHTMLFragment(headingText) {
|
|||
/**
|
||||
* Unescapes the text of a String-type micromark Token.
|
||||
*
|
||||
* @param {Token} token String-type micromark Token.
|
||||
* @param {import("../helpers/micromark.cjs").Token} token String-type micromark Token.
|
||||
* @returns {string} Unescaped token text.
|
||||
*/
|
||||
function unescapeStringTokenText(token) {
|
||||
|
|
@ -112,6 +108,8 @@ module.exports = {
|
|||
}
|
||||
|
||||
// Process link and definition fragments
|
||||
// eslint-disable-next-line jsdoc/valid-types
|
||||
/** @type import("../helpers/micromark.cjs").TokenType[][] */
|
||||
const parentChilds = [
|
||||
[ "link", "resourceDestinationString" ],
|
||||
[ "definition", "definitionDestinationString" ]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue