mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 22:10:13 +01:00
Update all references to "params.tokens" to "params.parsers.markdownit.tokens" for clarity.
This commit is contained in:
parent
5302ee45de
commit
4b27bac79b
15 changed files with 45 additions and 37 deletions
|
|
@ -1199,12 +1199,16 @@ test("htmlElementRanges", (t) => {
|
|||
"Text `<br/>` text",
|
||||
"text <br/> text"
|
||||
],
|
||||
"tokens": [
|
||||
{
|
||||
"type": "code_block",
|
||||
"map": [ 10, 12 ]
|
||||
"parsers": {
|
||||
"markdownit": {
|
||||
"tokens": [
|
||||
{
|
||||
"type": "code_block",
|
||||
"map": [ 10, 12 ]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
const expected = [
|
||||
[ 3, 5, 12 ],
|
||||
|
|
|
|||
|
|
@ -1193,7 +1193,9 @@ test("token-map-spans", (t) => {
|
|||
"function": function tokenMapSpans(params) {
|
||||
const tokenLines = [];
|
||||
let lastLineNumber = -1;
|
||||
const inlines = params.tokens.filter((c) => c.type === "inline");
|
||||
const inlines = params.parsers.markdownit.tokens.filter(
|
||||
(c) => c.type === "inline"
|
||||
);
|
||||
for (const token of inlines) {
|
||||
t.truthy(token.map);
|
||||
for (let i = token.map[0]; i < token.map[1]; i++) {
|
||||
|
|
|
|||
|
|
@ -10,13 +10,13 @@ module.exports = {
|
|||
"/blob/main/test/rules/letters-E-X.js"
|
||||
),
|
||||
"tags": [ "test" ],
|
||||
"function": function rule(params, onError) {
|
||||
for (const inline of params.tokens.filter(function filterToken(token) {
|
||||
return token.type === "inline";
|
||||
})) {
|
||||
for (const text of inline.children.filter(function filterChild(child) {
|
||||
return child.type === "text";
|
||||
})) {
|
||||
"function": (params, onError) => {
|
||||
for (const inline of params.parsers.markdownit.tokens.filter(
|
||||
(token) => token.type === "inline"
|
||||
)) {
|
||||
for (const text of inline.children.filter(
|
||||
(child) => child.type === "text"
|
||||
)) {
|
||||
const index = text.content.toLowerCase().indexOf("ex");
|
||||
if (index !== -1) {
|
||||
onError({
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ module.exports = {
|
|||
"description": "Sample rule",
|
||||
"tags": [ "sample" ],
|
||||
"function": function rule(params, onError) {
|
||||
for (const token of params.tokens) {
|
||||
for (const token of params.parsers.markdownit.tokens) {
|
||||
if (token.type === "hr") {
|
||||
onError({
|
||||
"lineNumber": token.lineNumber,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue