Skip to content

Commit

Permalink
Add a link target for external links
Browse files Browse the repository at this point in the history
  • Loading branch information
davidshimjs committed Jan 22, 2015
1 parent b436c04 commit f423054
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,11 @@ function generate(title, docs, filename, resolveLinks) {

if (resolveLinks) {
html = helper.resolveLinks(html); // turn {@link foo} into <a href="foodoc.html">foo</a>

// Add a link target for external links @davidshimjs
html = html.toString().replace(/<a\s+([^>]*href\s*=\s*['"]*[^\s'"]*:\/\/)/ig, '<a target="_blank" $1');
}

fs.writeFileSync(outpath, html, 'utf8');
}

Expand Down

0 comments on commit f423054

Please sign in to comment.