README.md in draftjs_html-0.20.0 vs README.md in draftjs_html-0.21.0
- old
+ new
@@ -125,9 +125,23 @@
})
# This would generate <strong> tags instead of <b> tags around ranges of `BOLD` inline styles.
```
+You may also add attributes to tags created by `inline_style_mapping`s by using a two element array.
+The first element should be the tagname and the second argument a hash of attributes to values, like this:
+
+```ruby
+
+DraftjsHtml.to_html(raw_draftjs, options: {
+ inline_style_mapping: {
+ 'BOLD' => ['strong', style: 'font-weight: 900'],
+ },
+})
+```
+
+# This would generate <strong> tags instead of <b> tags around ranges of `BOLD` inline styles.
+
#### `:inline_style_renderer`
If the direct mapping from `:inline_style_mapping` isn't enough, you can supply a custom function for rendering a style range.
This function, when provided, will be called with all applicable styles for a range, and the relevant content/text for that range.
It bears stressing that this `#call`-able will be called with *all* defined styles for the content/character range.