这是用户在 2025-7-27 23:27 为 https://github.com/CommitSans/obsidian-gitbook 保存的双语快照页面,由 沉浸式翻译 提供双语支持。了解如何保存?
Skip to content

A quick tool to publish an Obsidian Vault on GitBook

License

Open in github.dev Open in a new github.dev tab Open in codespace

CommitSans/obsidian-gitbook

Add file

Add file

Folders and files

NameName
Last commit message
Last commit date

Latest commit

b3956d4 · Jan 8, 2022

History

41 Commits
Jan 8, 2022
Jan 8, 2022
Jan 8, 2022
Jan 8, 2022
Jan 8, 2022
Jan 8, 2022

Repository files navigation

Obsidian GitBook 黑曜石GitBook

Deploy an Obsidian vault on GitBook.在 GitBook 上部署一个 Obsidian 保险库。

This is a repository that turns an Obsidian project into a GitBook project, that can be linked with GitHub, so it will be automatically deployed. Just link your GitBook project with your fork of this repo, and run the deploy flow.这是一个将 Obsidian 项目转换为 GitBook 项目的仓库,该 GitBook 项目可以与 GitHub 关联,从而实现自动部署。只需将您的 GitBook 项目与您在此仓库的分叉关联起来,然后运行部署流程即可。

Manual Deployment 手动部署

You can make the deploy by your own, moving the stuff manually, and making your commits.您可以自行部署,手动移动文件并提交更改。

Just copy your obsidian project to a directory (in the repo root) called obsidian. Commit and push. Every time that new code goes to GitHub, there's an action that automatically build the obsidian folder into a GitBook project under the gitbook folder.只需将您的 Obsidian 项目复制到一个名为  obsidian  的目录(位于仓库根目录下)。提交并推送。每次有新代码提交到 GitHub 时,都会有一个操作自动将  obsidian  文件夹构建为  gitbook  文件夹下的 GitBook 项目。

Every time you want to update the code, copy and paste your obsidian vault into the obsidian folder, commit and push. Remember to pull before doing so.每次您想要更新代码时,请将您的 Obsidian 保险库复制并粘贴到  obsidian  文件夹中,然后提交并推送。操作前请记得先拉取。

Automatic deployment 自动部署

If you don't want to be manually updating your GitBook deployment, you can follow this short guide. You will only need two repos:如果您不想手动更新您的 GitBook 部署,可以按照此简短指南操作。您只需要两个仓库:

Deploy repository 部署存储库

You can see an example here您可以在此处查看一个示例。

  1. Fork this repository, and connect it with GitBook.分叉此仓库,并将其与 GitBook 连接。
  2. Create a Personal Access Token (pat). Don't lose this, you will need it later, and there won't be a way to watching it again.创建一个个人访问令牌(PAT)。请妥善保管,以后会用到,而且无法再次查看。
  3. Create a secret in your fork (Settings > Secets), called DEPLOY_PAT, and set its value to the PAT you've just created.在您的分支中创建一个密钥(设置 > 密钥),名称为  DEPLOY_PAT ,并将其值设置为您刚刚创建的个人访问令牌。

Obsidian repository 黑曜石库

You can see an example here您可以在此处查看一个示例。

  1. Create a repository for yor Obsidian vault, and push the changes there. You can check recursos-diseno-es as an example (check out the .gitignore, it might be useful for your vault)为您的 Obsidian 保险库创建一个存储库,并将更改推送到那里。您可以查看 recursos-diseno-es 作为示例(查看  .gitignore ,它可能对您的保险库有用)
  2. Create a secret in this repo (Settings > Secets), called DEPLOY_PAT, and set its value to the PAT you've created before.在此代码库中创建一个机密(设置 > 机密),名称为  DEPLOY_PAT ,并将其值设置为您之前创建的个人访问令牌。
  3. Create a folder called .github and, inside it, another called workflows. Right there, add a build-gitbook.yaml file like this:创建一个名为  .github  的文件夹,在其中再创建一个名为  workflows  的文件夹。就在那里添加一个类似这样的  build-gitbook.yaml  文件:
name: Launch GitBook deploy workflow
on: push

jobs:
  run:
    name: Launch deploy actions
    runs-on: ubuntu-latest
    steps:
      - name: Deploy GitBook
        uses: actions/github-script@v5
        with:
          github-token: ${{ secrets.DEPLOY_PAT }}
          script: |
            await github.rest.actions.createWorkflowDispatch({
              owner: 'recursosdisenoes',
              repo: 'obsidian-gitbook',
              workflow_id: 'build-gitbook.yml',
              ref: 'main',
              inputs: {
                repo: '${{ github.repository }}',
              },
            });

Update the owner and repo values with your fork!使用您的分支更新  owner  repo  的值!

  1. Push your obsidian repository, and see the actions work together.推送您的 Obsidian 仓库,然后查看各项操作协同工作的情况。

And that's all. 这就是全部。

As soon as you push code to your Obsidian repository, it will trigget an action in your fork, so it will bring te obsidian vault, transformed into a GitBook project, and deployed automatically.一旦您将代码推送到您的 Obsidian 代码库,它就会触发您分叉中的一个操作,从而将 Obsidian 保险库转换为 GitBook 项目,并自动部署。

Status and known issues: 状态和已知问题:

  • Transform Obsidian project in Gitbook project (naming and structure)将 Obsidian 项目转换为 Gitbook 项目(命名和结构)
  • Generate a valid SUMMARY.md生成一个有效的 SUMMARY.md 文件
  • Transform page links to plain markdown links (next-up)将页面链接转换为纯 Markdown 链接(即将推出)
  • Show all the pages linking to the current one (on the roadmap)显示所有链接到当前页面(在路线图中)的页面
  • Link to blocks (on the roadmap)链接到区块(在路线图上)

Contributing 贡献

This project has been created for the Recursos de Diseño en Español (Design Resources in Spanish) project. The goal is to have an Open Source and tool to spread the knowledege in a well structured way.该项目是为“西班牙语设计资源”项目创建的。其目标是打造一个开源工具,以结构清晰的方式传播知识。

It's a basic version, built in a few free hours of a few people volunteering. So it might not cover all the features you might want.这是一个基础版本,由一些志愿者在空闲时间里免费搭建而成。所以它可能无法涵盖您想要的所有功能。

In case you want to add a feature, fix something that is not working propperly or improve some part of the code, feel free to add a PR.如果您想要添加一个功能、修复某个运行不正常的地方或者改进代码的某些部分,请随意提交一个拉取请求。

About

A quick tool to publish an Obsidian Vault on GitBook

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
set 限制解除
➤ Notion
◷ 稍后读
Translate to
Translate to
Summarize
Paraphrase
Expand
Check Grammar
Answer
Explain
Go to chat