Skip to content

OrangeX4/gistd

 
 

Repository files navigation

[English] | [中文]

Gistd

Instantly share typst documents on git and other network storage.

Loading a document on GitHub

Assuming that you have a GitHub link, for example:

https://github.com/typst/templates/blob/main/charged-ieee/template/main.typ

Simply replace the github.com with gistd.myriad-dreamin.com:

https://gistd.myriad-dreamin.com/typst/templates/blob/main/charged-ieee/template/main.typ

Example Documents:

View Parameters

These URL parameters can change the behavior of gistd.

  • g-page: The page number to display. Default is 1. Only available in the slide mode.
  • g-mode: The mode to display.
    • doc: View the document in the document mode.
    • slide: View the document in the slide mode.

Slide View

Using g-mode=slide mentioned above to view the document in the slide mode:

Example Documents:

Loading a document by arbitrary links

Assuming that you have arbitrary link, for example:

https://github.com/typst/templates/blob/main/charged-ieee/template/main.typ

Put any-gistd.myriad-dreamin.com before the link:

https://any-gistd.myriad-dreamin.com/github.com/typst/templates/blob/main/charged-ieee/template/main.typ

any-gistd.myriad-dreamin.com is alias for gistd.myriad-dreamin.com/@any.

If a domain (host) is specially identified, gistd will use corresponding approach to serve the document.

  • github.com: git protocol.
  • codeberg.org: git protocol.
  • localhost and others: HTTP protocol if host is localhost otherwise https protocol. Note: gistd won't load other files on the specified domain if it cannot identifies the domain, i.e. the typst document cannot load other resources relative to the domain.

Example Documents:

Loading a document without cors proxy

By default, gistd uses a trusted cors proxy (https://underleaf.mgt.workers.dev) to load documents. This is because GitHub and Forgejo doesn't allow gistd to load documents. See isomorphic-git: Quickstart for more details.

However, you may want to load a document without cors proxy. You can do this by adding g-cors=false to the query string.

For example, to load a document at http://localhost:11449/main.typ:

Loading a document with HTTP protocol

@any infers protocol from the URL, while you could use @http to force HTTP protocol. For example, to load a document at http://localhost:11449/main.typ:

Development

Install dependencies:

pnpm install

Develop locally:

pnpm dev

Build:

pnpm build

About

Instantly share typst documents on git and other network storage.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 90.4%
  • CSS 8.5%
  • Other 1.1%