mirror of
https://git.studyfor.work/actions/action-send-mail.git
synced 2026-08-31 11:52:09 -04:00
Add markdown format support (#25)
Co-authored-by: Dawid Dziurla <dawidd0811@gmail.com>
This commit is contained in:
+32
@@ -0,0 +1,32 @@
|
||||
showdown.subParser('underline', function (text, options, globals) {
|
||||
'use strict';
|
||||
|
||||
if (!options.underline) {
|
||||
return text;
|
||||
}
|
||||
|
||||
text = globals.converter._dispatch('underline.before', text, options, globals);
|
||||
|
||||
if (options.literalMidWordUnderscores) {
|
||||
text = text.replace(/\b___(\S[\s\S]*?)___\b/g, function (wm, txt) {
|
||||
return '<u>' + txt + '</u>';
|
||||
});
|
||||
text = text.replace(/\b__(\S[\s\S]*?)__\b/g, function (wm, txt) {
|
||||
return '<u>' + txt + '</u>';
|
||||
});
|
||||
} else {
|
||||
text = text.replace(/___(\S[\s\S]*?)___/g, function (wm, m) {
|
||||
return (/\S$/.test(m)) ? '<u>' + m + '</u>' : wm;
|
||||
});
|
||||
text = text.replace(/__(\S[\s\S]*?)__/g, function (wm, m) {
|
||||
return (/\S$/.test(m)) ? '<u>' + m + '</u>' : wm;
|
||||
});
|
||||
}
|
||||
|
||||
// escape remaining underscores to prevent them being parsed by italic and bold
|
||||
text = text.replace(/(_)/g, showdown.helper.escapeCharactersCallback);
|
||||
|
||||
text = globals.converter._dispatch('underline.after', text, options, globals);
|
||||
|
||||
return text;
|
||||
});
|
||||
Reference in New Issue
Block a user