1"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[6793],{61977:(t,e,n)=>{n.r(e),n.d(e,{assets:()=>l,contentTitle:()=>a,default:()=>c,frontMatter:()=>o,metadata:()=>r,toc:()=>p});var s=n(85893),i=n(11151);const o={sidebar_position:1},a="Touying Exporter",r={id:"external/touying-exporter",title:"Touying Exporter",description:"touying-exporter is a command-line tool that exports Touying presentations to various formats. It is designed to be used with Touying presentations, but it can also be used with other Typst files. Export presentation slides in various formats for Touying.",source:"@site/docs/external/touying-exporter.md",sourceDirName:"external",slug:"/external/touying-exporter",permalink:"/docs/external/touying-exporter",draft:!1,unlisted:!1,editUrl:"https://github.com/touying-typ/touying/tree/main/docs/en/external/touying-exporter.md",tags:[],version:"current",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"tutorialSidebar",previous:{title:"External Tools",permalink:"/docs/category/external-tools"},next:{title:"Gistd",permalink:"/docs/external/gistd"}},l={},p=[{value:"Touying Template",id:"touying-template",level:2},{value:"HTML Export",id:"html-export",level:2},{value:"PPTX Export",id:"pptx-export",level:2},{value:"Install",id:"install",level:2},{value:"CLI",id:"cli",level:2},{value:"Passing variables to typst",id:"passing-variables-to-typst",level:3},{value:"Use it as a python package",id:"use-it-as-a-python-package",level:2}];function u(t){const e={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",img:"img",li:"li",ol:"ol",p:"p",pre:"pre",...(0,i.a)(),...t.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(e.h1,{id:"touying-exporter",children:"Touying Exporter"}),"\n",(0,s.jsxs)(e.p,{children:[(0,s.jsx)(e.a,{href:"https://github.com/touying-typ/touying-exporter",children:"touying-exporter"})," is a command-line tool that exports Touying presentations to various formats. It is designed to be used with Touying presentations, but it can also be used with other Typst files. Export presentation slides in various formats for Touying."]}),"\n",(0,s.jsx)(e.h2,{id:"touying-template",children:"Touying Template"}),"\n",(0,s.jsxs)(e.p,{children:[(0,s.jsx)(e.a,{href:"https://github.com/touying-typ/touying-template",children:"Touying template"})," for online presentation in github pages."]}),"\n",(0,s.jsxs)(e.p,{children:["Demo: ",(0,s.jsx)(e.a,{href:"https://touying-typ.github.io/touying-template/",children:"https://touying-typ.github.io/touying-template/"})]}),"\n",(0,s.jsx)(e.p,{children:"To use this template, follow these steps:"}),"\n",(0,s.jsxs)(e.ol,{children:["\n",(0,s.jsxs)(e.li,{children:["Click ",(0,s.jsx)(e.code,{children:"Use this template"})," button to copy repo."]}),"\n",(0,s.jsxs)(e.li,{children:["Click ",(0,s.jsx)(e.code,{children:"Settings -> Pages -> Branch -> None -> gh-pages -> Save"})," to enable github pages."]}),"\n",(0,s.jsxs)(e.li,{children:["Open link ",(0,s.jsx)(e.code,{children:"your-name.github.io/repo-name"})," to start your presentation."]}),"\n"]}),"\n",(0,s.jsxs)(e.p,{children:["Disadvantages: Cannot select and copy text, if needed, please use ",(0,s.jsx)(e.a,{href:"https://github.com/Myriad-Dreamin/gistd",children:"Gistd"}),"."]}),"\n",(0,s.jsx)(e.h2,{id:"html-export",children:"HTML Export"}),"\n",(0,s.jsx)(e.p,{children:"We generate SVG image files and package them with impress.js into an HTML file. This way, you can open and present it using a browser, and it supports GIF animations and speaker notes."}),"\n",(0,s.jsx)(e.p,{children:(0,s.jsx)(e.img,{src:"https://github.com/touying-typ/touying-exporter/assets/34951714/207ddffc-87c8-4976-9bf4-4c6c5e2573ea",alt:"image"})}),"\n",(0,s.jsx)(e.p,{children:(0,s.jsx)(e.img,{src:"https://github.com/touying-typ/touying-exporter/assets/34951714/eac4976b-7d5d-40b6-8827-88c9a024b89a",alt:"image"})}),"\n",(0,s.jsxs)(e.p,{children:[(0,s.jsx)(e.a,{href:"https://github.com/touying-typ/touying-template",children:"Touying template"})," for online presentation. ",(0,s.jsx)(e.a,{href:"https://touying-typ.github.io/touying-template/",children:"Online"})]}),"\n",(0,s.jsx)(e.h2,{id:"pptx-export",children:"PPTX Export"}
1),"\n",(0,s.jsx)(e.p,{children:"We generate PNG image files and package them into a PPTX file. This way, you can open and present it using PowerPoint, and it supports speaker notes."}),"\n",(0,s.jsx)(e.p,{children:(0,s.jsx)(e.img,{src:"https://github.com/touying-typ/touying-exporter/assets/34951714/3d547c74-fb4b-4c31-81e5-5138a5d727c9",alt:"image"})}),"\n",(0,s.jsx)(e.h2,{id:"install",children:"Install"}),"\n",(0,s.jsx)(e.pre,{children:(0,s.jsx)(e.code,{className:"language-sh",children:"pip install touying\n"})}),"\n",(0,s.jsx)(e.h2,{id:"cli",children:"CLI"}),"\n",(0,s.jsx)(e.pre,{children:(0,s.jsx)(e.code,{className:"language-text",children:"usage: touying compile [-h] [--output OUTPUT] [--root ROOT] [--font-paths [FONT_PATHS ...]] [--start-page START_PAGE] [--count COUNT] [--ppi PPI] [--silent SILENT] [--format {html,pptx,pdf,pdfpc}] [--sys-inputs SYS_INPUTS] input\n\npositional arguments:\n input Input file\n\noptions:\n -h, --help show this help message and exit\n --output OUTPUT Output file\n --root ROOT Root directory for typst file\n --font-paths [FONT_PATHS ...]\n Paths to custom fonts\n --start-page START_PAGE\n Page to start from\n --count COUNT Number of pages to convert\n --ppi PPI Pixels per inch for PPTX format\n --silent SILENT Run silently\n --format {html,pptx,pdf,pdfpc}\n Output format\n --sys-inputs SYS_INPUTS\n JSON string to pass to typst's sys.inputs\n"})}),"\n",(0,s.jsx)(e.p,{children:"For example:"}),"\n",(0,s.jsx)(e.pre,{children:(0,s.jsx)(e.code,{className:"language-sh",children:"touying compile example.typ\n"})}),"\n",(0,s.jsxs)(e.p,{children:["You will get a ",(0,s.jsx)(e.code,{children:"example.html"})," file. Open it with your browser and start your presentation :-)"]}),"\n",(0,s.jsx)(e.h3,{id:"passing-variables-to-typst",children:"Passing variables to typst"}),"\n",(0,s.jsxs)(e.p,{children:["You can pass variables to your typst files using the ",(0,s.jsx)(e.code,{children:"--sys-inputs"})," parameter:"]}),"\n",(0,s.jsx)(e.pre,{children:(0,s.jsx)(e.code,{className:"language-sh",children:'touying compile example.typ --sys-inputs \'{"title":"My Presentation","author":"John Doe"}\'\n'})}),"\n",(0,s.jsx)(e.p,{children:"In your typst file, you can access these variables like this:"}),"\n",(0,s.jsx)(e.pre,{children:(0,s.jsx)(e.code,{className:"language-typst",children:'#let title = sys.inputs.at("title", default: "Default Title")\n#let author = sys.inputs.at("author", default: "Default Author")\n\n= #title\nBy #author\n'})}),"\n",(0,s.jsx)(e.h2,{id:"use-it-as-a-python-package",children:"Use it as a python package"}),"\n",(0,s.jsx)(e.pre,{children:(0,s.jsx)(e.code,{className:"language-python",children:'import touying\n\ntouying.to_html("example.typ")\n'})})]})}function c(t={}){const{wrapper:e}={...(0,i.a)(),...t.components};return e?(0,s.jsx)(e,{...t,children:(0,s.jsx)(u,{...t})}):u(t)}},11151:(t,e,n)=>{n.d(e,{Z:()=>r,a:()=>a});var s=n(67294);const i={},o=s.createContext(i);function a(t){const e=s.useContext(o);return s.useMemo((function(){return"function"==typeof t?t(e):{...e,...t}}),[e,t])}function r(t){let e;return e=t.disableParentContext?"function"==typeof t.components?t.components(i):t.components||i:a(t.components),s.createElement(o.Provider,{value:e},t.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.