UNPKG

@diplodoc/transform

Version:

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

29 lines (27 loc) 882 B
import {Rule} from 'markdownlint'; export const yfm007: Rule = { names: ['YFM007', 'term-used-without-definition'], description: 'Term used without definition', tags: ['term'], function: function YFM007(params, onError) { const {config} = params; if (!config) { return; } params.tokens.forEach((el) => el.children ?.filter((token) => { return token.type === '__yfm_lint'; }) .forEach((term) => { // @ts-expect-error bad markdownlint typings if (term.attrGet('YFM007')) { onError({ lineNumber: term.lineNumber, context: term.line, }); } }), ); }, };