HUGO
Menu
GitHub 90265 stars Mastodon

transform.HTMLToMarkdown

Returns the given HTML converted to Markdown.
Syntax
transform.HTMLToMarkdown INPUT
Returns
string
New in v0.151.0

Usage

The transform.HTMLToMarkdown function returns the given HTML converted to Markdown, using the html-to-markdown Go package.

This function is experimental and its API may change in the future.

The function uses these html-to-markdown plugins to perform the conversion:

PluginDescription
BaseImplements basic shared functionality
CommonMarkImplements Markdown according to the CommonMark specification
TableImplements tables according to the GitHub Flavored Markdown specification

Examples

{{ transform.HTMLToMarkdown "<p>An <em>emphasized</em> word</p>" }} → An *emphasized* word

Converting the content of the current page:

{{ .Content | transform.HTMLToMarkdown | safeHTML }}