1.0.1 • Published 6 years ago

sync-to-wiki v1.0.1

Weekly downloads
1
License
ISC
Repository
-
Last release
6 years ago

sync-to-wiki

Confulence wiki 本身提供的可视化编辑器较为复杂,在进行一些简单文档(基本文档 + 代码块)的编写时效率较低,并且不支持导入/导出 markdown 格式的文档。

sync-to-wiki 是一个 Node.js 命令行工具,通过解析本地 markdown 文件再调用 Confulence API 的方式实现 markdown 文件和 wiki 文档的同步。

依赖

LTS 版本 Node.js

CLI 使用

Install: npm i -g sync-to-wiki

Usage: sync-to-wiki [options]
Options:
  --version       Show version number                                  [boolean]
  --username      Wiki username [$WIKI_USERNAME]
  -p, --password  Wiki password [$WIKI_PASSWORD]
  -u, --url       Wiki base url [$WIKI_BASE_URL], e.g: http://wiki.xsky.com
  --source        local markdown file path                            [required]
  --space         Wiki space                                          [required]
  --parent        Wiki parent page title, a null value will cause the page to be
                  added under the space's home page
  --title         Wiki page title
  -h, --help      Show help                                            [boolean]

Example usage:
sync-to-wiki --username <YOUR_WIKI_USERNAME> \
	-p <YOUR_WIKI_PASSWORD> \
	-u http://wiki.xsky.com \
	--source README.md \
	--space RDWIZ \
	--parent 技术文档 \
	--title '同步 markdown 文档至 wiki'

编程使用

如果需要将 sync-to-wiki 集成到工作流中,推荐以 Node.js 依赖的方式引入

// Install: npm i sync-to-wiki

// Usage:
cosnt { init, sync } = require('sync-to-wiki');

init({
  username: YOUR_WIKI_USERNAME,
  password: YOUR_WIKI_PASSWORD,
  baseUrl: 'http://wiki.xsky.com',
});

sync({
  source: 'README.md',
  space: 'RDWIZ',
  parentTitle: '技术文档',
  title: '同步 markdown 文档至 wiki',
})
  .then(() => console.log('sync successfully!'))
  .catch((error) => console.error(error));

限制

暂时不支持在 markdown 中插入图片