MCPcopy Index your code
hub / github.com/Myriad-Dreamin/gistd

github.com/Myriad-Dreamin/gistd @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
222 symbols 436 edges 24 files 1 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

[English] | [中文]

Gistd

即时分享托管在在 git 或其他网络服务上的 typst 文档。

在 GitHub 上加载文档

假设你有一个 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.0latest
  • 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
  • Google Fonts 的 axis 语法可以放在 family 后面,例如 ?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.comgistd-cn.myriad-dreamin.com/@any 的别名。

如果一个域名 (主机) 被特别识别,gistd 将使用相应的方法来服务文档。

  • github.com: git 协议。
  • codeberg.org: git 协议。
  • localhost 和其他: 如果主机是 localhost 则使用 HTTP 协议,否则使用 https 协议。注意: gistd 不会加载指定域名上的其他文件,即 typst 文档无法加载相对于域名的其他资源。

示例文档:

不使用 cors 代理加载文档

默认情况下,gistd 使用一个受信任的 cors 代理 (https://underleaf.mgt.workers.dev) 来加载文档。这是因为 GitHub 和 Forgejo 不允许 gistd 加载文档。请参阅 isomorphic-git: Quickstart 了解更多详情。

然而,你可能想要加载一个没有 cors 代理的文档。你可以通过在查询字符串中添加 g-cors=false 来实现。

例如,要加载 http://localhost:11449/main.typ 上的文档:

使用 HTTP 协议加载文档

@any 从 URL 推断协议,而你可以使用 @http 强制使用 HTTP 协议。例如,要加载 http://localhost:11449/main.typ 上的文档:

开发指南

安装依赖:

pnpm install

本地开发:

pnpm dev

构建:

pnpm build

Extension points exported contracts — how you extend this code

FontCache (Interface)
* Font cache
src/font.ts
ITypstDomDocument (Interface)
(no doc) [1 implementers]
src/dom.ts
Window (Interface)
(no doc)
src/global.d.ts
GitHubStorageSpec (Interface)
(no doc)
src/storage.ts
DirectoryViewState (Interface)
(no doc)
src/fs.ts
DocState (Interface)
(no doc)
src/doc.ts
Args (Interface)
(no doc)
src/args.ts
FontCondition (Interface)
(no doc)
src/font-css.ts

Core symbols most depended-on inside this repo

storageSpecFromPath
called by 8
src/storage.ts
createElement
called by 7
src/dom.ts
corsUrl
called by 6
src/storage.ts
add
called by 5
src/fs.ts
getCors
called by 4
src/storage.ts
promisifiedReq
called by 4
src/fs.ts
cssToFontInformation
called by 4
src/font-css.ts
mainFilePath
called by 3
src/storage.ts

Shape

Function 111
Method 61
Interface 28
Class 20
Enum 2

Languages

TypeScript100%

Modules by API surface

src/dom.ts37 symbols
src/storage.ts33 symbols
src/fs.ts29 symbols
src/font-css.ts28 symbols
src/font.ts27 symbols
src/main.ts14 symbols
contrib/gistd-launcher/gistd-launcher.user.js11 symbols
src/doc.ts10 symbols
src/typst.ts9 symbols
src/typst-compiler.ts7 symbols
src/font-spec.ts4 symbols
src/typst-version.ts3 symbols

For agents

$ claude mcp add gistd \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact