import * as visit from 'unist-util-visit' ; import { Node } from 'unist' ; const regex = /^(text|txt)/ ; interface IAdditionalNode extends Node { lang : string ; } export const plaintextFix = ( ) => ( tree ) => { visit ( tree , 'code' , ( node ) => { if ( regex . test ( node . lang ) ) { node . lang = node . lang . replace ( regex , 'plaintext' ) ; } } ) ; return tree ; } ;