Low commit activity in last 3 years
No release in over a year
This is Storyblok's rendering service to render html from the data of the richtext field type. The renderer is compatible with Prosemirror's json format.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 3
 Project Readme

About

This package allows you to get an HTML string from the richtext field of Storyblok.

How to install

Add the gem to your Gemfile

gem 'storyblok-richtext-renderer'

Usage

Instantiate the Resolver class:

require_relative '../lib/storyblok/richtext'

renderer = Storyblok::Richtext::HtmlRenderer.new

Use the function render() to get the html string from your richtext field.

# previous code...

doc = {
  'type' => 'doc',
  'content' => [
    {
      'type' => 'horizontal_rule'
    }
  ]
}

renderer.render(doc) # renders a html string: '<hr />'

Run all tests

rspec spec/richtext_spec.rb 

License

This project is open-sourced software licensed under the MIT license