fix code highlight issue

This commit is contained in:
Jiaxin Peng
2024-08-28 20:26:06 +01:00
parent 1f58670906
commit fd29ed820e
5 changed files with 43 additions and 8 deletions

View File

@@ -58,6 +58,19 @@ export class Upload2NotionGeneral extends UploadBaseGeneral {
notionAPI
} = this.dbDetails;
// remove the annotations from the childArr if type is code block
childArr.forEach((block: any) => {
if (block.type === "code") {
block.code.rich_text.forEach(item => {
if (item.type === "text" && item.annotations) {
delete item.annotations;
}
}
);
}
}
);
// check the length of the childArr and split it into chunks of 100
const childArrLength = childArr.length;
let extraArr: any[] = [];

View File

@@ -82,6 +82,19 @@ export class Upload2NotionNext extends UploadBaseNext {
) {
const {databaseID, notionAPI} = this.dbDetails;
// remove the annotations from the childArr if type is code block
childArr.forEach((block: any) => {
if (block.type === "code") {
block.code.rich_text.forEach(item => {
if (item.type === "text" && item.annotations) {
delete item.annotations;
}
}
);
}
}
);
// check the length of the childArr
// if it is too long, split it into multiple pages
const childArrLength = childArr.length;

View File

@@ -54,6 +54,19 @@ export class Upload2NotionCustom extends UploadBaseCustom {
notionAPI
} = this.dbDetails;
// remove the annotations from the childArr if type is code block
childArr.forEach((block: any) => {
if (block.type === "code") {
block.code.rich_text.forEach(item => {
if (item.type === "text" && item.annotations) {
delete item.annotations;
}
}
);
}
}
);
// check the length of the childArr and split it into chunks of 100
const childArrLength = childArr.length;
let extraArr: any[] = [];