RichText
Defined in: src/models/richText.model.ts:8
RichText helper class to work with Notion rich text arrays.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new RichText(
data):RichText
Defined in: src/models/richText.model.ts:11
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”RichText
Methods
Section titled “Methods”getLinks()
Section titled “getLinks()”getLinks():
string[]
Defined in: src/models/richText.model.ts:87
Get all links from the rich text.
Returns
Section titled “Returns”string[]
hasLinks()
Section titled “hasLinks()”hasLinks():
boolean
Defined in: src/models/richText.model.ts:76
Check if the rich text contains any links.
Returns
Section titled “Returns”boolean
toHTML()
Section titled “toHTML()”toHTML():
string
Defined in: src/models/richText.model.ts:50
Get the HTML representation of the rich text.
Returns
Section titled “Returns”string
toJSON()
Section titled “toJSON()”toJSON(): ({
annotations: {bold:boolean;code:boolean;color:"default"|"blue"|"blue_background"|"brown"|"brown_background"|"gray"|"gray_background"|"green"|"green_background"|"orange"|"orange_background"|"pink"|"pink_background"|"purple"|"purple_background"|"red"|"red_background"|"yellow"|"yellow_background";italic:boolean;strikethrough:boolean;underline:boolean; };href:string|null;plain_text:string;text: {content:string;link: {url:string; } |null; };type:"text"; } | {annotations: {bold:boolean;code:boolean;color:"default"|"blue"|"blue_background"|"brown"|"brown_background"|"gray"|"gray_background"|"green"|"green_background"|"orange"|"orange_background"|"pink"|"pink_background"|"purple"|"purple_background"|"red"|"red_background"|"yellow"|"yellow_background";italic:boolean;strikethrough:boolean;underline:boolean; };href:string|null;mention: {database: {id:string; };type:"database"; } | {date: {end:string|null;start:string;time_zone?:string|null; };type:"date"; } | {link_preview: {url:string; };type:"link_preview"; } | {page: {id:string; };type:"page"; } | {template_mention: {template_mention_date:"today"|"now";type:"template_mention_date"; } | {template_mention_user:"me";type:"template_mention_user"; };type:"template_mention"; } | {type:"user";user: {avatar_url?:string|null;id:string;name?:string;object:"user";person: {string;email_verified?:boolean; };type:"person"; } | {avatar_url?:string|null;bot: {owner: {type:"workspace";workspace:true; } | {type:"user"; };workspace_id?:string;workspace_limits?: {max_file_upload_size_in_bytes:number; };workspace_name?:string|null; };id:string;name?:string;object:"user";type:"bot"; } | {id:string;object:"user"; }; };plain_text:string;type:"mention"; } | {annotations: {bold:boolean;code:boolean;color:"default"|"blue"|"blue_background"|"brown"|"brown_background"|"gray"|"gray_background"|"green"|"green_background"|"orange"|"orange_background"|"pink"|"pink_background"|"purple"|"purple_background"|"red"|"red_background"|"yellow"|"yellow_background";italic:boolean;strikethrough:boolean;underline:boolean; };equation: {expression:string; };href:string|null;plain_text:string;type:"equation"; })[]
Defined in: src/models/richText.model.ts:101
Get the raw validated data.
Returns
Section titled “Returns”({ annotations: { bold: boolean; code: boolean; color: "default" | "blue" | "blue_background" | "brown" | "brown_background" | "gray" | "gray_background" | "green" | "green_background" | "orange" | "orange_background" | "pink" | "pink_background" | "purple" | "purple_background" | "red" | "red_background" | "yellow" | "yellow_background"; italic: boolean; strikethrough: boolean; underline: boolean; }; href: string | null; plain_text: string; text: { content: string; link: { url: string; } | null; }; type: "text"; } | { annotations: { bold: boolean; code: boolean; color: "default" | "blue" | "blue_background" | "brown" | "brown_background" | "gray" | "gray_background" | "green" | "green_background" | "orange" | "orange_background" | "pink" | "pink_background" | "purple" | "purple_background" | "red" | "red_background" | "yellow" | "yellow_background"; italic: boolean; strikethrough: boolean; underline: boolean; }; href: string | null; mention: { database: { id: string; }; type: "database"; } | { date: { end: string | null; start: string; time_zone?: string | null; }; type: "date"; } | { link_preview: { url: string; }; type: "link_preview"; } | { page: { id: string; }; type: "page"; } | { template_mention: { template_mention_date: "today" | "now"; type: "template_mention_date"; } | { template_mention_user: "me"; type: "template_mention_user"; }; type: "template_mention"; } | { type: "user"; user: { avatar_url?: string | null; id: string; name?: string; object: "user"; person: { email: string; email_verified?: boolean; }; type: "person"; } | { avatar_url?: string | null; bot: { owner: { type: "workspace"; workspace: true; } | { type: "user"; }; workspace_id?: string; workspace_limits?: { max_file_upload_size_in_bytes: number; }; workspace_name?: string | null; }; id: string; name?: string; object: "user"; type: "bot"; } | { id: string; object: "user"; }; }; plain_text: string; type: "mention"; } | { annotations: { bold: boolean; code: boolean; color: "default" | "blue" | "blue_background" | "brown" | "brown_background" | "gray" | "gray_background" | "green" | "green_background" | "orange" | "orange_background" | "pink" | "pink_background" | "purple" | "purple_background" | "red" | "red_background" | "yellow" | "yellow_background"; italic: boolean; strikethrough: boolean; underline: boolean; }; equation: { expression: string; }; href: string | null; plain_text: string; type: "equation"; })[]
toMarkdown()
Section titled “toMarkdown()”toMarkdown():
string
Defined in: src/models/richText.model.ts:25
Get the markdown representation of the rich text.
Returns
Section titled “Returns”string
toPlainText()
Section titled “toPlainText()”toPlainText():
string
Defined in: src/models/richText.model.ts:18
Get the plain text content without formatting.
Returns
Section titled “Returns”string