[English] | [中文]
即时分享托管在在 git 或其他网络服务上的 typst 文档。
假设你有一个 GitHub 链接,例如:
https://github.com/typst/templates/blob/main/charged-ieee/template/main.typ
将 github.com 替换为 gistd-cn.myriad-dreamin.com:
https://gistd-cn.myriad-dreamin.com/typst/templates/blob/main/charged-ieee/template/main.typ
示例文档:
这些 URL 参数可以改变 gistd 的行为。
g-page: 要显示的页面编号。默认是 1。仅在幻灯片模式下可用。g-mode: 显示模式。doc: 显示为普通文档。slide: 显示为幻灯片。g-version: 所使用的 Typst 编译器版本。v0.13.0, v0.13.1, v0.14.0或latest。fonts: 额外注册的字体 provider。这个参数可以重复出现,每一个值都必须包含 provider,格式是 provider:value。google-fonts:<family>: 从 Google Fonts 加载字体族,例如 ?fonts=google-fonts:Noto+Sans+SC。?fonts=google-fonts:Noto+Sans+SC&fonts=google-fonts:Roboto。?fonts=google-fonts:Roboto:wght@400;700 或 ?fonts=google-fonts:Roboto:ital,wght@0,400;1,700。使用上面提到的 g-mode=slide 以幻灯片模式显示文档:
示例文档:
假设你有一个任意链接,例如:
https://github.com/typst/templates/blob/main/charged-ieee/template/main.typ
将 any-gistd-cn.myriad-dreamin.com 放在链接前面:
https://any-gistd-cn.myriad-dreamin.com/github.com/typst/templates/blob/main/charged-ieee/template/main.typ
any-gistd-cn.myriad-dreamin.com 是 gistd-cn.myriad-dreamin.com/@any 的别名。
如果一个域名 (主机) 被特别识别,gistd 将使用相应的方法来服务文档。
github.com: git 协议。codeberg.org: git 协议。localhost 和其他: 如果主机是 localhost 则使用 HTTP 协议,否则使用 https 协议。注意: gistd 不会加载指定域名上的其他文件,即 typst 文档无法加载相对于域名的其他资源。示例文档:
默认情况下,gistd 使用一个受信任的 cors 代理 (https://underleaf.mgt.workers.dev) 来加载文档。这是因为 GitHub 和 Forgejo 不允许 gistd 加载文档。请参阅 isomorphic-git: Quickstart 了解更多详情。
然而,你可能想要加载一个没有 cors 代理的文档。你可以通过在查询字符串中添加 g-cors=false 来实现。
例如,要加载 http://localhost:11449/main.typ 上的文档:
@any 从 URL 推断协议,而你可以使用 @http 强制使用 HTTP 协议。例如,要加载 http://localhost:11449/main.typ 上的文档:
安装依赖:
pnpm install
本地开发:
pnpm dev
构建:
pnpm build
$ claude mcp add gistd \
-- python -m otcore.mcp_server <graph>