Ricos Documents API: Sample Flows

This article presents a possible use case and corresponding sample flows that your app can support. These flows can be a helpful starting point as you plan your implementation.

Convert site visitor input between Ricos document and Markdown formats

In this scenario, your app or site allows site visitors to create and edit content. They can choose whether to create the content using a rich content viewer or in a Markdown editor. They can toggle between the two formats while editing the content.

When the site visitor toggles from rich content to Markdown

  1. Call Validate Document, specifying:

    • The site visitor's current Ricos document.
    • The plugins your rich content viewer supports.
    • fixDocument set to true.
  2. Call Convert from Ricos Document, specifying:

    • The validDocument value from the previous step's response.
    • The target format MARKDOWN.

    Use the response to populate your Markdown editor.

When the site visitor toggles from Markdown to rich content

Call Convert to Ricos Document, specifying:

  • The site visitor's current Markdown content.
  • The plugins your rich content viewer supports.

Use the response to populate your rich content editor.

Did this help?