RichTextBuilder
Defined in: src/helpers/richText.helpers.ts:54
A chainable builder for constructing a single Notion rich text segment.
Do not instantiate directly — use the richText factory function or
the static helpers on it (richText.mentionPage, richText.equation, etc.).
Call .build() to produce a single-element NotionRichText.
Alternatively, pass builders directly to richText.join(). This method
calls .build() for you.
Example
Section titled “Example”// Simple textrichText('Hello world').build();
// Chained annotationsrichText('Important').bold().italic().color('red').build();
// LinkrichText('Notion').link('https://notion.so').build();
// Combine segmentsrichText.join( richText('Hello '), richText('world').bold(), richText('!'),);Methods
Section titled “Methods”bold()
Section titled “bold()”bold():
this
Defined in: src/helpers/richText.helpers.ts:69
Apply bold formatting.
Returns
Section titled “Returns”this
build()
Section titled “build()”build(): ({
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/helpers/richText.helpers.ts:120
Build a single-element NotionRichText from this builder.
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"; })[]
code()
Section titled “code()”code():
this
Defined in: src/helpers/richText.helpers.ts:93
Apply inline code formatting.
Returns
Section titled “Returns”this
color()
Section titled “color()”color(
value):this
Defined in: src/helpers/richText.helpers.ts:99
Set the text color.
Parameters
Section titled “Parameters”"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"
Returns
Section titled “Returns”this
italic()
Section titled “italic()”italic():
this
Defined in: src/helpers/richText.helpers.ts:75
Apply italic formatting.
Returns
Section titled “Returns”this
link()
Section titled “link()”link(
url):this
Defined in: src/helpers/richText.helpers.ts:108
Add a link to a text segment. Only applies to text-type rich text. For mention or equation types, this is a no-op.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”this
strikethrough()
Section titled “strikethrough()”strikethrough():
this
Defined in: src/helpers/richText.helpers.ts:81
Apply strikethrough formatting.
Returns
Section titled “Returns”this
underline()
Section titled “underline()”underline():
this
Defined in: src/helpers/richText.helpers.ts:87
Apply underline formatting.
Returns
Section titled “Returns”this