diff options
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/spec/ngdocSpec.js | 5 | ||||
| -rw-r--r-- | docs/src/ngdoc.js | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/docs/spec/ngdocSpec.js b/docs/spec/ngdocSpec.js index 3cd9834b..9eed24ca 100644 --- a/docs/spec/ngdocSpec.js +++ b/docs/spec/ngdocSpec.js @@ -150,6 +150,11 @@ describe('ngdoc', function() { toMatch('</pre>\n\n<h1 id="one">One</h1>\n\n<pre'); }); + it('should replace inline variable type hints', function() { + expect(new Doc().markdown('{@type string}')). + toMatch(/<a\s+.*?class=".*?type-hint type-hint-string.*?".*?>/); + }); + it('should ignore nested doc widgets', function() { expect(new Doc().markdown( 'before<div class="tabbable">\n' + diff --git a/docs/src/ngdoc.js b/docs/src/ngdoc.js index 7c07f00f..d66f33e6 100644 --- a/docs/src/ngdoc.js +++ b/docs/src/ngdoc.js @@ -214,6 +214,10 @@ Doc.prototype = { (title || url).replace(/^#/g, '').replace(/\n/g, ' ') + (isAngular ? '</code>' : '') + '</a>'; + }). + replace(/{@type\s+(\S+)(?:\s+(\S+))?}/g, function(_, type, url) { + url = url || '#'; + return '<a href="' + url + '" class="' + self.prepare_type_hint_class_name(type) + '">' + type + '</a>'; }); }); text = parts.join(''); |
