Introduction

When Cloudpess exports content to a Contentful Long Text field, it converts it to markdown. This works for most scenarios, but sometimes, you want to include custom content that must be processed in a certain way by the markdown library on your website. For example, you might use MDX, which allows you to add custom JSX content to your markdown.

Your first inclination may be to add the corresponding JSX to your source document and allow Cloudpress to export it to Contentful. However, this may not work as expected. Specifically, in the case of JSX, Cloudpress will encode some of the JSX markup when it exports the content. Let’s say you add the following JSX component to your source document:

Exporting this to Contentful will result in the following markdown. As you can see, Cloudpress encoded the JSX code.

To work around this problem, Cloudpress introduced a feature called Raw Content Blocks. When Cloudpress exports your content and encounters a Raw Content Block, it will send the content of that block to Contentful as-is.

The rest of this document will walk you through this feature by demonstrating how to use Raw Content Blocks in Google Docs and Notion to correctly export the JSX from the sample above.

Export your custom markdown

To export the custom markdown, you must define a raw content block using the @@begin_raw_content and @@end_raw_content processing directives.

  1. Denote the start of a raw content block by by adding the @@begin_raw_content directive to your document.
  2. After that, add the markdown
  3. Finally, close off a raw content block, use the @@end_raw_content directive.

The raw content block should appear in your editor as per the screenshots below.

Only plain text is allowed between the two directives. Any other content, such as tables, lists, images, etc., will be dropped during the export. In the case of Notion, as per the screenshot above, you may also use the Code block between the two directives.

When you export your document, Cloudpress will interpret the content between the @@begin_raw_content and @@end_raw_content directives as raw content and will export it to Contentful as-is, without performing any HTML encoding.

When the document in the screenshots above is exported to Contentful, it will result in the markdown being exported without any HTML encoding applied to it.

Sample documents

You can find the sample documents used in this documentation below:

  1. Export custom markdown to Contentful Long Text fields (Google Docs)
  2. Export custom markdown to Contentful Long Text fields (Notion)