Skip to content

Support for highlighting in plain text annotation #145

@Travcort

Description

@Travcort

Problem:

From using v3 in my application, I have noticed that the annotatePlainText method on notionToMarkdown class here, does not convert highlighted text into any kind of highlighting for the markdown.

For example:
For the "loves or pursues or desires to obtain pain of itself, because it is pain" phrase as written in Notion:

Image

The Official Notion API returns:

{
  "type": "text",
  "text": {
    "content": "loves or pursues or desires to obtain pain of itself, because it is pain",
    "link": null
  },
  "annotations": {
    "bold": false,
    "italic": false,
    "strikethrough": false,
    "underline": false,
    "code": false,
    "color": "default"
  },
  "plain_text": "loves or pursues or desires to obtain pain of itself, because it is pain",
  "href": null
}

NB: The "color" property for annotations is "default" in the case where a colored background is used

For the "circumstances occur in which toil and pain can procure him some great" phrase as written in Notion,

The Official Notion API returns:

{
  "type": "text",
  "text": {
    "content": "circumstances occur in which toil and pain can procure him some great",
    "link": null
  },
  "annotations": {
    "bold": false,
    "italic": false,
    "strikethrough": false,
    "underline": false,
    "code": false,
    "color": "yellow"
  },
  "plain_text": "circumstances occur in which toil and pain can procure him some great",
  "href": null
}

NB: The "color" property for annotations is the color used in the case where colored text is used

Solution:

My proposal would be to convert the color annotation to highlighting using the ==${text}== style since that property exists in the official Notion API but is unused in your implementation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions