Browse Source

Add markup info for autolink and linkifier tokens

pull/82/head
Alex Kocharin 10 years ago
parent
commit
b8f7b5b64e
  1. 4
      lib/rules_core/linkify.js
  2. 4
      lib/rules_inline/autolink.js

4
lib/rules_core/linkify.js

@ -101,6 +101,8 @@ module.exports = function linkify(state) {
token = new state.Token('link_open', 'a', 1); token = new state.Token('link_open', 'a', 1);
token.attrs = [ [ 'href', fullUrl ] ]; token.attrs = [ [ 'href', fullUrl ] ];
token.level = level++; token.level = level++;
token.markup = 'linkify';
token.info = 'auto';
nodes.push(token); nodes.push(token);
token = new state.Token('text', '', 0); token = new state.Token('text', '', 0);
@ -110,6 +112,8 @@ module.exports = function linkify(state) {
token = new state.Token('link_close', 'a', -1); token = new state.Token('link_close', 'a', -1);
token.level = --level; token.level = --level;
token.markup = 'linkify';
token.info = 'auto';
nodes.push(token); nodes.push(token);
lastPos = links[ln].lastIndex; lastPos = links[ln].lastIndex;

4
lib/rules_inline/autolink.js

@ -53,11 +53,15 @@ module.exports = function autolink(state, silent) {
if (!silent) { if (!silent) {
token = state.push('link_open', 'a', 1); token = state.push('link_open', 'a', 1);
token.attrs = [ [ 'href', fullUrl ] ]; token.attrs = [ [ 'href', fullUrl ] ];
token.markup = 'autolink';
token.info = 'auto';
token = state.push('text', '', 0); token = state.push('text', '', 0);
token.content = state.md.normalizeLinkText(url); token.content = state.md.normalizeLinkText(url);
token = state.push('link_close', 'a', -1); token = state.push('link_close', 'a', -1);
token.markup = 'autolink';
token.info = 'auto';
} }
state.pos += emailMatch[0].length; state.pos += emailMatch[0].length;

Loading…
Cancel
Save