import remark from 'remark' ; import visit from 'unist-util-visit' ; export function extractRepro ( markdown ) { let code = null ; function processCode ( ) { return ( ast ) => { visit ( ast , `code` , node => { if ( node . meta === `repro` && typeof node . value === `string` ) { code = node . value ; } } ) ; } ; } remark ( ) . use ( processCode ) . processSync ( markdown ) ; return code as string | null ; } ;