Convert HTML to Markdown. Based on html2text, this object allows you to take HTML input strings, and convert to Markdown.

When initialized, the options of the HTMLToMarkdown object will default to those configured in Drafts settings.

let html = "A <strong>Markdown</strong> string"
let h = new HTMLToMarkdown()

let output = h.process(html)
// output == "A **Markdown** string"

Options

emphasisMark: string

Character to use replacign <em> and <i> tags. Defaults: _

ignoreEmphasis: boolean

Do not include formatting for emphasis

ignoreImages: boolean

Do not include formatting for images

ignoreLinks: boolean

Do not include formatting for links

inlineLinks: boolean

Use []() inline links, rather than reference style links

linksEachParagraph: boolean

Place reference-style links after the paragraph they occur in, rather than at the end.

strongMark: string

Characters to use replacing <strong> and <b> tags. Default: **

ulItemMark: string

Character to use replacing <li> tags in unordered lists. Default: -

Other

  • Takes an HTML string passed and processes it with attempts ot output Markdown from it's content.

    Parameters

    • html: string

    Returns string

""