HTML to Markdown
The /html_to_md endpoint converts the given HTML code to Markdown code. It is highly customizable via the options parameter in the request body.
Method: POST
To make a request, send the required parameters, to the /html_to_md endpoint, with the authorization headers, via the POST method.
Parameters
This endpoint accepts only two parameters, i.e. html and options object.
htmlis the HTML which is to be converted to Markdown.optionscontains the customization options. These are the supported customization options:heading_styleis the style in which the heading will be converted. Accepted values areatxorsetextDefault value isatx.hris the characters which would be used for horizontal rules. Default is:***code_block_styleis the style for the code blocks. Possible values arefencedandindented. The default isfencedem_delimeteris the character which would be used to surround the emphasized or italic text. Its default values is:*strong_delimeteris the character, that will surround the strong or bold text. Its default value is**fencerefers to the characters used for opening and closing the fence. Supported values are```or~~~. Its default value is```link_styleis the style in which the links will be kept. Possible values areinlinedorreferenced. Default value isinlined.link_reference_styledefines the link format in the output Markdown. Possible values arefull,collapsedorshortcut. The default value isfull.preformatted_codeis a boolean values which determines whether the code block is preformatted, and if it is, it keeps the indentation as it is. Default value istruebullet_list_markeris the character used to mark bullet lists in the output Markdown. Default value is*
Responses
The success response, looks like this, where markdown in data object contains the converted output:
{
"status": "success",
"data": {
"source_html": "\n\t\t<h1>This is a heading</h1>\n\t\t<p>This is a paragraph with some\n\t\t<em>emphasized</em> and <strong>strong</strong> text.\n\t",
"markdown": "# This is a heading\n\nThis is a paragraph with some *emphasized* and **strong** text.",
"options_applied": {
"heading_style": "atx"
}
},
"message": "HTML to Markdown conversion was successful."
}
JSON
And if some error occurs, like not providing the html data in the request body, the response is similar as all other endpoints:
{
"status": "error",
"error": {
"code": "INVALID_INPUT",
"message": "'html' is required and must be a non-empty string.",
"details": "Ensure the request body includes a valid 'html' field of type string."
}
}
JSON