mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-27 19:18:48 +01:00
Reimplement MD049/emphasis-style, MD050/strong-style to use micromark parser (with smaller ranges and handling of multi-line fixes).
This commit is contained in:
parent
e1233aad4b
commit
7005a8a438
9 changed files with 1211 additions and 348 deletions
|
|
@ -203,6 +203,17 @@ function matchAndGetTokensByType(tokens, matchTypes, resultTypes) {
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the specified token iff it is of the desired type.
|
||||
*
|
||||
* @param {Token} token Micromark token candidate.
|
||||
* @param {string} type Desired type.
|
||||
* @returns {Token | null} Token instance.
|
||||
*/
|
||||
function tokenIfType(token, type) {
|
||||
return (token && (token.type === type)) ? token : null;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
"parse": micromarkParse,
|
||||
filterByPredicate,
|
||||
|
|
@ -210,5 +221,6 @@ module.exports = {
|
|||
getHtmlTagInfo,
|
||||
getMicromarkEvents,
|
||||
getTokenTextByType,
|
||||
matchAndGetTokensByType
|
||||
matchAndGetTokensByType,
|
||||
tokenIfType
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue