HTML to Markdown

Verb: htmlToMarkdown

Available from: <Standard>

Converts specific HTML text to Markdown format according to the settings specified.

Syntax

htmlToMarkdown --html(String) [--unknowntags(HtmlToMarkdownUnknownTagsOption)] [--escapetext(Boolean)] [--removecomments(Boolean)] [--tablewithoutheader(HtmlToMarkdownTableWithoutHeaderRowHandlingOption)] [--smarthref(Boolean)] (Boolean)=success (String)=value

Inputs

Script Designer Required AcceptedTypes Description
--html HTML Required Text Text in HTML format that should be converted to Markdown.
--unknowntags Unknown Tags Optional HtmlToMarkdownUnknownTagsOption Options that determine the action to be taken when unknown tags are present in the HTML text:
  • Ignore unknown tags, but try to convert its content.
  • Ignore unknown tags.
  • Write original tag to markdown.
  • --escapetext Escape Text Optional Boolean When enabled, uses escape characters for the special characters "*" and "_" from the formatted text to the Markdown standard.
    --removecomments Remove Comments Optional Boolean When enabled, removes comment tags found in the HTML text.
    --tablewithoutheader Table Without Header Optional HtmlToMarkdownTableWithoutHeaderRowHandlingOption Options for determining the action to be taken when headerless tables are present in HTML text:
  • Create a new empty header.
  • Use first row as header.
  • --smarthref Smart Href Optional Boolean When enabled, uses a method for evaluating the content of the tag "<a>" found in the HTML text, performing the following validations:
  • If the attributes "name" and "href" are equal, only the name in the output text is generated;
  • If the attribute "href" contains the http/https protocol and the attribute "name" does not, only "href" is generated in the output text;
  • However, if it is not enabled, the attributes "name", "href" and "title" are generated in the output text even though "name" and "href" are identical.
  • Outputs

    Script Designer AcceptedTypes Description
    success Success Boolean Returns "True" if the conversion from HTML text to Markdown was completed successfully, or "False" otherwise.
    value Text Text Returns the HTML text converted to Markdown format.

    Example

    The command converts the HTML text to Markdown format, with the parameter Smart Href enabled.

    defVar --name markdownText --type String
    defVar --name success --type Boolean
    htmlToMarkdown --html "Insert Html text here." --unknowntags "Write" --escapetext  --tablewithoutheader "EmptyRow" --smarthref  success=success markdownText=value
    logMessage --message "${success}\r\n${markdownText}" --type "Info"
    
    Download File

    See Also

  • Add Escape Characters to Regular Expression
  • Add Escape Characters to Text
  • Calculate Hash
  • Change Text Case
  • Check File
  • Concatenate Texts
  • Convert HTML to Text
  • Count Occurrences in Text
  • Count Text Characters
  • Create Random Text
  • Create Table By Regular Expression
  • Empty or Null Text Variable
  • Find by Regular Expression
  • Find Occurrences in Text
  • Format Text
  • Get Subtext
  • Get Text from Regular Expression
  • Insert New Line to Text
  • Join Text
  • Pad Text
  • Parse URI
  • Remove Diacritics
  • Remove Escape Characters
  • Replace Part of Text
  • Replace Text
  • Split Text
  • Trim Text Blanks