This article guides on how to convert HTML to Markdown using Node.js REST API. It assists on the transformation of the file format from HTML to MD using Node.js Low Code API by implementing a Node.js-based Cloud SDK. A detailed set of instructions and a sample code is provided to demonstrate the process.
Prerequisite
- Create an account and get API credentials for converting the HTML file to an MD file
- Download Aspose.HTML Cloud SDK for Node.js to transform an HTML file to a Markdown file
- Set up a Node.js project with the above SDK
Steps to Convert HTML to MD using Node.js RESTful Service
- Import the necessary namespaces to access the desired classes and methods
- Instantiate the HtmlApi object, providing the client ID and secret
- Create an object of the ConverterBuilder class
- Set the local file references for the input HTML and output MD file
- Call the ConvertAsync() method from the API using the above builder object
These steps summarize the process for developing an HTML to MD converter using Node.js-based API. Import the necessary namespaces, create an instance of the HtmlApi class, and an object of the ConverterBuilder class. Finally, set the source HTML file and output Markdown file from the local disk and perform the conversion using the ConvertAsync method.
Code for HTML to Markdown Converter using Node.js REST API
The above code demonstrates the process of transforming a file from HTML to markdown using Node.js REST interface. You have the leverage to select inout and output files from either the local disk or the Cloud storage. Extension of the output file is quite important as it defines the type of conversion.
This article has taught us the process to convert HTML to MD format. To transform an HTML file to DOCX format, refer to the article on Convert HTML to DOCX using Node.js REST API.