Markdownify
Markdownify is a tool that converts HTML to Markdown and vice versa, supporting GitHub Flavored Markdown.
Markdownify is a versatile tool for converting HTML to Markdown and vice versa, using GitHub Flavored Markdown (cmark-gfm). This connector allows Swimlane Turbine users to seamlessly automate the conversion of text formats, enhancing the flexibility and efficiency of document handling within security workflows. By integrating Markdownify, users can effortlessly transform HTML content into Markdown for easier readability and editing, or convert Markdown back to HTML for web compatibility, all without writing a single line of code.
Options
This connector supports the following options:
strip
A list of tags to strip. This option can't be used with the convert option.
convert
A list of tags to convert. This option can't be used with the strip option.
autolinks
A boolean indicating whether the "automatic link" style should be used when a a tag's contents match its href. Defaults to True.
default_title
A boolean to enable setting the title of a link to its href, if no title is given. Defaults to False.
heading_style
Defines how headings should be converted. Accepted values are ATX, ATX_CLOSED, SETEXT, and UNDERLINED (which is an alias for SETEXT). Defaults to UNDERLINED.
bullets
An iterable (string, list, or tuple) of bullet styles to be used. If the iterable only contains one item, it will be used regardless of how deeply lists are nested. Otherwise, the bullet will alternate based on nesting level. Defaults to '*+-'.
strong_em_symbol
In markdown, both * and _ are used to encode strong or emphasized texts. Either of these symbols can be chosen by the options ASTERISK (default) or UNDERSCORE respectively.
sub_symbol, sup_symbol
Define the chars that surround <sub> and <sup> text. Defaults to an empty string, because this is non-standard behavior. Could be something like ~ and ^ to result in ~sub~ and ^sup^.
newline_style
Defines the style of marking linebreaks (<br>) in markdown. The default value SPACES of this option will adopt the usual two spaces and a newline, while BACKSLASH will convert a linebreak to \\n (a backslash and a newline). While the latter convention is non-standard, it is commonly preferred and supported by a lot of interpreters.
escape_asterisks
If set to False, do not escape * to \* in text. Defaults to True.
escape_underscores
If set to False, do not escape _ to \_ in text. Defaults to True.
keep_inline_images_in
Images are converted to their alt-text when the images are located inside headlines or table cells. If some inline images should be converted to markdown images instead, this option can be set to a list of parent tags that should be allowed to contain inline images, for example ['td']. Defaults to an empty list.
wrap, wrap_width
If wrap is set to True, all text paragraphs are wrapped at wrap_width characters. Defaults to False and 80. Use with newline_style=BACKSLASH to keep line breaks in paragraphs.
Actions
HTML to Markdown
Convert HTML text to Markdown format using the provided HTML input.
Input
Argument Name | Type | Required | Description |
|---|---|---|---|
html | string | Required | HTML string to convert. |
autolinks | boolean | Optional | A boolean indicating whether the “automatic link” style should be used when a a tag’s contents match its href. |
bullets | array | Optional | An iterable list of bullet styles to be used. If the iterable only contains one item, it will be used regardless of how deeply lists are nested. Otherwise, the bullet will alternate based on nesting level. Defaults to '*+-' |
convert | array | Optional | A list of tags to convert. This option can’t be used with the strip option. |
default_title | boolean | Optional | A boolean to enable setting the title of a link to its href, if no title is given. |
escape_asterisks | boolean | Optional | If set to False, do not escape * to * in text. |
escape_underscores | boolean | Optional | If set to False, do not escape _ to _ in text. |
heading_style | string | Optional | Defines how headings should be converted. Accepted values are ATX, ATX_CLOSED, SETEXT, and UNDERLINED (which is an alias for SETEXT). |
keep_inline_images_in | array | Optional | Images are converted to their alt-text when the images are located inside headlines or table cells. If some inline images should be converted to markdown images instead, this option can be set to a list of parent tags that should be allowed to contain inline images, for example ['td']. |
newline_style | string | Optional | Defines the style of marking linebreaks ( ) in markdown. The default value SPACES of this option will adopt the usual two spaces and a newline, while BACKSLASH will convert a linebreak to \n (a backslash and a newline). While the latter convention is non-standard, it is commonly preferred and supported by a lot of interpreters. |
strip | array | Optional | A list of tags to strip. This option can’t be used with the `convert`` option. |
strong_em_symbol | string | Optional | In markdown, both * and _ are used to encode strong or emphasized texts. Either of these symbols can be chosen by the options ASTERISK (default) or UNDERSCORE respectively. |
sub_symbol | string | Optional | Define the chars that surround |
sup_symbol | string | Optional | Define the chars that surround |
wrap | boolean | Optional | If wrap is set to True, all text paragraphs are wrapped at wrap_width characters. Defaults to False and 80. Use with newline_style=BACKSLASH to keep line breaks in paragraphs. |
wrap_width | number | Optional | If wrap is set to True, all text paragraphs are wrapped at wrap_width characters. Defaults to False and 80. Use with newline_style=BACKSLASH to keep line breaks in paragraphs. |
Input Example
{"html":"<p> Some HTML string </p>","autolinks":true,"bullets":"\\u2022","convert":["p","li"],"default_title":false,"escape_asterisks":true,"escape_underscores":true,"heading_style":"UNDERLINED","keep_inline_images_in":["td"],"newline_style":"BACKSLASH","strip":["span"],"strong_em_symbol":"ASTERISK","sub_symbol":"~","sup_symbol":"^","wrap":false,"wrap_width":80}
Output
Parameter | Type | Description |
|---|---|---|
markdown | string | Output field: markdown |
Output Example
{"markdown":"string"}
Markdown to HTML
Convert Markdown text to HTML using GitHub Flavored Markdown (cmark-gfm).
Input
Argument Name | Type | Required | Description |
|---|---|---|---|
markdown | string | Required | Markdown string to convert to HTML. |
Input Example
{"markdown":"# Hello World\n\nThis is **bold** text."}
Output
Parameter | Type | Description |
|---|---|---|
html | string | The resulting HTML from the Markdown conversion. |
status_code | integer | HTTP status code of the response |
reason | string | Response reason phrase |
headers | string | HTTP headers for the request |
Output Example
{"html":"string","headers":"string"}
Response Headers
Header | Description | Example |
|---|---|---|
Content-Type | The media type of the resource | application/json |
Date | The date and time at which the message was originated | Thu, 01 Jan 2024 00:00:00 GMT |