@sota1235/notion-sdk-js-helper
Version:
Helper utilities for using @notion/client
32 lines (31 loc) • 799 B
JavaScript
export const DEFAULT_COLOR = "default";
export const richText = (text, annotation, link) => ({
type: "text",
text: {
content: text,
link: link === undefined ? null : linkObject(link),
},
annotations: {
...defaultAnnotation,
...annotation,
},
});
export const linkObject = (link) => ({
url: link,
});
export const defaultAnnotation = {
bold: false,
italic: false,
strikethrough: false,
underline: false,
code: false,
color: "default",
};
export const annotation = (options) => ({
bold: options.bold ?? false,
italic: options.italic ?? false,
strikethrough: options.strikethrough ?? false,
underline: options.underline ?? false,
code: options.code ?? false,
color: options.color ?? "default",
});