Skip to content

Latest commit

 

History

History
91 lines (66 loc) · 2.08 KB

README.md

File metadata and controls

91 lines (66 loc) · 2.08 KB

MDJSX REST API

Parse MDX syntax to JSX, and compile JSX (via API endpoint!)

TypeScript lerna

Overview

Getting Started
Usage
Built With
Contributing

Getting Started

The MDJSX API is single endpoint that allows users to transpile MDX to JSX, as well as compile JSX with Bublé.

Usage

Query Parameters

The MDJSX API supports passing additional options to the MDX parser or Bublé. This can be done by providing a query.options object with the following shape:

type TranspileCompileOptions = {
  buble?: TransformOptions
  mdx?: mdx.Options
}
// Default options used in MDJSX REST API
const options: TranspileCompileOptions = {
  buble: { objectAssign: 'Object.assign' },
  mdx: { skipExport: true }
}

Type definitions can be found here.

Transpile Compile

Transpile MDX to JSX, and compile JSX.

  • URL: https://mdjsx.flexdevelopment.vercel.app

  • Method: GET

  • Success Response

    MDJSX REST API - Transpile Compile Example

Transpile Only

  • URL: https://mdjsx.flexdevelopment.vercel.app

  • Method: GET

  • Success Response

    MDJSX REST API - Transpile Only Example

Errors

If an error is thrown, it will have the following shape:

{
  "name": "GeneralError",
  "message": "",
  "code": 500,
  "className": "general-error",
  "data": {
    "body": "",
    "query": {
      "compile": true,
      "options": {}
    }
  },
  "errors": {}
}

Built With