DEV Community

Gustavo Barbosa
Gustavo Barbosa

Posted on

Convert Markdown to HTML with a Simple REST API (Free on RapidAPI)

Convert Markdown to HTML with a Simple REST API (Free on RapidAPI)

Overview

The MarkdownMaster API is a document conversion service from Markdown to multiple formats and vice versa, with additional styling and customization features. This API was designed to be simple to use, yet powerful in functionality, serving developers who need to integrate document conversion into their applications.

LINK: https://rapidapi.com/GuBarbosaj/api/markdownmaster

Key Features

  • Conversion from Markdown to multiple formats (HTML, PDF, DOCX, plain text)
  • Conversion from other formats to Markdown (HTML, content extraction from URLs)
  • Advanced customization with styles, templates, and formatting options
  • Utilities for validation and analysis of Markdown documents
  • Table of contents generation from Markdown documents
  • Extraction of specific elements such as links, images, and headers

Endpoints

Conversion from Markdown to other formats

/convert/md-to-html

Converts Markdown text to HTML with styling options.

Method: POST

Parameters:

{
  "markdown_text": "# Title\n\nThis is an example of **Markdown**.",
  "style": "github",
  "include_toc": true,
  "include_metadata": false,
  "seo_optimize": true
}
Enter fullscreen mode Exit fullscreen mode

Response:

{
  "success": true,
  "result": "<!DOCTYPE html>\n<html>\n<head>...",
  "format": "html",
  "metadata": {
    "style": "github",
    "include_toc": true
  }
}
Enter fullscreen mode Exit fullscreen mode

/convert/md-to-pdf

Converts Markdown text to PDF with formatting options.

Method: POST

Parameters:

{
  "markdown_text": "# Title\n\nThis is an example of **Markdown**.",
  "template": "academic",
  "page_size": "A4",
  "include_toc": true,
  "include_cover": true,
  "header_text": "Generated Document",
  "footer_text": "Page {page}"
}
Enter fullscreen mode Exit fullscreen mode

Response: PDF file for download

/convert/md-to-docx

Converts Markdown text to DOCX (Microsoft Word).

Method: POST

Parameters:

{
  "markdown_text": "# Title\n\nThis is an example of **Markdown**.",
  "template": "business",
  "include_toc": true,
  "include_styles": true
}
Enter fullscreen mode Exit fullscreen mode

Response: DOCX file for download

/convert/md-to-plain

Converts Markdown text to plain text.

Method: POST

Parameters:

{
  "markdown_text": "# Title\n\nThis is an example of **Markdown**.\n\n[Link](https://example.com)",
  "preserve_links": true,
  "preserve_images": false
}
Enter fullscreen mode Exit fullscreen mode

Response:

{
  "success": true,
  "result": "Title\n\nThis is an example of Markdown.\n\nLink (https://example.com)",
  "format": "text",
  "metadata": {
    "preserve_links": true,
    "preserve_images": false
  }
}
Enter fullscreen mode Exit fullscreen mode

Conversion from other formats to Markdown

/convert/html-to-md

Converts HTML to Markdown.

Method: POST

Parameters:

{
  "html_text": "<h1>Title</h1><p>This is an example of <strong>HTML</strong>.</p>",
  "preserve_tables": true,
  "github_flavored": false
}
Enter fullscreen mode Exit fullscreen mode

Response:

{
  "success": true,
  "result": "# Title\n\nThis is an example of **HTML**.",
  "format": "markdown",
  "metadata": {
    "preserve_tables": true,
    "github_flavored": false
  }
}
Enter fullscreen mode Exit fullscreen mode

/convert/url-to-md

Extracts content from a URL and converts it to Markdown.

Method: POST

Parameters:

{
  "url": "https://example.com",
  "include_images": true,
  "include_links": true,
  "clean_content": true
}
Enter fullscreen mode Exit fullscreen mode

Response:

{
  "success": true,
  "result": "# Page Title\n\nExtracted content...",
  "format": "markdown",
  "metadata": {
    "source_url": "https://example.com",
    "include_images": true,
    "include_links": true
  }
}
Enter fullscreen mode Exit fullscreen mode

Utilities and Tools

/utils/md-validate

Validates Markdown syntax and returns errors or warnings.

Method: POST

Parameters:

{
  "markdown_text": "# Title\n\nThis is an example of **Markdown**.\n\n[Broken link]()",
  "flavor": "commonmark"
}
Enter fullscreen mode Exit fullscreen mode

Response:

{
  "valid": false,
  "errors": [
    {
      "type": "broken_link",
      "message": "Empty link: [Broken link]()",
      "line": 5
    }
  ],
  "warnings": []
}
Enter fullscreen mode Exit fullscreen mode

/utils/md-extract

Extracts specific elements from Markdown (links, images, headers).

Method: POST

Parameters:

{
  "markdown_text": "# Title\n\n## Subtitle\n\n[Link](https://example.com)\n\n![Image](image.jpg)",
  "elements": ["links", "images", "headings"]
}
Enter fullscreen mode Exit fullscreen mode

Response:

{
  "success": true,
  "elements": {
    "links": [
      {
        "text": "Link",
        "url": "https://example.com"
      }
    ],
    "images": [
      {
        "alt": "Image",
        "src": "image.jpg"
      }
    ],
    "headings": [
      {
        "level": 1,
        "text": "Title",
        "id": ""
      },
      {
        "level": 2,
        "text": "Subtitle",
        "id": ""
      }
    ]
  },
  "count": {
    "links": 1,
    "images": 1,
    "headings": 2
  }
}
Enter fullscreen mode Exit fullscreen mode

/utils/md-toc

Generates table of contents from Markdown.

Method: POST

Parameters:

{
  "markdown_text": "# Title\n\n## Subtitle 1\n\n### Subsection 1.1\n\n## Subtitle 2",
  "max_depth": 3,
  "format": "markdown"
}
Enter fullscreen mode Exit fullscreen mode

Response:

{
  "success": true,
  "toc": "- [Title](#title)\n  - [Subtitle 1](#subtitle-1)\n    - [Subsection 1.1](#subsection-11)\n  - [Subtitle 2](#subtitle-2)",
  "headings_count": 4
}
Enter fullscreen mode Exit fullscreen mode

Usage Examples

Python

import requests
import json

url = "https://api.rapidapi.com/markdownmaster/convert/md-to-html"

payload = {
    "markdown_text": "# Title\n\nThis is an example of **Markdown**.",
    "style": "github",
    "include_toc": False,
    "include_metadata": False,
    "seo_optimize": True
}
headers = {
    "content-type": "application/json",
    "X-RapidAPI-Key": "YOUR_API_KEY_HERE",
    "X-RapidAPI-Host": "markdownmaster.p.rapidapi.com"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
Enter fullscreen mode Exit fullscreen mode

JavaScript

const options = {
  method: 'POST',
  headers: {
    'content-type': 'application/json',
    'X-RapidAPI-Key': 'YOUR_API_KEY_HERE',
    'X-RapidAPI-Host': 'markdownmaster.p.rapidapi.com'
  },
  body: JSON.stringify({
    markdown_text: '# Title\n\nThis is an example of **Markdown**.',
    style: 'github',
    include_toc: false,
    include_metadata: false,
    seo_optimize: true
  })
};

fetch('https://markdownmaster.p.rapidapi.com/convert/md-to-html', options)
  .then(response =&gt; response.json())
  .then(response =&gt; console.log(response))
  .catch(err =&gt; console.error(err));
Enter fullscreen mode Exit fullscreen mode

Support and Contact

For technical support or questions about the API, please contact us via email: [email protected]

Top comments (0)