diff --git a/src/app/(pages)/blogposts/[slug]/page.tsx b/src/app/(pages)/blogposts/[slug]/page.tsx index a60be12..7a84aec 100644 --- a/src/app/(pages)/blogposts/[slug]/page.tsx +++ b/src/app/(pages)/blogposts/[slug]/page.tsx @@ -43,8 +43,11 @@ export default async function BlogpostPage({ params: paramsPromise }) {
{JSON.stringify(chapters, null, 2)}}*/}
CHAPTER
\s*<\/p>/g, '') + .replace(/
\s*<\/p>/g, '');
}
export function getChapters(content_html: string): { id: string; title: string }[] {
- const sanitizedContent = sanitizeAndAddChapters(content_html)
- const regex = /
{serializedChildren}
{node.text}
+ text = {node.text}
;
}
if (node.format & IS_SUBSCRIPT) {
- text = {text}
+ text = {text};
}
if (node.format & IS_SUPERSCRIPT) {
- text = {text}
+ text = {text};
}
- return text
+ return text;
}
// NOTE: Hacky fix for
@@ -72,65 +78,66 @@ export function serializeLexical({ nodes }: Props): JSX.Element {
// which does not return checked: false (only true - i.e. there is no prop for false)
const serializedChildrenFn = (node: NodeTypes): JSX.Element | null => {
if (node.children == null) {
- return null
+ return null;
} else {
- if (node?.type === 'list' && node?.listType === 'check') {
+ if (node?.type === "list" && node?.listType === "check") {
for (const item of node.children) {
- if ('checked' in item) {
+ if ("checked" in item) {
if (!item?.checked) {
- item.checked = false
+ item.checked = false;
}
}
}
}
- return serializeLexical({ nodes: node.children as NodeTypes[] })
+ return serializeLexical({ nodes: node.children as NodeTypes[] });
}
- }
+ };
- const serializedChildren = 'children' in node ? serializedChildrenFn(node) : ''
+ const serializedChildren = "children" in node ? serializedChildrenFn(node) : "";
- if (node.type === 'block') {
- const block = node.fields
+ if (node.type === "block") {
+ const block = node.fields;
- const blockType = block?.blockType
+ const blockType = block?.blockType;
if (!block || !blockType) {
- return null
+ return null;
}
} else {
switch (node.type) {
- case 'linebreak': {
- return
+ case "linebreak": {
+ return
;
}
- case 'paragraph': {
+ case "paragraph": {
return (
{serializedChildren}
- )
+ );
}
- case 'link': {
- const fields = node.fields
+ case "link": {
+ const fields = node.fields;
return (