Christopher_Carsey
Staff
Created on
08-12-2020
03:27 PM
Edited on
08-06-2022
03:55 AM
By
apiMigrationUse
Article Id
220062
To compose and send email from FortiSOAR, a conversion is needed form Markdown (FortiSOAR's richtext format) to HTML. Below is an example of playbook jinja that converts basic Markdown syntax to HTML. It can be extended to add additional markdown elements should they be required.
{{
vars.markdownText
| regex_replace('\#\#\#\s*(.*)', '<h3>\\1</h3>')
| regex_replace('\#\#\s*(.*)', '<h2>\\1</h2>')
| regex_replace('\#\s*(.*)', '<h1>\\1</h1>')
| regex_replace('\*\*(.*?)\*\*', '<bold>\\1</bold>')
| regex_replace('\*(.*?)\*', '<em>\\1</em>')
| regex_replace('\~\~(.*?)\~\~', '<del>\\1</del>')
| regex_replace('!\[image\]\((.*)\)', '<img src="\\1" />')
| regex_replace('\[(.*)\]\((.*)\)', '<a href="\\2">\\1</a>')
| replace('\n', '<br />')
}}
Labels: