How to use the simple-markdown.defaultBlockParse function in simple-markdown

To help you get started, we’ve selected a few simple-markdown examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TediCross / TediCross / src / discord2telegram / md2html.js View on Github external
}

/*********************
 * 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);