UNPKG

@diplodoc/transform

Version:

A simple transformer of text in YFM (Yandex Flavored Markdown) to HTML

28 lines 1.26 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.yfm001 = void 0; // @ts-expect-error const markdownlint_rule_helpers_1 = require("markdownlint-rule-helpers"); exports.yfm001 = { names: ['YFM001', 'inline-code-length'], description: 'Inline code length', tags: ['line_length'], function: function YFM001(params, onError) { const { config } = params; const maxLength = Number(config.maximum || 100); (0, markdownlint_rule_helpers_1.filterTokens)(params, 'inline', (token) => { var _a; if (!((_a = token.children) === null || _a === void 0 ? void 0 : _a.some((child) => child.type === 'code_inline')) || !token.map) { return; } const tokenLines = params.lines.slice(token.map[0], token.map[1]); (0, markdownlint_rule_helpers_1.forEachInlineCodeSpan)(tokenLines.join('\n'), (code, currentLine) => { if (code.length <= maxLength) { return; } (0, markdownlint_rule_helpers_1.addErrorDetailIf)(onError, token.lineNumber + currentLine, maxLength, code.length, null, code); }); }); }, }; //# sourceMappingURL=yfm001.js.map