mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
35 lines
1.2 KiB
JavaScript
35 lines
1.2 KiB
JavaScript
|
/**
|
||
|
* Created by Estevao on 11-01-2015.
|
||
|
*/
|
||
|
|
||
|
/**
|
||
|
* These are all the transformations that occur *within* block-level
|
||
|
* tags like paragraphs, headers, and list items.
|
||
|
*/
|
||
|
showdown.subParser('spanGamut', function (text, options, globals) {
|
||
|
'use strict';
|
||
|
|
||
|
|
||
|
text = showdown.subParser('codeSpans')(text, options, globals);
|
||
|
text = showdown.subParser('escapeSpecialCharsWithinTagAttributes')(text, options, globals);
|
||
|
text = showdown.subParser('encodeBackslashEscapes')(text, options, globals);
|
||
|
|
||
|
// Process anchor and image tags. Images must come first,
|
||
|
// because ![foo][f] looks like an anchor.
|
||
|
text = showdown.subParser('images')(text, options, globals);
|
||
|
text = showdown.subParser('anchors')(text, options, globals);
|
||
|
|
||
|
// Make links out of things like `<http://example.com/>`
|
||
|
// Must come after _DoAnchors(), because you can use < and >
|
||
|
// delimiters in inline links like [this](<url>).
|
||
|
text = showdown.subParser('autoLinks')(text, options, globals);
|
||
|
text = showdown.subParser('encodeAmpsAndAngles')(text, options, globals);
|
||
|
text = showdown.subParser('italicsAndBold')(text, options, globals);
|
||
|
|
||
|
// Do hard breaks:
|
||
|
text = text.replace(/ +\n/g, ' <br />\n');
|
||
|
|
||
|
return text;
|
||
|
|
||
|
});
|