sveltekit-notion-blog
Version:
A plug and play library for setting up blogs in subdirectory or main directory in Sveltekit projects using Notion as CMS.
35 lines (34 loc) • 1.02 kB
JavaScript
export function isFullBlock(response) {
return response.object === "block" && "type" in response;
}
export function isPageObjectResponse(response) {
return response?.[0]?.properties !== null && response?.[0]?.properties !== undefined;
}
export function isFullPage(page) {
return page?.properties !== null && page?.properties !== undefined;
}
export function isObject(o) {
return typeof o === "object" && o !== null;
}
export function isFullUser(response) {
return "type" in response;
}
export const processAnnotations = (annotations) => {
let style = ``;
if (annotations.bold) {
style += "font-weight: bold;";
}
if (annotations.italic) {
style += "font-style: italic;";
}
if (annotations.underline) {
style += "text-decoration: underline;";
}
if (annotations.strikethrough) {
style += "text-decoration: line-through;";
}
if (annotations.code) {
style += "font-family: monospace; color: #EB5757;";
}
return style;
};