UNPKG

turndown-plugin-showdown

Version:
17 lines (16 loc) 519 B
function automaticLinks(turndownService){ turndownService.addRule('automaticLinks',{ filter: (node)=>{ return node.nodeName === 'A' && node.getAttribute('href') && ( node.textContent === node.getAttribute('href') || `mailto:${node.textContent}` === node.getAttribute('href') ); }, replacement: (content) =>{ return `<${content}>`; } }) } module.exports = automaticLinks;