Skip to content

This is Storyblok's rendering service to render html from the data of the richtext field type.

Notifications You must be signed in to change notification settings

performant-software/storyblok-ruby-richtext-renderer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

This is Storyblok's rendering service to render html from the data of the richtext field type.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%