Class MarkdownUtil
java.lang.Object
ecmwf.common.text.MarkdownUtil
The Class MarkdownUtil.
Converts Markdown source to a restricted, safe HTML fragment - used for the
markdown Destination metadata
field type, both for its live edit-time preview and for its rendering into the Opsview notes export
(ExportDestinationMetaNotesAction), so the two are always byte-for-byte identical. CommonMark is parsed and
rendered to HTML first, then the result is run through a jsoup allow-list which strips anything not on it (including
all attributes other than the ones explicitly added), rather than trying to sanitise Markdown syntax itself - this
way the output stays predictable regardless of what the source contains.-
Method Summary
Modifier and TypeMethodDescriptionstatic StringtoEmailHtml(String markdown) To a complete HTML document suitable for an e-mail body.static StringtoMessageHtml(String markdown) To safe html for a message: single line breaks in the source are preserved.static StringtoPlainText(String markdown) To a readable plain-text approximation (paragraphs, lists, links, tables), for channels which cannot carry HTML.static StringtoSafeHtml(String markdown) To safe html.
-
Method Details
-
toSafeHtml
-
toMessageHtml
-
toEmailHtml
-
toPlainText
-