Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace SemanticString

TODO: Some collection-only structures not included.

This is what Notion uses to represent a rich text string.

For example, an HTML string <strong><em>Hello</em></strong>World can be translated into

[
  ["Hello", [["b"], ["i"]]], // A SemanticString
  ["World"] // Another SemanticString
]

Index

Type aliases

BasicString

BasicString: [string, undefined | BasicStringFormatting[]]

BasicStringFormatting

BasicStringFormatting: Bold | Italic | Strike | Link | InlineCode | Colored | Commented

Bold

Bold: ["b"]

Colored

Colored: ["h", NotionColor]

Color or background color.

Commented

Commented: ["m", UUID]

The UUID is the id of the associated "discussion" entity.

DateTime

DateTime: { date_format: "relative" | "MM/DD/YYYY" | "MMM DD, YYYY" | "DD/MM/YYYY" | "YYYY/MM/DD"; end_date?: undefined | string; end_time?: undefined | string; reminder?: Reminder; start_date: string; start_time?: undefined | string; time_format?: "h:mm A" | "H:mm"; time_zone?: TimeZone; type: "date" | "daterange" | "datetime" | "datetimerange" }

A structure to represent date and time.

Type declaration

  • date_format: "relative" | "MM/DD/YYYY" | "MMM DD, YYYY" | "DD/MM/YYYY" | "YYYY/MM/DD"
  • Optional end_date?: undefined | string

    e.g. "2019-05-27"

  • Optional end_time?: undefined | string

    e.g. "15:00"

  • Optional reminder?: Reminder
  • start_date: string

    e.g. "2019-05-27"

  • Optional start_time?: undefined | string

    e.g. "15:00"

  • Optional time_format?: "h:mm A" | "H:mm"

    12h ("h:mm A") or 24h ("H:mm")

  • Optional time_zone?: TimeZone
  • type: "date" | "daterange" | "datetime" | "datetimerange"

InlineCode

InlineCode: ["c"]

InlineMath

InlineMath: ["⁍", [["e", Latex]]]

Inline math.

InlineMentionDate

InlineMentionDate: ["‣", [["d", DateTime]]]

Mention a date only or a date with reminder.

InlineMentionPage

InlineMentionPage: ["‣", [["p", UUID]]]

Mention a page by ID.

InlineMentionUser

InlineMentionUser: ["‣", [["u", UUID]]]

Mention an user by ID.

Italic

Italic: ["i"]

Link

Link: ["a", string]

string is an URL.

Reminder

Reminder: { time?: undefined | string; unit: "minute" | "hour" | "day" | "week"; value: number }

A structure to represent a reminder alarm before the start of DateTime.

e.g. value is 30, unit is minute -> 30 minutes before.

e.g. value is 1, unit is day, time is 09:00 -> 1 day before at 9 a.m.

Type declaration

  • Optional time?: undefined | string

    e.g. "09:00"

  • unit: "minute" | "hour" | "day" | "week"
  • value: number

Strike

Strike: ["s"]

Generated using TypeDoc