Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
/*********************
* Set up the parser *
*********************/
// Ignore some rules which only creates trouble
["list", "heading"].forEach((type) => {
simpleMarkdown.defaultRules[type] = {
order: Number.POSITIVE_INFINITY,
match: () => null // Never match anything in order to ignore this rule
};
});
// Shorthand for the parser
const mdParse = simpleMarkdown.defaultBlockParse;
/*****************************
* Make the parsing function *
*****************************/
/**
* Parse Discord's Markdown format to Telegram-accepted HTML
*
* @param {String} text The markdown string to convert
*
* @return {String} Telegram-friendly HTML
*/
function md2html(text) {
// Escape HTML in the input
const processedText = escapeHTMLSpecialChars(text);