feat(ngdocs): external links to github, plunkr and jsfiddle available for code examples

This commit is contained in:
Matias Niemelä
2013-05-09 15:58:34 -04:00
committed by Misko Hevery
parent b6e5972eb3
commit c8197b44eb
3 changed files with 64 additions and 3 deletions

View File

@@ -105,7 +105,7 @@ Doc.prototype = {
IS_URL = /^(https?:\/\/|ftps?:\/\/|mailto:|\.|\/)/,
IS_ANGULAR = /^(api\/)?(angular|ng|AUTO)\./,
IS_HASH = /^#/,
parts = trim(text).split(/(<pre>[\s\S]*?<\/pre>|<doc:example(\S*).*?>[\s\S]*?<\/doc:example>|<example[^>]*>[\s\S]*?<\/example>)/),
parts = trim(text).split(/(<pre.*?>[\s\S]*?<\/pre>|<doc:example(\S*).*?>[\s\S]*?<\/doc:example>|<example[^>]*>[\s\S]*?<\/example>)/),
seq = 0,
placeholderMap = {};
@@ -191,9 +191,9 @@ Doc.prototype = {
return placeholder(example.toHtml());
}).
replace(/^<pre>([\s\S]*?)<\/pre>/mi, function(_, content){
replace(/^<pre(.*?)>([\s\S]*?)<\/pre>/mi, function(_, attrs, content){
return placeholder(
'<pre class="prettyprint linenums">' +
'<pre'+attrs+' class="prettyprint linenums">' +
content.replace(/</g, '&lt;').replace(/>/g, '&gt;') +
'</pre>');
}).

View File

@@ -241,3 +241,22 @@ ul.events > li > h3 {
.type-hint-number {
background:rgb(189, 63, 66);
}
.syntax-links {
background:#eee;
border:1px solid #ddd;
text-align:right;
padding:1em;
border-bottom:0;
border-top-left-radius:4px;
border-top-right-radius:4px;
}
.syntax-links a {
margin-left:10px;
}
.syntax-links + pre {
border-top-left-radius:0;
border-top-right-radius:0;
}