mirror of
https://github.com/dawidd6/action-send-mail.git
synced 2025-10-11 22:11:27 +07:00
Add markdown format support (#25)
Co-authored-by: Dawid Dziurla <dawidd0811@gmail.com>
This commit is contained in:
42
node_modules/showdown/src/subParsers/blockQuotes.js
generated
vendored
Normal file
42
node_modules/showdown/src/subParsers/blockQuotes.js
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
showdown.subParser('blockQuotes', function (text, options, globals) {
|
||||
'use strict';
|
||||
|
||||
text = globals.converter._dispatch('blockQuotes.before', text, options, globals);
|
||||
|
||||
// add a couple extra lines after the text and endtext mark
|
||||
text = text + '\n\n';
|
||||
|
||||
var rgx = /(^ {0,3}>[ \t]?.+\n(.+\n)*\n*)+/gm;
|
||||
|
||||
if (options.splitAdjacentBlockquotes) {
|
||||
rgx = /^ {0,3}>[\s\S]*?(?:\n\n)/gm;
|
||||
}
|
||||
|
||||
text = text.replace(rgx, function (bq) {
|
||||
// attacklab: hack around Konqueror 3.5.4 bug:
|
||||
// "----------bug".replace(/^-/g,"") == "bug"
|
||||
bq = bq.replace(/^[ \t]*>[ \t]?/gm, ''); // trim one level of quoting
|
||||
|
||||
// attacklab: clean up hack
|
||||
bq = bq.replace(/¨0/g, '');
|
||||
|
||||
bq = bq.replace(/^[ \t]+$/gm, ''); // trim whitespace-only lines
|
||||
bq = showdown.subParser('githubCodeBlocks')(bq, options, globals);
|
||||
bq = showdown.subParser('blockGamut')(bq, options, globals); // recurse
|
||||
|
||||
bq = bq.replace(/(^|\n)/g, '$1 ');
|
||||
// These leading spaces screw with <pre> content, so we need to fix that:
|
||||
bq = bq.replace(/(\s*<pre>[^\r]+?<\/pre>)/gm, function (wholeMatch, m1) {
|
||||
var pre = m1;
|
||||
// attacklab: hack around Konqueror 3.5.4 bug:
|
||||
pre = pre.replace(/^ /mg, '¨0');
|
||||
pre = pre.replace(/¨0/g, '');
|
||||
return pre;
|
||||
});
|
||||
|
||||
return showdown.subParser('hashBlock')('<blockquote>\n' + bq + '\n</blockquote>', options, globals);
|
||||
});
|
||||
|
||||
text = globals.converter._dispatch('blockQuotes.after', text, options, globals);
|
||||
return text;
|
||||
});
|
Reference in New Issue
Block a user