Markdown (global function)

This global function takes Markdown text and turns it into HTML.

This function is a shortcut helper function uses the MarkdownParser/Extended classes to turn Markdown into HTML. The function supports both the basic Markdown parser and extended parser via the lnMode parameter. The extended parser provides link, code and FontAwesome font parsing features not provided in the base parser.

This function by default caches the Markdown parser instance, using the lnMode options you provide in the parameter. The caching ensures best performance and avoidance of reloading of the underlying parser each time the function is called which results in very fast operation. It's recommended that you call this function once on application startup to establish the 'initial configuration' based on the lnMode parameter which is then cached. You can use the llReload parameter to force reloading with new settings.

o.MarkdownParser.Markdown(lcMarkdown,lnMode,
                          llReload,llUtf8,
                          llNoSanitizeHtml,
                          llNoHtmlAllowed)

Return Value

HTML parsed from Markdown

Parameters

lcMarkdown
Markdown text to turn into HTML

lnMode
Determines the mode the parser runs in

  • 0 or not specified - simple standard Markdown mode (default)
  • 2 extended
  • 1 - standard leave scripts
  • 3 - extended leave scripts

llReload
Optional - Forces the parser object to be reloaded. By default a cached version is used and the first load determines the parser instance used.

llUtf8
Optional - encodes the markdown to utf-8 before sending it to the parser.

llNoSanitizeHtml
Optional - When .T. won't try to strip script code and event tags from the document. By default scripts and scriptable code is removed.

llNoHtmlAllowed
If set raw HTML are not processed as HTML in the Markdown text and instead are HTML encoded.


See also:

Class MarkdownParser

© West Wind Technologies, 2023 • Updated: 03/28/19
Comment or report problem with topic