import { JsonDocsMethod } from '@stencil/core/internal' ; import { MarkdownTable } from './markdown-utils' ; const getName = ( method ) => `\`${ method . name }\`` ; const getDesc = ( method ) => `${ method . deprecation !== undefined ? `<span style="color:red">**[DEPRECATED]**</span> ${ method . deprecation }<br/><br/>` : '' }${ method . docs }` ; const getSignature = ( method ) => `\`${ method . signature }\`` ; export const methodsToMarkdown = ( methods ) => { const content = [ ] ; if ( methods . length === 0 ) return content ; content . push ( '## Methods' ) ; content . push ( '' ) ; const table = new MarkdownTable ( ) ; table . addHeader ( [ 'Method' , 'Description' , 'Signature' ] ) ; methods . forEach ( method => { table . addRow ( [ getName ( method ) , getDesc ( method ) , getSignature ( method ) ] ) ; } ) ; content . push ( ... table . toMarkdown ( ) ) ; content . push ( '' ) ; content . push ( '' ) ; return content ; } ;