Convert Markdown to Image using Node.js REST API

This article describes how to convert Markdown to image using Node.js REST API. You will learn to transform Markdown to image using Node.js REST API using the Node.js-based Cloud SDK. Details will be provided to select the appropriate output file extension for creating the desired output.

Prerequisite

Steps to Convert MD to PNG using Node.js Low Code API

  1. Import the necessary references to access the desired functions and classes for the conversion
  2. Create the HtmlApi using the client ID and secret for authentication
  3. Call the ConvertAsync() method by providing the path to the input Markdown file and output image file
  4. Display the result from the API response

These steps explain how to convert the file format from MD to PNG using Node.js REST Interface. Import the necessary modules for accessing the required classes and functions, and set the client ID and secret in the HtmlApi for creating a client to perform the conversion. Using the HtmlApi call the ConvertAsync() method and provide it with the paths to the input Markdown file and the output image file name with extension.

Code to Convert Markdown to PNG using Node.js Low Code API

The above code demonstrates how to convert Markdown to JPG using Node.js RESTful Service. You may use either PNG or JPEG extension to create the desired output image. Note that the JPG extension is not supported by the API, and an Exception will be raised.

This article has taught us the conversion of a Markdown file to an image. To transform an XHTML file to PDF, refer to the article Convert XHTML to PDF using Node.js REST API.

 English