Skip to content
/ md2ob Public

Library to convert an array of markdown files to a valid OpenBook JSON schema

Notifications You must be signed in to change notification settings

botpress/md2ob

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

md2ob

Converts a list of markdown files to an OpenBook JSON object

md2ob is a lightweight npm library used by the OpenBook Playground to convert users' Markdown files to an OpenBook JSON object for book compilation via API.

This library can be used by anyone to create custom front-end or back-end OpenBook clients and preserve the same markdown format as our Playground.

Install

npm install md2ob

Usage

import convert from "@botpress/md2ob";

const file1 = `
# Topic 1
This is the description of topic 1

## Subtopic 1
This is the description of subtopic 1

- A very impressive fact about subtopic 1
    - `attachment to the fact`
    - > a question
- A second fact
`

const result = convert(...[file1]);

if (result.success) {
    // Success
    console.log(result.book, result.warnings)
else {
    // Failure
    console.log(result.errors)
}

About

Library to convert an array of markdown files to a valid OpenBook JSON schema

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published