Browse Source

Merge eddd7dc8a3 into ff643c5bf5

pull/106/merge
Josh Emerson 8 years ago
committed by GitHub
parent
commit
098aabfca3
  1. 9
      lib/rules_core/linkify.js

9
lib/rules_core/linkify.js

@ -18,7 +18,7 @@ function isLinkClose(str) {
module.exports = function linkify(state) { module.exports = function linkify(state) {
var i, j, l, tokens, token, currentToken, nodes, ln, text, pos, lastPos, var i, j, l, tokens, token, currentToken, nodes, ln, text, pos, lastPos,
level, htmlLinkLevel, url, fullUrl, urlText, level, htmlLinkLevel, url, fullUrl, urlText, linkAttrs,
blockTokens = state.tokens, blockTokens = state.tokens,
links; links;
@ -98,8 +98,13 @@ module.exports = function linkify(state) {
nodes.push(token); nodes.push(token);
} }
linkAttrs = [ [ 'href', fullUrl ] ];
if (state.md.options.linkify.target) {
linkAttrs.push([ 'target', state.md.options.linkify.target ]);
}
token = new state.Token('link_open', 'a', 1); token = new state.Token('link_open', 'a', 1);
token.attrs = [ [ 'href', fullUrl ] ]; token.attrs = linkAttrs;
token.level = level++; token.level = level++;
token.markup = 'linkify'; token.markup = 'linkify';
token.info = 'auto'; token.info = 'auto';

Loading…
Cancel
Save