Skip to content

Commit

Permalink
fix code highlight issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jxpeng98 committed Aug 28, 2024
1 parent 1f58670 commit fd29ed8
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 8 deletions.
10 changes: 3 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
## Features

- Support WebP format images. 支持 WebP 格式图片。
- Support sync with long notes. 支持长文章同步。

Long articles or notes have been split into multiple parts, and the parts are synchronized in order.
长文章同步是通过将长文章或笔记拆分为多个部分,按顺序同步这些部分。
## Fix

- Fix code block not being highlighted in Notion after syncing.
- 修复代码块同步之后,在 Notion 中未高亮的问题。
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "share-to-notionnext",
"version": "2.4.0",
"type": "module",
"description": "Shares obsidian md file to notion with notion api for NotionNext web deploy, originally created by EasyChris/obsidian-to-notion.",
"description": "Share files to any Notion database using the Notion API, originally created by EasyChris/obsidian-to-notion.",
"main": "main.js",
"scripts": {
"dev": "node esbuild.config.mjs",
Expand Down
13 changes: 13 additions & 0 deletions src/upload/upload_general/Upload2NotionGeneral.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {

Check failure on line 64 in src/upload/upload_general/Upload2NotionGeneral.ts

View workflow job for this annotation

GitHub Actions / test

Parameter 'item' implicitly has an 'any' type.
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[] = [];
Expand Down
13 changes: 13 additions & 0 deletions src/upload/upload_next/Upload2NotionNext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {

Check failure on line 88 in src/upload/upload_next/Upload2NotionNext.ts

View workflow job for this annotation

GitHub Actions / test

Parameter 'item' implicitly has an 'any' type.
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;
Expand Down
13 changes: 13 additions & 0 deletions src/upload/upoload_custom/Upload2NotionCustom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {

Check failure on line 60 in src/upload/upoload_custom/Upload2NotionCustom.ts

View workflow job for this annotation

GitHub Actions / test

Parameter 'item' implicitly has an 'any' type.
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[] = [];
Expand Down

0 comments on commit fd29ed8

Please sign in to comment.