Rich text without paragraph keep out putting paragraph

With this configuration


just adding the value "hello"

With the following code:

<%= @document["blog-post.title"].as_html(link_resolver()).html_safe %>

output this:

<p>my content</p>

where I would expect

my content

Hey @benoit.molenda.ext ,

Welcome to the Prismic Community Forum, and thanks for posting this question :slight_smile:

The Prismic API assumes a block-level element to wrap your text in. If you have pre or h2 enabled (for example), then the Rich Text field will default back to one of those fields. If you don't have a block-level element enabled, then the Rich Text field will default to a paragraph element — as you have pointed out.

Fortunately, the HTML doesn't actually come from Prismic. The Prismic API provides JSON, and an HTML Serializer in your app converts that JSON to HTML.The Prismic–Ruby dev kit has a default HTML Serializer that renders a <p> tag for paragraph elements, but you can override that behavior with your own HTML Serializer, and tell it to not add markup for a paragraph element:

https://prismic.io/docs/technologies/html-serializer-ruby

I hope that makes some sense. If you want some help writing your HTML Serializer, let me know, and I'll take a look :slight_smile:

Best,
Sam

This issue has been closed due to inactivity. Flag to reopen.