links.js 585 B

1234567891011121314151617181920
  1. showdown.subParser('makeMarkdown.links', function (node, globals) {
  2. 'use strict';
  3. var txt = '';
  4. if (node.hasChildNodes() && node.hasAttribute('href')) {
  5. var children = node.childNodes,
  6. childrenLength = children.length;
  7. txt = '[';
  8. for (var i = 0; i < childrenLength; ++i) {
  9. txt += showdown.subParser('makeMarkdown.node')(children[i], globals);
  10. }
  11. txt += '](';
  12. txt += '<' + node.getAttribute('href') + '>';
  13. if (node.hasAttribute('title')) {
  14. txt += ' "' + node.getAttribute('title') + '"';
  15. }
  16. txt += ')';
  17. }
  18. return txt;
  19. });