import { Association , HTML , LinkReference , StaticPhrasingContent } from 'mdast' ; import { Option } from 'ts-std' ; import { VFile } from 'vfile' ; import BaseWalker from '../../walker' ; const TODO_PREFIX = 'TODO:' ; function isLintDirective ( node ) { return node . value === '<!--lint disable no-undefined-references-->' ; } function isTodoLink ( node ) { let { label } = node as LinkReference & Association ; return ! ! label && label . startsWith ( TODO_PREFIX ) ; } export default class TodoLinksWalker extends BaseWalker < null > { constructor ( file ) { super ( null , file ) ; } protected async html ( node ) { if ( isLintDirective ( node ) ) { return null ; } else { return node ; } } protected async linkReference ( node ) { if ( isTodoLink ( node ) ) { return node . children ; } else { return node ; } } }