1"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[2712],{2957:(e,t,i)=>{i.r(t),i.d(t,{assets:()=>a,contentTitle:()=>o,default:()=>h,frontMatter:()=>s,metadata:()=>r,toc:()=>l});var n=i(85893),d=i(11151);const s={sidebar_position:2},o="Gistd",r={id:"external/gistd",title:"Gistd",description:"Gistd instantly share typst documents on git and other network storage. The most important feature is that it based on typst.ts to compile typst document, you can select and copy text!",source:"@site/docs/external/gistd.md",sourceDirName:"external",slug:"/external/gistd",permalink:"/docs/external/gistd",draft:!1,unlisted:!1,editUrl:"https://github.com/touying-typ/touying/tree/main/docs/en/external/gistd.md",tags:[],version:"current",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"tutorialSidebar",previous:{title:"Touying Exporter",permalink:"/docs/external/touying-exporter"},next:{title:"Pympress",permalink:"/docs/external/pympress"}},a={},l=[{value:"Loading a document on GitHub",id:"loading-a-document-on-github",level:2},{value:"View Parameters",id:"view-parameters",level:2},{value:"Slide View",id:"slide-view",level:2},{value:"Loading a document by arbitrary links",id:"loading-a-document-by-arbitrary-links",level:2},{value:"Loading a document without cors proxy",id:"loading-a-document-without-cors-proxy",level:2},{value:"Loading a document with HTTP protocol",id:"loading-a-document-with-http-protocol",level:2},{value:"Development",id:"development",level:3}];function c(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",ul:"ul",...(0,d.a)(),...e.components};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(t.h1,{id:"gistd",children:"Gistd"}),"\n",(0,n.jsxs)(t.p,{children:[(0,n.jsx)(t.a,{href:"https://github.com/Myriad-Dreamin/gistd",children:"Gistd"})," instantly share ",(0,n.jsx)(t.a,{href:"https://typst.app",children:"typst"})," documents on git and other network storage. The most important feature is that it based on typst.ts to compile typst document, you can select and copy text!"]}),"\n",(0,n.jsxs)(t.ul,{children:["\n",(0,n.jsx)(t.li,{children:(0,n.jsx)(t.a,{href:"https://gistd.myriad-dreamin.com",children:"Global (Cloudflare CDN)"})}),"\n",(0,n.jsx)(t.li,{children:(0,n.jsx)(t.a,{href:"https://gistd-cn.myriad-dreamin.com",children:"Asia Region (Mirror, \u4e9a\u6d32\u533a\u57df\u955c\u50cf)"})}),"\n"]}),"\n",(0,n.jsx)(t.h2,{id:"loading-a-document-on-github",children:"Loading a document on GitHub"}),"\n",(0,n.jsx)(t.p,{children:"Assuming that you have a GitHub link, for example:"}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.code,{children:"https://github.com/typst/templates/blob/main/charged-ieee/template/main.typ\n"})}),"\n",(0,n.jsxs)(t.p,{children:["Simply replace the ",(0,n.jsx)(t.code,{children:"github.com"})," with ",(0,n.jsx)(t.code,{children:"gistd.myriad-dreamin.com"}),":"]}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.code,{children:"https://gistd.myriad-dreamin.com/typst/templates/blob/main/charged-ieee/template/main.typ\n"})}),"\n",(0,n.jsx)(t.p,{children:"Example Documents:"}),"\n",(0,n.jsxs)(t.ul,{children:["\n",(0,n.jsx)(t.li,{children:(0,n.jsx)(t.a,{href:"https://gistd.myriad-dreamin.com/johanvx/typst-undergradmath/blob/main/undergradmath.typ",children:"https://gistd.myriad-dreamin.com/johanvx/typst-undergradmath/blob/main/undergradmath.typ"})}),"\n",(0,n.jsx)(t.li,{children:(0,n.jsx)(t.a,{href:"https://gistd.myriad-dreamin.com/Jollywatt/typst-fletcher/blob/main/docs/manual.typ",children:"https://gistd.myriad-dreamin.com/Jollywatt/typst-fletcher/blob/main/docs/manual.typ"})}),"\n",(0,n.jsx)(t.li,{children:(0,n.jsx)(t.a,{href:"https://gistd.myriad-dreamin.com/typst/templates/blob/main/charged-ieee/template/main.typ",children:"https://gistd.myriad-dreamin.com/typst/templates/blob/main/charged-ieee/template/main.typ"})}),"\n"]}),"\n",(0,n.jsx)(t.h2,{id:"view-parameters",children:"View Parameters"}),"\n",(0,n.jsx)(t.p,{children:"These URL parameters can change the behavior of gistd."}),"\n",(0,n.jsxs)(t.ul,{children:["\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.code,{children:"g-page"}),": The page number to display. Default is ",(0,n.jsx)(t.code,{children:"1"}),". Only available in the slide mode."]}),"\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.code,{children:"g-mode"}),": The mode to display.","\n",(0,n.jsxs)(t.ul,{children:["\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.code,{children:"doc"}),": View the document in the document mode."]}),"\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.code,{children:"slide"}),": View the document in the slide mode."]}),"\n"]}),"\n"]}),"\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.code,{children:"g-version"}),": The typst compiler version to use.","\n",(0,n.jsxs)(t.ul,{children:["\n",(0,n.jsxs)(t.li,{children:["Could be ",(0,n.jsx)(t.code,{children:"v0.13.0"}),", ",(0,n.jsx)(t.code,{children:"v0.13.1"}),", ",(0,n.jsx)(t.code,{children:"v0.14.0"}),", or ",(0,n.jsx)(t.code,{children:"latest"}),"."]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,n.jsx)(t.h2,{id:"slide-view",children:"Slide View"}),"\n",(0,n.jsxs)(t.p,{children:["Using ",(0,n.jsx)(t.code,{children:"g-mode=slide"})," mentioned above to view the document in the slide mode:"]}),"\n",(0,n.jsx)(t.p,{children:"Example Documents:"}),"\n",(0,n.jsxs)(t.ul,{children:["\n",(0,n.jsx)(t.li,{children:(0,n.jsx)(t.a,{href:"https://gistd.myriad-dreamin.com/touying-typ/touying/blob/main/examples/simple.typ?g-mode=slide",children:"A simple touying side."})}),"\n"]}),"\n",(0,n.jsx)(t.h2,{id:"loading-a-document-by-arbitrary-links",children:"Loading a document by arbitrary links"}),"\n",(0,n.jsx)(t.p,{children:"Assuming that you have arbitrary link, for example:"}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.code,{children:"https://github.com/typst/templates/blob/main/charged-ieee/template/main.typ\n"})}),"\n",(0,n.jsxs)(t.p,{children:["Put ",(0,n.jsx)(t.code,{children:"any-gistd.myriad-dreamin.com"})," before the link:"]}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.code,{children:"https://any-gistd.myriad-dreamin.com/github.com/typst/templates/blob/main/charged-ieee/template/main.typ\n"})}),"\n",(0,n.jsxs)(t.p,{children:[(0,n.jsx)(t.code,{children:"any-gistd.myriad-dreamin.com"})," is alias for ",(0,n.jsx)(t.code,{children:"gistd.myriad-dreamin.com/@any"}),"."]}
1),"\n",(0,n.jsx)(t.p,{children:"If a domain (host) is specially identified, gistd will use corresponding approach to serve the document."}),"\n",(0,n.jsxs)(t.ul,{children:["\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.code,{children:"github.com"}),": git protocol."]}),"\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.code,{children:"codeberg.org"}),": git protocol."]}),"\n",(0,n.jsxs)(t.li,{children:[(0,n.jsx)(t.code,{children:"localhost"})," and others: HTTP protocol if host is ",(0,n.jsx)(t.code,{children:"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."]}),"\n"]}),"\n",(0,n.jsx)(t.p,{children:"Example Documents:"}),"\n",(0,n.jsxs)(t.ul,{children:["\n",(0,n.jsx)(t.li,{children:(0,n.jsx)(t.a,{href:"https://any-gistd.myriad-dreamin.com/github.com/Myriad-Dreamin/gistd/raw/main/README.typ",children:"https://any-gistd.myriad-dreamin.com/github.com/Myriad-Dreamin/gistd/raw/main/README.typ"})}),"\n",(0,n.jsx)(t.li,{children:(0,n.jsx)(t.a,{href:"https://gistd.myriad-dreamin.com/@any/github.com/Myriad-Dreamin/gistd/raw/main/README.typ",children:"https://gistd.myriad-dreamin.com/@any/github.com/Myriad-Dreamin/gistd/raw/main/README.typ"})}),"\n"]}),"\n",(0,n.jsx)(t.h2,{id:"loading-a-document-without-cors-proxy",children:"Loading a document without cors proxy"}),"\n",(0,n.jsxs)(t.p,{children:["By default, gistd uses a trusted cors proxy (",(0,n.jsx)(t.code,{children:"https://underleaf.mgt.workers.dev"}),") to load documents. This is because GitHub and Forgejo doesn't allow gistd to load documents. See ",(0,n.jsx)(t.a,{href:"https://isomorphic-git.org/docs/en/quickstart",children:"isomorphic-git: Quickstart"})," for more details."]}),"\n",(0,n.jsxs)(t.p,{children:["However, you may want to load a document without cors proxy. You can do this by adding ",(0,n.jsx)(t.code,{children:"g-cors=false"})," to the query string."]}),"\n",(0,n.jsxs)(t.p,{children:["For example, to load a document at ",(0,n.jsx)(t.code,{children:"http://localhost:11449/main.typ"}),":"]}),"\n",(0,n.jsxs)(t.ul,{children:["\n",(0,n.jsx)(t.li,{children:(0,n.jsx)(t.a,{href:"https://gistd.myriad-dreamin.com/@http/localhost:11449/main.typ?g-cors=false",children:"https://gistd.myriad-dreamin.com/@http/localhost:11449/main.typ?g-cors=false"})}),"\n"]}),"\n",(0,n.jsx)(t.h2,{id:"loading-a-document-with-http-protocol",children:"Loading a document with HTTP protocol"}),"\n",(0,n.jsxs)(t.p,{children:[(0,n.jsx)(t.code,{children:"@any"})," infers protocol from the URL, while you could use ",(0,n.jsx)(t.code,{children:"@http"})," to force HTTP protocol. For example, to load a document at ",(0,n.jsx)(t.code,{children:"http://localhost:11449/main.typ"}),":"]}),"\n",(0,n.jsxs)(t.ul,{children:["\n",(0,n.jsx)(t.li,{children:(0,n.jsx)(t.a,{href:"https://gistd.myriad-dreamin.com/@http/localhost:11449/main.typ?g-cors=false",children:"https://gistd.myriad-dreamin.com/@http/localhost:11449/main.typ?g-cors=false"})}),"\n"]}),"\n",(0,n.jsx)(t.h3,{id:"development",children:"Development"}),"\n",(0,n.jsx)(t.p,{children:"Install dependencies:"}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.code,{children:"pnpm install\n"})}),"\n",(0,n.jsx)(t.p,{children:"Develop locally:"}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.code,{children:"pnpm dev\n"})}),"\n",(0,n.jsx)(t.p,{children:"Build:"}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.code,{children:"pnpm build\n"})})]})}function h(e={}){const{wrapper:t}={...(0,d.a)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(c,{...e})}):c(e)}},11151:(e,t,i)=>{i.d(t,{Z:()=>r,a:()=>o});var n=i(67294);const d={},s=n.createContext(d);function o(e){const t=n.useContext(s);return n.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function r(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(d):e.components||d:o(e.components),n.createElement(s.Provider,{value:t},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.