diff --git a/README-zh.md b/README-zh.md index bc98b71..b98c25e 100644 --- a/README-zh.md +++ b/README-zh.md @@ -1,3 +1,70 @@ +# Obsidian to NotionNext +感谢[原作者](https://github.com/EasyChris/obsidian-to-notion)开发出了这么好用的插件,能够将obsidian同步到notion。 但是原仓库只能同步Name和Tags信息,如果像我一样通过[NotionNext](https://github.com/tangly1024/NotionNext)来搭建自己的网页,就有一些局限性。每次导入之后都需要进行大量的修改。 + +所以我在[原作者](https://github.com/EasyChris/obsidian-to-notion)的基础之上,增加了匹配[NotionNext](https://github.com/tangly1024/NotionNext)模板的功能。这样可以直接在Obsidian编辑,整理好之后一键发布。 + +## 使用方式 +### 注意事项 +本插件现在暂时只能用于匹配[NotionNext](https://github.com/tangly1024/NotionNext)。如果你不是使用这个模板,你只会无限返回`error 400`. + +所以没有NotionNext需求的,请使用原作者的[Obsidian-to-notion](https://github.com/EasyChris/obsidian-to-notion) + +### 准备安装 +在安装插件之前,你必须配置好了以下内容: +1. 你的NotionNext数据库。 +2. 根据原作者的readme.md,配置好了Notion API,并且已经和你的NotionNext仓库关联。 +3. NotionNext Database ID +4. 你的NotionNext数据库有如下内容: + - type + - title + - slug + - category + - tags + - date + - status + - summary + - password + - icon + **如果你是直接复制的NotionNext的模板,这些内容应该已经有了。我在原作者的基础之上对本插件的内容进行了更改,所以你只需要保证你的数据库有如上内容,并且所有的字母都是小写!!!** +**⚠️⚠️⚠️:表头全部小写!!!顺序无所谓!** + +### 安装插件 +1. 关闭Obsidian +2. 从Release下载插件文件,解压到你的obsidian插件目录下。 +3. 重新打开Obsidian,进入设置,启用插件。 +4. 在设置中,找到Obsidian to NotionNext,填入你的NotionNext Database ID 和 API token。 + +### 使用插件 +在仓库中我上传了一个模板,你可以直接复制到你的模板文件夹中。然后使用Obsidian的模板功能一键生成新笔记。 + +如果你不想使用模板,你也可以直接在Obsidian中创建一个新的文件,然后复制下边的内容。然后保存。 +```markdown +--- +type: Post # Post or Page, the default is Post +slug: test # slug for url, the default is +stats: Draft # Draft, Invisible, Published +category: test +summary: this is a summary for test post +icon: fa-solid fa-camera # you can ignore this +password: "1234" # if you donot want to set password, you can delete this line +tags: + - test # tags for post + - web # add more tags if you want +--- + + +Contents Below + +``` +模板使用如下: +![](https://img.jxpeng.dev/2023/08/5ba5e7aeb86650c060c620786371717c.mp4) + +**插件预览如下** +![](https://img.jxpeng.dev/2023/08/7edefe36899b7431a65db891f429a137.mp4) + + +--- +**以下为原README.md** # Obsidian to Notion [![](https://github.com/Easychris/obsidian-to-notion/actions/workflows/CI.yml/badge.svg)](https://github.com/Easychris/obsidian-to-notion/actions/workflows/CI.yml) [![Release Obsidian plugin](https://github.com/Easychris/obsidian-to-notion/actions/workflows/release.yml/badge.svg)](https://github.com/Easychris/obsidian-to-notion/actions/workflows/release.yml) diff --git a/README.md b/README.md index eae965d..c51128d 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,69 @@ +# Obsidian to NotionNext +Thanks to the [original author](https://github.com/EasyChris/obsidian-to-notion) for developing such a useful plugin that can synchronize Obsidian to Notion. However, the original repository can only sync Name and Tags information. For those like me who use [NotionNext](https://github.com/tangly1024/NotionNext) to set up their website, this presents some limitations. Every time I import, I need to make a lot of modifications. + +Thus, based on the [original author's work](https://github.com/EasyChris/obsidian-to-notion), I've added a feature to match the [NotionNext](https://github.com/tangly1024/NotionNext) template. This way, you can edit directly in Obsidian and publish with a single click after organizing. + +## How to Use +### Precautions +For now, this plugin is exclusively for [NotionNext](https://github.com/tangly1024/NotionNext). If you're not using this template, you'll keep receiving `error 400`. + +For those without a NotionNext requirement, please use the original [Obsidian-to-notion](https://github.com/EasyChris/obsidian-to-notion). + +### Pre-Installation Steps +Before installing the plugin, you must have set up the following: +1. Your NotionNext database. +2. According to the original author's readme.md, set up the Notion API, and it should already be associated with your NotionNext repository. +3. NotionNext Database ID +4. Your NotionNext database should have the following contents: + - type + - title + - slug + - category + - tags + - date + - status + - summary + - password + - icon + **If you've directly copied the NotionNext template, these contents should already exist. I've made changes to this plugin based on the original author's work. All you need to ensure is that your database has the above content, and every letter is in lowercase!!!** + **⚠️⚠️⚠️: All headers are in lowercase!!! The order doesn't matter!** + +### Plugin Installation +1. Close Obsidian. +2. Download the plugin file from Release and unzip it into your Obsidian plugin directory. +3. Re-open Obsidian, go to settings, and enable the plugin. +4. In the settings, find Obsidian to NotionNext, and enter your NotionNext Database ID and API token. + +### How to Use +### Using the Plugin +In the repository, I have uploaded a template which you can directly copy into your template folder. After that, use Obsidian's template feature to create a new note with one click. + +If you don't want to use the template, you can also directly create a new file in Obsidian and then copy the content below. Then save it. +```markdown +--- +type: Post # Post or Page, the default is Post +slug: test # slug for url, the default is +stats: Draft # Draft, Invisible, Published +category: test +summary: this is a summary for test post +icon: fa-solid fa-camera # you can ignore this +password: "1234" # if you donot want to set password, you can delete this line +tags: + - test # tags for post + - web # add more tags if you want +--- + +Contents Below +``` +Usage of the template is as follows: +![](https://img.jxpeng.dev/2023/08/5ba5e7aeb86650c060c620786371717c.mp4) + +**Plugin preview is shown below** +![](https://img.jxpeng.dev/2023/08/7edefe36899b7431a65db891f429a137.mp4) + +--- +**Original README.md** + # Obsidian to Notion [![](https://github.com/Easychris/obsidian-to-notion/actions/workflows/CI.yml/badge.svg)](https://github.com/Easychris/obsidian-to-notion/actions/workflows/CI.yml) [![Release Obsidian plugin](https://github.com/Easychris/obsidian-to-notion/actions/workflows/release.yml/badge.svg)](https://github.com/Easychris/obsidian-to-notion/actions/workflows/release.yml) diff --git a/icon.ts b/icon.ts index cb01294..d8db85c 100644 --- a/icon.ts +++ b/icon.ts @@ -2,11 +2,7 @@ import { addIcon } from 'obsidian'; const icons: Record = { 'notion-logo': ` - - - - - + ` }; diff --git a/main.ts b/main.ts index 745010a..49a5242 100644 --- a/main.ts +++ b/main.ts @@ -45,7 +45,7 @@ export default class ObsidianSyncNotionPlugin extends Plugin { // This creates an icon in the left ribbon. const ribbonIconEl = this.addRibbonIcon( "notion-logo", - "Share to notion", + "Share to NotionNext", async (evt: MouseEvent) => { // Called when the user clicks the icon. this.upload(); @@ -57,8 +57,8 @@ export default class ObsidianSyncNotionPlugin extends Plugin { // statusBarItemEl.setText("share to notion"); this.addCommand({ - id: "share-to-notion", - name: "share to notion", + id: "share-to-notionnext", + name: "share to notionnext", editorCallback: async (editor: Editor, view: MarkdownView) => { this.upload() }, @@ -171,7 +171,7 @@ class SampleSettingTab extends PluginSettingTab { containerEl.empty(); containerEl.createEl("h2", { - text: "Settings for obsidian to notion plugin.", + text: "Settings for obsidian to NotionNext plugin.", }); new Setting(containerEl) diff --git a/manifest.json b/manifest.json index 3b31fc7..27719f4 100644 --- a/manifest.json +++ b/manifest.json @@ -1,10 +1,9 @@ { - "id": "obsidian-to-notion", - "name": "Obsidian shared to Notion", - "version": "0.7.6", + "id": "obsidian-to-notionnext", + "name": "Obsidian shared to NotionNext", "minAppVersion": "0.0.1", - "description": "This is a plugin for Obsidian. This plugin share obsidian md file to notion with notion api", - "author": "Easychris", - "authorUrl": "https://github.com/EasyChris/obsidian-to-notion", + "description": "This is a plugin for Obsidian. This plugin share obsidian md file to notion with notion api for NotionNext web deploy.", + "author": "jxpeng98", + "authorUrl": "https://github.com/jxpeng98/obsidian-to-NotionNext", "isDesktopOnly": false } \ No newline at end of file diff --git a/obsidian template.md b/obsidian template.md new file mode 100644 index 0000000..6bf6ed9 --- /dev/null +++ b/obsidian template.md @@ -0,0 +1,15 @@ +--- +type: Post // Post or Page +slug: test // slug for url +stats: Draft // Draft, Invisible, Published +category: test +summary: this is a summary for test post +icon: fa-solid fa-camera // you can ignore this +password: "1234" // if you donot want to set password, you can delete this line +tags: + - test // tags for post + - web // add more tags if you want +--- + + +Contents Below diff --git a/package.json b/package.json index dee1964..cd9d184 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,7 @@ { - "name": "obsidian-to-notion", - "version": "0.7.6", + "name": "obsidian-to-notionnext", "type": "module", - "description": "This is a plugin for Obsidian. This plugin share obsidian md file to notion with notion api", + "description": "This is a plugin for Obsidian. This plugin share obsidian md file to notion with notion api for NotionNext web deploy.", "main": "main.js", "scripts": { "dev": "node esbuild.config.mjs",