PageSourceSearch

https://touying-typ.github.io/assets/js/9f2a9f6a.fe553454.js

js touying-typ.github.io collected 2026-10-03 10:06:13 UTC 5,085 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[1076],{66509:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>c,default:()=>h,frontMatter:()=>r,metadata:()=>s,toc:()=>a});var o=t(85893),i=t(11151);const r={sidebar_position:1,description:"Inject configuration changes into a block of content.",toc_max_heading_level:2},c="touying-set-config",s={id:"reference/core/touying-set-config",title:"touying-set-config",description:"Inject configuration changes into a block of content.",source:"@site/docs/reference/core/touying-set-config.mdx",sourceDirName:"reference/core",slug:"/reference/core/touying-set-config",permalink:"/docs/reference/core/touying-set-config",draft:!1,unlisted:!1,tags:[],version:"current",sidebarPosition:1,frontMatter:{sidebar_position:1,description:"Inject configuration changes into a block of content.",toc_max_heading_level:2},sidebar:"tutorialSidebar",previous:{title:"Core",permalink:"/docs/category/core"},next:{title:"appendix",permalink:"/docs/reference/core/appendix"}},d={},a=[{value:"config : <TypeLink></TypeLink>",id:"config",level:3},{value:"defer : <TypeLink></TypeLink> <Default><code>false</code></Default>",id:"defer",level:3},{value:"body : <TypeLink></TypeLink>",id:"body",level:3}];function l(e){const n={a:"a",code:"code",h1:"h1",h3:"h3",p:"p",strong:"strong",...(0,i.a)(),...e.components},{Default:t,Param:r,Parameters:c,Signature:s,SignatureName:d,SignatureParam:a,SourceLink:l,TypeLink:h}=n;return t||f("Default",!0),r||f("Param",!0),c||f("Parameters",!0),s||f("Signature",!0),d||f("SignatureName",!0),a||f("SignatureParam",!0),l||f("SourceLink",!0),h||f("TypeLink",!0),(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.h1,{id:"touying-set-config",children:"touying-set-config"}),"\n",(0,o.jsx)(s,{children:(0,o.jsxs)("code",{children:[(0,o.jsx)(d,{children:"touying-set-config"}),"(",(0,o.jsxs)(a,{children:[(0,o.jsx)(n.a,{href:"#config",children:"config"}),", "]}),(0,o.jsxs)(a,{children:[(0,o.jsx)(n.a,{href:"#defer",children:"defer: false"}),", "]}),(0,o.jsx)(a,{children:(0,o.jsx)(n.a,{href:"#body",children:"body"})}),")",(0,o.jsx)(l,{href:"https://github.com/touying-typ/touying/blob/main/src/core.typ#L31"})]})}),"\n",(0,o.jsxs)(n.p,{children:["Inject configuration changes into a block of content. Changes take effect only within ",(0,o.jsx)(n.code,{children:"body"}),". Useful for implementing features like ",(0,o.jsx)(n.code,{children:"#show: appendix"})," or changing the cover method on the fly."]}),"\n",(0,o.jsxs)(n.p,{children:["Example: ",(0,o.jsx)(n.code,{children:"#let appendix(body) = touying-set-config((appendix: true), defer:true, body)"})," and you can use ",(0,o.jsx)(n.code,{children:"#show: appendix"})," to set the appendix for the presentation."]}),"\n",(0,o.jsxs)(n.p,{children:["The keyword ",(0,o.jsx)(n.code,{children:"defer"})," is useful for features like ",(0,o.jsx)(n.code,{children:"appendix"}),", which should not take effect until the next slide starts. All following content is also then wrapped into the preamble, e.g. ",(0,o.jsx)(n.code,{children:"counter-update"}),", set or other show rules. Putting content after a deferred config show rule will not render it visibly in the document.\nYou may even use ",(0,o.jsx)(n.code,{children:"#show: touying-set-config.with((preamble: fn), defer:true)"})," to set a preamble function for the next slide or do similar config changes without calling the ",(0,o.jsx)(n.code,{children:"slide"})," function explicitly.\nJust relying on the deferred config change's ability to capture functions and running them also in the preamble is considered an antipattern."]}),"\n",(0,o.jsxs)(c,{children:[(0,o.jsxs)(n.h3,{id:"config",children:["config : ",(0,o.jsx)(h,{type:"dictionary"})]}),(0,o.jsx)(r,{children:(0,o.jsx)(n.p,{children:"The new configurations for the presentation."})}),(0,o.jsxs)(n.h3,{id:"defer",children:["defer : ",(0,o.jsx)(h,{type:"bool"})," ",(0,o.jsx)(t,{children:(0,o.jsx)(n.code,{children:"false"})})]}),(0,o.jsx)(r,{children:(0,o.jsx)(n.p,{children:"Whether to defer applying the config changes until the next slides preamble. Default is false (apply immediately)."})}),(0,o.jsxs)(n.h3,{id:"body",children:["body : ",(0,o.jsx)(h,{type:"content"})]}),(0,o.jsx)(r,{children:(0,o.jsx)(n.p,{children:"The content of the slide."})})]}),"\n",(0,o.jsxs)(n.p,{children:[(0,o.jsx)(n.strong,{children:"Returns:"})," ",(0,o.jsx)(h,{type:"content"})]})]})}function h(e={}){const{wrapper:n}={...(0,i.a)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(l,{...e})}):l(e)}function f(e,n){throw new Error("Expected "+(n?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}},11151:(e,n,t)=>{t.d(n,{Z:()=>s,a:()=>c});var o=t(67294);const i={},r=o.createContext(i);function c(e){const n=o.useContext(r);return o.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function s(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:c(e.components),o.createElement(r.Provider,{value:n},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.