MyGit

Clouder0/SiyuanYuque

Fork: 1 Star: 23 (更新于 2024-11-01 10:55:37)

license: MIT

Language: Python .

Sync SiYuanNote & Yuque.

最后发布版本: v0.1.1 ( 2022-05-07 22:02:31)

GitHub网址

SiyuanYuque

Chinese Document

Sync SiYuanNote & Yuque.

  • Sync Setting in doc attribute.
  • Batch Sync Via SQL
  • SiYuan Image Hosting Supported
  • Internal Link Supported

Install

Use pip to install.

pip install SiyuanYuque

Execute like this:

python -m SiyuanYuque

Remember to create a sqconfig.toml config file in the current directory.

user_token = ""
siyuan_token = ""
api_host = "https://www.yuque.com/api/v2"
last_sync_time = "20210915225457"

Fill in your Yuque user_token and siyuan_token.

image

image

Set Atrribute in SiyuanNote

You can only sync documents to Yuque.

Set Attributes like this:

image

yuque: true
yuque-workspace: your workspace

Workspace format: username/repo

Then run python -m SiyuanYuque, and check the attributes again.

image

You'll see yuque-id appended to your document's attributes. Don't manually modify this unless you know what you are doing.

That's the basic usage for the time being.

Remember not to edit the documents sync from SiYuan, as the update will be lost upon the next sync.

Custom Sync

It is supported to sync documents by SQL.

A simple example:

user_token = ""
siyuan_token = ""
api_host = "https://www.yuque.com/api/v2"
last_sync_time = "20210916223903"
assets_replacement = "https://b3logfile.com/siyuan/1609132319768/assets"
[[custom_sync]]
sql = "select * from blocks where hpath like '%Math/%' and type='d'"
yuque-workspace = "clouder0/gaokao"

Multiple custom syncs can be defined.

user_token = ""
siyuan_token = ""
api_host = "https://www.yuque.com/api/v2"
last_sync_time = "20210916223903"
assets_replacement = "https://b3logfile.com/siyuan/1609132319768/assets"
[[custom_sync]]
sql = "select * from blocks where hpath like '%Math/%' and type='d'"
yuque-workspace = "clouder0/gaokao"
[[custom_sync]]
sql = "select * from blocks where hpath like '%Chinese/%' and type='d'"
yuque-workspace = "clouder0/gaokao"

More Config

image

yuque-public: 1 for public and 0 for private.

yuque-slug: the slug of the document. https://www.yuque.com/siyuannote/docs/siyuanyuque

Assets Replacement

Replace the assets string in your markdown content to support SiYuan online image.

Internal Link

SiYuan-Setting: Ref Block: Anchor Text with block URL.

This script will replace siyuan://blocks with https://yuque.com/{workspace} so that your ref blocks that have been exported and in the same workspace of yuque will be accessible.

Square Support

For yuque square, you can modify api_host to operate in squares.

For example, you'd like to sync in a square clouder.yuque.com, then you should change your config:

api_host = "https://clouder.yuque.com/api/v2"

Do bear in mind that once you decide to use a square, you can no longer stay synced with the original public www.yuque.com.
Theoretically, there exists the possibility to support both at the same time, but I haven't seen such demand yet.

最近版本更新:(数据更新于 2024-09-07 10:40:39)

2022-05-07 22:02:31 v0.1.1

2022-05-07 21:48:50 v0.1.0

2022-05-05 17:25:22 v0.0.10

2022-04-10 01:29:05 v0.0.9

2021-11-12 18:38:25 v0.0.8

2021-10-26 22:10:23 v0.0.6

2021-10-24 22:04:59 v0.0.5

2021-09-16 23:12:46 v0.0.3

2021-09-15 23:17:21 v0.0.2

2021-09-15 23:09:57 v0.0.1

Clouder0/SiyuanYuque同语言 Python最近更新仓库

2024-11-22 08:12:43 jxxghp/MoviePilot

2024-11-22 02:39:01 goauthentik/authentik

2024-11-22 00:03:47 comfyanonymous/ComfyUI

2024-11-21 22:06:18 rashevskyv/dbi

2024-11-21 21:09:02 xtekky/gpt4free

2024-11-21 20:03:58 ultralytics/ultralytics