UNPKG

dgeni-markdown

Version:

dgeni markdown template for generating documentation from source code

22 lines (17 loc) 640 B
// change from https://github.com/angular/dgeni-packages/blob/master/ngdoc/inline-tag-defs/link.js var INLINE_LINK = /(\S+)(?:\s+([\s\S]+))?/; module.exports = function linkInlineTagDef(getLinkInfo, createDocMessage) { return { name: 'link', handler: function(doc, tagName, tagDescription) { // Parse out the uri and title return tagDescription.replace(INLINE_LINK, function(match, uri, title) { var linkInfo = getLinkInfo(uri, title, doc); if ( !linkInfo.valid ) { return linkInfo.title; } return '(' + linkInfo.title + ')[' + linkInfo.url + ']'; }); } }; };