Convert HTML to Markdown – Aspose.HTML Cloud SDK

Markdown is a markup language known for its plain text formatting syntax. Due to its readability and ease of writing, it is commonly used for documentation and README files. Initially intended for conversion to HTML, Markdown’s versatility now extends to a variety of output formats. The Aspose.HTML Cloud offers a unique feature: converting HTML back to Markdown. This feature allows users to easily access, edit, or create Markdown files from any device using any text editor, increasing flexibility and ease of content management.

Aspose.HTML Cloud provides the simplest SDK API to convert HTML documents to Markdown format with high quality, easy and fast. This article contains a set of code examples that explain how to convert HTML to Markdown using available SDKs.

Examples of HTML to Markdown Conversion

Aspose.HTML Cloud SDK allows you to fetch an HTML document from a storage location by its name, from a URL or a local file on your drive, convert it to the specified format and save the result to the storage or the local drive. The following code examples demonstrate how to convert HTML to Markdown programmatically for different cases.

Example 1. Convert HTML to Markdown with default save options

Consider an example of converting a local HTML file to Markdown and saving the result to a local path.

Example 2. Convert Web page to Markdown

Aspose.HTML Cloud allows you to get a web page by its URL, convert it to another format and save into a local file system. The example below demonstrates how to convert web page to Markdown with the default conversion parameters.

HTML to Markdown conversion occurs with the default conversion options: the resulting MD document’s width and height correspond to A4, and all margins have zero value.

Example 3. Convert HTML to Markdown inside cloud storage

Aspose.HTML Cloud allows you to get an HTML file from your cloud storage and save conversion result back to cloud storage.

See Also