Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

storyblok/storyblok-markdown-richtext

Repository files navigation

Storyblok Markdown to Richtext converter

Warning

This package is deprecated. Use @storyblok/richtext instead. It supports both rendering and parsing, including Markdown/HTML to Storyblok Richtext conversion.


Do you need help converting HTML or markdown into Storyblok's richtext format?

Here's how to use it:

Usage

Install the npm module storyblok-markdown-richtext by running:

$ yarn add storyblok-markdown-richtext # npm install storyblok-markdown-richtext

And use the functions where you need:

import { markdownToRichtext } from 'storyblok-markdown-richtext'

const richtextData = markdownToRichtext(`# Hello World`)

// ...

To convert HTML to richtext, you'll also need an HTML to markdown converter. In the example below, we use turndown.

import TurndownService from 'turndown'
import { markdownToRichtext } from 'storyblok-markdown-richtext'

const turndownService = new TurndownService()
const richtextData = markdownToRichtext(
	turndownService.turndown('<h1>Hello world!</h1>')
)

markdownToRichtext

This function transforms your HTML or markdown data into a richtext JSON object. Here's an example:

import { markdownToRichtext } from 'storyblok-markdown-richtext'

const richtextObject = markdownToRichtext(`# Hello World`)

The resulting richtext object will look like this:

{
  type: 'doc',
  content: [
    {
      type: 'heading',
      attrs: {
        level: 1
      },
      content: [
        {
          text: 'Hello World',
          type: 'text'
        }
      ]
    }
  ]
}

Powered by Storyblok

About

[DEPRECATED] A html/markdown to Storyblok richtext converter

Resources

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors