horizontalRule.js 589 B

123456789101112131415
  1. /**
  2. * Turn Markdown link shortcuts into XHTML <a> tags.
  3. */
  4. showdown.subParser('horizontalRule', function (text, options, globals) {
  5. 'use strict';
  6. text = globals.converter._dispatch('horizontalRule.before', text, options, globals);
  7. var key = showdown.subParser('hashBlock')('<hr />', options, globals);
  8. text = text.replace(/^ {0,2}( ?-){3,}[ \t]*$/gm, key);
  9. text = text.replace(/^ {0,2}( ?\*){3,}[ \t]*$/gm, key);
  10. text = text.replace(/^ {0,2}( ?_){3,}[ \t]*$/gm, key);
  11. text = globals.converter._dispatch('horizontalRule.after', text, options, globals);
  12. return text;
  13. });