README.md in draftjs_html-0.1.0 vs README.md in draftjs_html-0.2.0

- old
+ new

@@ -1,7 +1,10 @@ # DraftjsHtml +[![Gem Version](https://badge.fury.io/rb/draftjs_html.svg)](https://badge.fury.io/rb/draftjs_html) +[![Build Status](https://app.travis-ci.com/dugancathal/draftjs_html.svg?branch=main)](https://app.travis-ci.com/dugancathal/draftjs_html) + This gem provides conversion utilities between "raw" [DraftJS] JSON and HTML. My team and I have found a need on many occasions to manipulate and convert DraftJS on our Ruby backend - this library is the result. [DraftJS]: https://draftjs.org/ @@ -54,14 +57,14 @@ }, } DraftjsHtml.to_html(raw_draftjs, { entity_style_mappings: { - link: ->(entity, content) { - %Q{<a href="#{entity.data['url']}">#{content}</a>} + abc: ->(entity, content) { + %Q{<a href="https://example.com/?id=#{entity.data['user_id']}">#{content}</a>} }, }, -}) # => <p>Hello </p> +}) # => <p>Hello <a href="https://example.com/?id=123">@Arya</a></p> ``` Almost all of the options support Procs (or otherwise `.call`-ables) to provide flexibility in the conversion process. As the library uses Nokogiri to generate HTML, it's also possible to return `Nokogiri::Node` objects or String objects.