Skip to main content

Sync SiYuan with Yuque

Project description

SiyuanYuque

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

SiyuanYuque-0.0.8.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

SiyuanYuque-0.0.8-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file SiyuanYuque-0.0.8.tar.gz.

File metadata

  • Download URL: SiyuanYuque-0.0.8.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.8

File hashes

Hashes for SiyuanYuque-0.0.8.tar.gz
Algorithm Hash digest
SHA256 6242a946fe8f0cda9af14177c0db4ebf3a6317a8ce23ec56280f735218c8a424
MD5 91c2adab430885768bec14d9581a78a8
BLAKE2b-256 ff69bf317976d3d7b98ad362ea2a34b973f4467beececbc8dcd4b35e2790015c

See more details on using hashes here.

File details

Details for the file SiyuanYuque-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: SiyuanYuque-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.8

File hashes

Hashes for SiyuanYuque-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 4fedbb93fb54631bead4f0b6774b43d6839c558794978ef18a1d68b823a1628a
MD5 c1291fce2cf041f8a58305900d6eeb08
BLAKE2b-256 67097170daba1d79d93898e4d7b563c427cb05a8378145f2030bf3eb129af211

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page