Rich text
Notion uses rich text to allow users to customize their content. Rich text refers to a type of document where content can be styled and formatted in a variety of customizable ways. This includes styling decisions, such as the use of italics, font size, and font color, as well as formatting, such as the use of hyperlinks or code blocks.
Notion includes rich text objects in block objects to indicate how blocks in a page are represented. Blocks that support rich text will include a rich text object; however, not all block types offer rich text.
When blocks are retrieved from a page using the Retrieve a block or Retrieve block children endpoints, an array of rich text objects will be included in the block object (when available). Developers can use this array to retrieve the plain text (plain_text) for the block or get all the rich text styling and formatting options applied to the block.
Many block types support rich text. In cases where it is supported, a rich_text object will be included in the block type object. All rich_text objects will include a plain_text property, which provides a convenient way for developers to access unformatted text from the Notion block.
Each rich text object contains the following fields.
The annotation object
All rich text objects contain an annotations object that sets the styling for the rich text. annotations includes the following fields:
Rich text type objects
Equation
Notion supports inline LaTeX equations as rich text object’s with a type value of "equation". The corresponding equation type object contains the following:
Example rich text equation object
Mention
Mention objects represent an inline mention of a database, date, link preview mention, page, template mention, or user. A mention is created in the Notion UI when a user types @ followed by the name of the reference.
If a rich text object’s type value is "mention", then the corresponding mention object contains the following:
Database mention type object
Database mentions contain a database reference within the corresponding database field. A database reference is an object with an id key and a string value (UUIDv4) corresponding to a database ID.
If an integration doesn’t have access to the mentioned database, then the mention is returned with just the ID. The plain_text value that would be a title appears as "Untitled" and the annotation object’s values are defaults.
Example rich text mention object for a database mention
Date mention type object
Date mentions contain a date property value object within the corresponding date field.
Example rich text mention object for a date mention
Link Preview mention type object
If a user opts to share a Link Preview as a mention, then the API handles the Link Preview mention as a rich text object with a type value of link_preview. Link preview rich text mentions contain a corresponding link_preview object that includes the url that is used to create the Link Preview mention.
Example rich text mention object for a link_preview mention
Page mention type object
Page mentions contain a page reference within the corresponding page field. A page reference is an object with an id property and a string value (UUIDv4) corresponding to a page ID.
If an integration doesn’t have access to the mentioned page, then the mention is returned with just the ID. The plain_text value that would be a title appears as "Untitled" and the annotation object’s values are defaults.
Example rich text mention object for a page mention
Template mention type object
The content inside a template button in the Notion UI can include placeholder date and user mentions that populate when a template is duplicated. Template mention type objects contain these populated values.
Template mention rich text objects contain a template_mention object with a nested type key that is either "template_mention_date" or "template_mention_user".
If the type key is "template_mention_date", then the rich text object contains the following template_mention_date field:
_Example rich text mention object for a template_mention_date mention _
If the type key is "template_mention_user", then the rich text object contains the following template_mention_user field:
_Example rich text mention object for a template_mention_user mention _
User mention type object
If a rich text object’s type value is "user", then the corresponding user field contains a user object.
If your integration doesn’t yet have access to the mentioned user, then the plain_text that would include a user’s name reads as "@Anonymous". To update the integration to get access to the user, update the integration capabilities on the integration settings page.
Example rich text mention object for a user mention
Text
If a rich text object’s type value is "text", then the corresponding text field contains an object including the following:
Example rich text text object without link
Example rich text text object with link
Refer to the request limits documentation page for information about limits on the size of rich text objects.