[{"data":1,"prerenderedAt":2624},["ShallowReactive",2],{"navigation_docs":3,"-kits-go-types-and-funcs":205,"-kits-go-types-and-funcs-surround":2619},[4,31,67,111,132,163,189],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":30},"Getting started","i-lucide-rocket","\u002Fgetting-started","1.getting-started",[10,15,20,25],{"title":11,"path":12,"stem":13,"icon":14},"Introduction","\u002Fgetting-started\u002Fintroduction","1.getting-started\u002F1.introduction","i-lucide-house",{"title":16,"path":17,"stem":18,"icon":19},"Installation","\u002Fgetting-started\u002Finstallation","1.getting-started\u002F2.installation","i-lucide-download",{"title":21,"path":22,"stem":23,"icon":24},"Quick start","\u002Fgetting-started\u002Fquick-start","1.getting-started\u002F3.quick-start","i-lucide-play",{"title":26,"path":27,"stem":28,"icon":29},"Agent Skill","\u002Fgetting-started\u002Fagent-skill","1.getting-started\u002F4.agent-skill","i-lucide-sparkles",false,{"title":32,"icon":33,"path":34,"stem":35,"children":36,"page":30},"Authoring","i-lucide-pen-line","\u002Fauthoring","2.authoring",[37,42,47,52,57,62],{"title":38,"path":39,"stem":40,"icon":41},"Comark syntax","\u002Fauthoring\u002Fcomark-syntax","2.authoring\u002F1.comark-syntax","i-lucide-file-code",{"title":43,"path":44,"stem":45,"icon":46},"Frontmatter","\u002Fauthoring\u002Ffrontmatter","2.authoring\u002F2.frontmatter","i-lucide-heading",{"title":48,"path":49,"stem":50,"icon":51},"Components","\u002Fauthoring\u002Fcomponents","2.authoring\u002F3.components","i-lucide-blocks",{"title":53,"path":54,"stem":55,"icon":56},"Merge tags and data","\u002Fauthoring\u002Fmerge-tags-and-data","2.authoring\u002F4.merge-tags-and-data","i-lucide-braces",{"title":58,"path":59,"stem":60,"icon":61},"Actions and spans","\u002Fauthoring\u002Factions-and-spans","2.authoring\u002F5.actions-and-spans","i-lucide-mouse-pointer-click",{"title":63,"path":64,"stem":65,"icon":66},"Compile errors","\u002Fauthoring\u002Fcompile-errors","2.authoring\u002F6.compile-errors","i-lucide-circle-alert",{"title":68,"icon":69,"path":70,"stem":71,"children":72,"page":30},"Kits","i-lucide-palette","\u002Fkits","3.kits",[73,78,83,87,91,96,101,106],{"title":74,"path":75,"stem":76,"icon":77},"What is a kit","\u002Fkits\u002Fwhat-is-a-kit","3.kits\u002F1.what-is-a-kit","i-lucide-package",{"title":79,"path":80,"stem":81,"icon":82},"kit.yaml","\u002Fkits\u002Fkit-yaml","3.kits\u002F2.kit-yaml","i-lucide-file-cog",{"title":84,"path":85,"stem":86,"icon":51},"Component schemas","\u002Fkits\u002Fcomponent-schemas","3.kits\u002F3.component-schemas",{"title":88,"path":89,"stem":90,"icon":56},"Templates and views","\u002Fkits\u002Ftemplates-and-views","3.kits\u002F4.templates-and-views",{"title":92,"path":93,"stem":94,"icon":95},"Template checking","\u002Fkits\u002Ftemplate-checking","3.kits\u002F5.template-checking","i-lucide-shield-check",{"title":97,"path":98,"stem":99,"icon":100},"Go types and funcs","\u002Fkits\u002Fgo-types-and-funcs","3.kits\u002F6.go-types-and-funcs","i-lucide-code",{"title":102,"path":103,"stem":104,"icon":105},"Email-safe HTML","\u002Fkits\u002Femail-safe-html","3.kits\u002F7.email-safe-html","i-lucide-mail-check",{"title":107,"path":108,"stem":109,"icon":110},"Plain text","\u002Fkits\u002Fplain-text","3.kits\u002F8.plain-text","i-lucide-file-text",{"title":112,"icon":113,"path":114,"stem":115,"children":116,"page":30},"Sending","i-lucide-send","\u002Fsending","4.sending",[117,122,127],{"title":118,"path":119,"stem":120,"icon":121},"Profiles and config","\u002Fsending\u002Fprofiles-and-config","4.sending\u002F1.profiles-and-config","i-lucide-settings",{"title":123,"path":124,"stem":125,"icon":126},"Message and MIME","\u002Fsending\u002Fmessage-and-mime","4.sending\u002F2.message-and-mime","i-lucide-mail",{"title":128,"path":129,"stem":130,"icon":131},"SMTP","\u002Fsending\u002Fsmtp","4.sending\u002F3.smtp","i-lucide-server",{"title":133,"icon":134,"path":135,"stem":136,"children":137,"page":30},"Tooling","i-lucide-wrench","\u002Ftooling","5.tooling",[138,143,148,153,158],{"title":139,"path":140,"stem":141,"icon":142},"The lttr CLI","\u002Ftooling\u002Fcli","5.tooling\u002F1.cli","i-lucide-terminal",{"title":144,"path":145,"stem":146,"icon":147},"Studio","\u002Ftooling\u002Fstudio","5.tooling\u002F2.studio","i-lucide-eye",{"title":149,"path":150,"stem":151,"icon":152},"Editor setup","\u002Ftooling\u002Feditor-setup","5.tooling\u002F3.editor-setup","i-lucide-plug",{"title":154,"path":155,"stem":156,"icon":157},"Screenshots","\u002Ftooling\u002Fscreenshots","5.tooling\u002F4.screenshots","i-lucide-camera",{"title":159,"path":160,"stem":161,"icon":162},"Goldens and testing","\u002Ftooling\u002Fgoldens-and-testing","5.tooling\u002F5.goldens-and-testing","i-lucide-flask-conical",{"title":164,"icon":165,"path":166,"stem":167,"children":168,"page":30},"Guides","i-lucide-book-open","\u002Fguides","6.guides",[169,174,179,184],{"title":170,"path":171,"stem":172,"icon":173},"Build your own kit","\u002Fguides\u002Fbuild-your-own-kit","6.guides\u002F1.build-your-own-kit","i-lucide-hammer",{"title":175,"path":176,"stem":177,"icon":178},"The Quiet kit","\u002Fguides\u002Fthe-quiet-kit","6.guides\u002F2.the-quiet-kit","i-lucide-mail-open",{"title":180,"path":181,"stem":182,"icon":183},"Migrating from v0.1","\u002Fguides\u002Fmigrating-from-v0-1","6.guides\u002F3.migrating-from-v0-1","i-lucide-arrow-right-left",{"title":185,"path":186,"stem":187,"icon":188},"Releasing","\u002Fguides\u002Freleasing","6.guides\u002F4.releasing","i-lucide-tag",{"title":190,"icon":191,"path":192,"stem":193,"children":194,"page":30},"Reference","i-lucide-library","\u002Freference","7.reference",[195,200],{"title":196,"path":197,"stem":198,"icon":199},"API reference","\u002Freference\u002Fapi-reference","7.reference\u002F1.api-reference","i-lucide-list-tree",{"title":201,"path":202,"stem":203,"icon":204},"Gallery","\u002Freference\u002Fgallery","7.reference\u002F2.gallery","i-lucide-images",{"id":206,"title":97,"body":207,"description":2612,"extension":2613,"links":2614,"meta":2615,"navigation":2616,"path":98,"seo":2617,"stem":99,"__hash__":2618},"docs\u002F3.kits\u002F6.go-types-and-funcs.md",{"type":208,"value":209,"toc":2604},"minimark",[210,219,224,230,273,283,662,665,773,838,842,852,981,994,1123,1147,1155,1166,1225,1231,1235,1245,1744,1792,1795,1802,1806,1815,1822,1828,1845,1849,1867,2242,2248,2550,2584,2588,2600],[211,212,213,214,218],"p",{},"Most of a kit is files. Two things can only come from Go: the types of the values components bind, and extra template functions. Both are options to ",[215,216,217],"code",{},"kit.Load",", and both are checked like everything else: a kit template that misuses a bound type or a function fails at load.",[220,221,223],"h2",{"id":222},"register-a-type","Register a type",[211,225,226,227,229],{},"A kit that binds Go values lists their type names in ",[215,228,79],{},":",[231,232,238],"pre",{"className":233,"code":234,"filename":235,"language":236,"meta":237,"style":237},"language-yaml shiki shiki-themes github-light-high-contrast github-light-high-contrast github-dark","# Go types components may bind. The kit's Go package registers each one\n# with kit.Types, so this kit loads from Go, not from the CLI.\ntypes: [Invoice]\n","tutorial\u002Fkit\u002Fkit.yaml#L10-L12","yaml","",[215,239,240,249,255],{"__ignoreMap":237},[241,242,245],"span",{"class":243,"line":244},"line",1,[241,246,248],{"class":247},"sBq4M","# Go types components may bind. The kit's Go package registers each one\n",[241,250,252],{"class":243,"line":251},2,[241,253,254],{"class":247},"# with kit.Types, so this kit loads from Go, not from the CLI.\n",[241,256,258,262,266,270],{"class":243,"line":257},3,[241,259,261],{"class":260},"s71pN","types",[241,263,265],{"class":264},"sihDN",": [",[241,267,269],{"class":268},"sRBGO","Invoice",[241,271,272],{"class":264},"]\n",[211,274,275,276,278,279,282],{},"The kit's Go package defines the types. The tutorial's ",[215,277,269],{}," holds its lines and total, and ",[215,280,281],{},"Money"," formats itself:",[231,284,289],{"className":285,"code":286,"filename":287,"language":288,"meta":237,"style":237},"language-go shiki shiki-themes github-light-high-contrast github-light-high-contrast github-dark","\u002F\u002F Money is an amount in cents.\ntype Money int64\n\n\u002F\u002F String formats m in dollars, such as \"$1250.00\". Merge tags and kit\n\u002F\u002F templates both print a Money through it.\nfunc (m Money) String() string {\n    sign := \"\"\n    if m \u003C 0 {\n        sign, m = \"-\", -m\n    }\n    return fmt.Sprintf(\"%s$%d.%02d\", sign, m\u002F100, m%100)\n}\n\n\u002F\u002F Line is one line of an invoice.\ntype Line struct {\n    Name   string\n    Qty    int\n    Amount Money \u002F\u002F the line total\n}\n\n\u002F\u002F Invoice is the Go type the kit's invoice component binds. kit.yaml lists\n\u002F\u002F it under `types`, and Kit registers it under the same name.\ntype Invoice struct {\n    Number string\n    Lines  []Line\n    Total  Money\n}\n\n\u002F\u002F Data is the data of templates\u002Finvoice.md. Merge tags such as\n\u002F\u002F {{invoice.number}} and the :invoice=\"invoice\" binding resolve against it.\ntype Data struct {\n    Invoice Invoice `json:\"invoice\"`\n    Due     string  `json:\"due\"`\n    PayURL  string  `json:\"pay_url\"`\n}\n","tutorial\u002Ftutorial.go#L14-L48","go",[215,290,291,296,309,315,321,327,358,370,388,409,415,471,477,482,488,501,510,519,530,535,540,546,552,564,572,581,590,595,600,606,612,624,635,646,657],{"__ignoreMap":237},[241,292,293],{"class":243,"line":244},[241,294,295],{"class":247},"\u002F\u002F Money is an amount in cents.\n",[241,297,298,302,306],{"class":243,"line":251},[241,299,301],{"class":300},"s1Q0q","type",[241,303,305],{"class":304},"sSlKG"," Money",[241,307,308],{"class":300}," int64\n",[241,310,311],{"class":243,"line":257},[241,312,314],{"emptyLinePlaceholder":313},true,"\n",[241,316,318],{"class":243,"line":317},4,[241,319,320],{"class":247},"\u002F\u002F String formats m in dollars, such as \"$1250.00\". Merge tags and kit\n",[241,322,324],{"class":243,"line":323},5,[241,325,326],{"class":247},"\u002F\u002F templates both print a Money through it.\n",[241,328,330,333,336,340,342,345,349,352,355],{"class":243,"line":329},6,[241,331,332],{"class":300},"func",[241,334,335],{"class":264}," (",[241,337,339],{"class":338},"s-BBy","m ",[241,341,281],{"class":304},[241,343,344],{"class":264},") ",[241,346,348],{"class":347},"sPmw6","String",[241,350,351],{"class":264},"() ",[241,353,354],{"class":300},"string",[241,356,357],{"class":264}," {\n",[241,359,361,364,367],{"class":243,"line":360},7,[241,362,363],{"class":264},"    sign ",[241,365,366],{"class":300},":=",[241,368,369],{"class":268}," \"\"\n",[241,371,373,376,379,382,386],{"class":243,"line":372},8,[241,374,375],{"class":300},"    if",[241,377,378],{"class":264}," m ",[241,380,381],{"class":300},"\u003C",[241,383,385],{"class":384},"sTl1q"," 0",[241,387,357],{"class":264},[241,389,391,394,397,400,403,406],{"class":243,"line":390},9,[241,392,393],{"class":264},"        sign, m ",[241,395,396],{"class":300},"=",[241,398,399],{"class":268}," \"-\"",[241,401,402],{"class":264},", ",[241,404,405],{"class":300},"-",[241,407,408],{"class":264},"m\n",[241,410,412],{"class":243,"line":411},10,[241,413,414],{"class":264},"    }\n",[241,416,418,421,424,427,430,433,437,440,443,446,449,451,454,457,460,463,466,468],{"class":243,"line":417},11,[241,419,420],{"class":300},"    return",[241,422,423],{"class":264}," fmt.",[241,425,426],{"class":347},"Sprintf",[241,428,429],{"class":264},"(",[241,431,432],{"class":268},"\"",[241,434,436],{"class":435},"sFaxo","%s",[241,438,439],{"class":268},"$",[241,441,442],{"class":435},"%d",[241,444,445],{"class":268},".",[241,447,448],{"class":435},"%02d",[241,450,432],{"class":268},[241,452,453],{"class":264},", sign, m",[241,455,456],{"class":300},"\u002F",[241,458,459],{"class":384},"100",[241,461,462],{"class":264},", m",[241,464,465],{"class":300},"%",[241,467,459],{"class":384},[241,469,470],{"class":264},")\n",[241,472,474],{"class":243,"line":473},12,[241,475,476],{"class":264},"}\n",[241,478,480],{"class":243,"line":479},13,[241,481,314],{"emptyLinePlaceholder":313},[241,483,485],{"class":243,"line":484},14,[241,486,487],{"class":247},"\u002F\u002F Line is one line of an invoice.\n",[241,489,491,493,496,499],{"class":243,"line":490},15,[241,492,301],{"class":300},[241,494,495],{"class":304}," Line",[241,497,498],{"class":300}," struct",[241,500,357],{"class":264},[241,502,504,507],{"class":243,"line":503},16,[241,505,506],{"class":264},"    Name   ",[241,508,509],{"class":300},"string\n",[241,511,513,516],{"class":243,"line":512},17,[241,514,515],{"class":264},"    Qty    ",[241,517,518],{"class":300},"int\n",[241,520,522,525,527],{"class":243,"line":521},18,[241,523,524],{"class":264},"    Amount ",[241,526,281],{"class":304},[241,528,529],{"class":247}," \u002F\u002F the line total\n",[241,531,533],{"class":243,"line":532},19,[241,534,476],{"class":264},[241,536,538],{"class":243,"line":537},20,[241,539,314],{"emptyLinePlaceholder":313},[241,541,543],{"class":243,"line":542},21,[241,544,545],{"class":247},"\u002F\u002F Invoice is the Go type the kit's invoice component binds. kit.yaml lists\n",[241,547,549],{"class":243,"line":548},22,[241,550,551],{"class":247},"\u002F\u002F it under `types`, and Kit registers it under the same name.\n",[241,553,555,557,560,562],{"class":243,"line":554},23,[241,556,301],{"class":300},[241,558,559],{"class":304}," Invoice",[241,561,498],{"class":300},[241,563,357],{"class":264},[241,565,567,570],{"class":243,"line":566},24,[241,568,569],{"class":264},"    Number ",[241,571,509],{"class":300},[241,573,575,578],{"class":243,"line":574},25,[241,576,577],{"class":264},"    Lines  []",[241,579,580],{"class":304},"Line\n",[241,582,584,587],{"class":243,"line":583},26,[241,585,586],{"class":264},"    Total  ",[241,588,589],{"class":304},"Money\n",[241,591,593],{"class":243,"line":592},27,[241,594,476],{"class":264},[241,596,598],{"class":243,"line":597},28,[241,599,314],{"emptyLinePlaceholder":313},[241,601,603],{"class":243,"line":602},29,[241,604,605],{"class":247},"\u002F\u002F Data is the data of templates\u002Finvoice.md. Merge tags such as\n",[241,607,609],{"class":243,"line":608},30,[241,610,611],{"class":247},"\u002F\u002F {{invoice.number}} and the :invoice=\"invoice\" binding resolve against it.\n",[241,613,615,617,620,622],{"class":243,"line":614},31,[241,616,301],{"class":300},[241,618,619],{"class":304}," Data",[241,621,498],{"class":300},[241,623,357],{"class":264},[241,625,627,630,632],{"class":243,"line":626},32,[241,628,629],{"class":264},"    Invoice ",[241,631,269],{"class":304},[241,633,634],{"class":268}," `json:\"invoice\"`\n",[241,636,638,641,643],{"class":243,"line":637},33,[241,639,640],{"class":264},"    Due     ",[241,642,354],{"class":300},[241,644,645],{"class":268},"  `json:\"due\"`\n",[241,647,649,652,654],{"class":243,"line":648},34,[241,650,651],{"class":264},"    PayURL  ",[241,653,354],{"class":300},[241,655,656],{"class":268},"  `json:\"pay_url\"`\n",[241,658,660],{"class":243,"line":659},35,[241,661,476],{"class":264},[211,663,664],{},"Then it registers each listed name when it loads the kit:",[231,666,669],{"className":285,"code":667,"filename":668,"language":288,"meta":237,"style":237},"\u002F\u002F LoadKit loads the tutorial kit from fsys (a copy of kit\u002F on disk, say)\n\u002F\u002F with the Go types its components bind. A kit with `types` in kit.yaml\n\u002F\u002F loads only with every listed type registered. Kit() is\n\u002F\u002F LoadKit(Files()) cached.\nfunc LoadKit(fsys fs.FS) (*kit.Kit, error) {\n    return kit.Load(fsys, kit.Types(kit.TypeOf[Invoice](\"Invoice\")))\n}\n","tutorial\u002Ftutorial.go#L64-L70",[215,670,671,676,681,686,691,733,769],{"__ignoreMap":237},[241,672,673],{"class":243,"line":244},[241,674,675],{"class":247},"\u002F\u002F LoadKit loads the tutorial kit from fsys (a copy of kit\u002F on disk, say)\n",[241,677,678],{"class":243,"line":251},[241,679,680],{"class":247},"\u002F\u002F with the Go types its components bind. A kit with `types` in kit.yaml\n",[241,682,683],{"class":243,"line":257},[241,684,685],{"class":247},"\u002F\u002F loads only with every listed type registered. Kit() is\n",[241,687,688],{"class":243,"line":317},[241,689,690],{"class":247},"\u002F\u002F LoadKit(Files()) cached.\n",[241,692,693,695,698,700,703,706,708,711,714,717,720,722,725,727,730],{"class":243,"line":323},[241,694,332],{"class":300},[241,696,697],{"class":347}," LoadKit",[241,699,429],{"class":264},[241,701,702],{"class":338},"fsys",[241,704,705],{"class":304}," fs",[241,707,445],{"class":264},[241,709,710],{"class":304},"FS",[241,712,713],{"class":264},") (",[241,715,716],{"class":300},"*",[241,718,719],{"class":304},"kit",[241,721,445],{"class":264},[241,723,724],{"class":304},"Kit",[241,726,402],{"class":264},[241,728,729],{"class":300},"error",[241,731,732],{"class":264},") {\n",[241,734,735,737,740,743,746,749,752,755,758,760,763,766],{"class":243,"line":329},[241,736,420],{"class":300},[241,738,739],{"class":264}," kit.",[241,741,742],{"class":347},"Load",[241,744,745],{"class":264},"(fsys, kit.",[241,747,748],{"class":347},"Types",[241,750,751],{"class":264},"(kit.",[241,753,754],{"class":347},"TypeOf",[241,756,757],{"class":264},"[",[241,759,269],{"class":304},[241,761,762],{"class":264},"](",[241,764,765],{"class":268},"\"Invoice\"",[241,767,768],{"class":264},")))\n",[241,770,771],{"class":243,"line":360},[241,772,476],{"class":264},[774,775,776,806,825],"ul",{},[777,778,779,785,786,789,790,793,794,797,798,803,804,445],"li",{},[780,781,782],"strong",{},[215,783,784],{},"kit.TypeOf[T](name)"," returns a ",[215,787,788],{},"kit.TypeDef"," registering ",[215,791,792],{},"T"," under ",[215,795,796],{},"name",". ",[780,799,800],{},[215,801,802],{},"kit.Types(defs...)"," passes them to ",[215,805,742],{},[777,807,808,811,812,814,815,817,818,820,821,824],{},[780,809,810],{},"Names"," are identifiers, each registered once. Every name in ",[215,813,79],{},"'s ",[215,816,261],{}," must be registered, or ",[215,819,742],{}," reports ",[215,822,823],{},"types: \"Invoice\" is not registered"," at its position.",[777,826,827,830,831,833,834,837],{},[780,828,829],{},"Any Go type works",": structs, named scalars such as ",[215,832,281],{},", and slices. Quiet registers ",[215,835,836],{},"kit.TypeOf[[]StockItem](\"StockItems\")"," so a component can bind a plain slice.",[220,839,841],{"id":840},"bind-the-type-in-a-component","Bind the type in a component",[211,843,844,845,848,849,229],{},"A component names the registered type in its ",[215,846,847],{},"bindings",", here ",[215,850,851],{},"invoice: { type: Invoice, required: true }",[231,853,856],{"className":233,"code":854,"filename":855,"language":236,"meta":237,"style":237},"# An invoice: the bound Invoice's lines, then its total. A template\n# passes the invoice with a binding: ::invoice{:invoice=\"invoice\"}.\nname: invoice\nattrs:\n  title: { type: text, default: Invoice }\nbindings:\n  invoice: { type: Invoice, required: true }\ncontent: none\nspacing:\n  top: size.block\n  bottom: size.gap\n","tutorial\u002Fkit\u002Fcomponents\u002Finvoice\u002Fcomponent.yaml",[215,857,858,863,868,878,886,913,919,944,954,961,971],{"__ignoreMap":237},[241,859,860],{"class":243,"line":244},[241,861,862],{"class":247},"# An invoice: the bound Invoice's lines, then its total. A template\n",[241,864,865],{"class":243,"line":251},[241,866,867],{"class":247},"# passes the invoice with a binding: ::invoice{:invoice=\"invoice\"}.\n",[241,869,870,872,875],{"class":243,"line":257},[241,871,796],{"class":260},[241,873,874],{"class":264},": ",[241,876,877],{"class":268},"invoice\n",[241,879,880,883],{"class":243,"line":317},[241,881,882],{"class":260},"attrs",[241,884,885],{"class":264},":\n",[241,887,888,891,894,896,898,901,903,906,908,910],{"class":243,"line":323},[241,889,890],{"class":260},"  title",[241,892,893],{"class":264},": { ",[241,895,301],{"class":260},[241,897,874],{"class":264},[241,899,900],{"class":268},"text",[241,902,402],{"class":264},[241,904,905],{"class":260},"default",[241,907,874],{"class":264},[241,909,269],{"class":268},[241,911,912],{"class":264}," }\n",[241,914,915,917],{"class":243,"line":329},[241,916,847],{"class":260},[241,918,885],{"class":264},[241,920,921,924,926,928,930,932,934,937,939,942],{"class":243,"line":360},[241,922,923],{"class":260},"  invoice",[241,925,893],{"class":264},[241,927,301],{"class":260},[241,929,874],{"class":264},[241,931,269],{"class":268},[241,933,402],{"class":264},[241,935,936],{"class":260},"required",[241,938,874],{"class":264},[241,940,941],{"class":384},"true",[241,943,912],{"class":264},[241,945,946,949,951],{"class":243,"line":372},[241,947,948],{"class":260},"content",[241,950,874],{"class":264},[241,952,953],{"class":268},"none\n",[241,955,956,959],{"class":243,"line":390},[241,957,958],{"class":260},"spacing",[241,960,885],{"class":264},[241,962,963,966,968],{"class":243,"line":411},[241,964,965],{"class":260},"  top",[241,967,874],{"class":264},[241,969,970],{"class":268},"size.block\n",[241,972,973,976,978],{"class":243,"line":417},[241,974,975],{"class":260},"  bottom",[241,977,874],{"class":264},[241,979,980],{"class":268},"size.gap\n",[211,982,983,984,987,988,990,991,229],{},"The template passes a value from its data with ",[215,985,986],{},":key=\"path\"",". The tutorial's data type has an ",[215,989,269],{}," field under the JSON name ",[215,992,993],{},"invoice",[231,995,1000],{"className":996,"code":997,"filename":998,"language":999,"meta":237,"style":237},"language-markdown shiki shiki-themes github-light-high-contrast github-light-high-contrast github-dark","---\ntemplate: invoice\nprofile: billing\nsubject: \"Invoice {{invoice.number}}\"\npreheader: \"{{invoice.total}} due by {{due}}.\"\n---\n\n# Your invoice\n\nHi {{name | there}}, here is invoice {{invoice.number}} for September.\n\n::invoice{:invoice=\"invoice\"}\n::\n\n::section\nPlease pay by {{due}} to keep your plan active.\n\n:button[Pay {{invoice.total}}]{href=\"{{pay_url}}\"}\n::\n\n::footer{note=\"Questions about this invoice? Reply to this email.\"}\n::\n","tutorial\u002Ftemplates\u002Finvoice.md","markdown",[215,1001,1002,1007,1016,1026,1036,1046,1050,1054,1060,1064,1069,1073,1078,1083,1087,1092,1097,1101,1106,1110,1114,1119],{"__ignoreMap":237},[241,1003,1004],{"class":243,"line":244},[241,1005,1006],{"class":264},"---\n",[241,1008,1009,1012,1014],{"class":243,"line":251},[241,1010,1011],{"class":260},"template",[241,1013,874],{"class":264},[241,1015,877],{"class":268},[241,1017,1018,1021,1023],{"class":243,"line":257},[241,1019,1020],{"class":260},"profile",[241,1022,874],{"class":264},[241,1024,1025],{"class":268},"billing\n",[241,1027,1028,1031,1033],{"class":243,"line":317},[241,1029,1030],{"class":260},"subject",[241,1032,874],{"class":264},[241,1034,1035],{"class":268},"\"Invoice {{invoice.number}}\"\n",[241,1037,1038,1041,1043],{"class":243,"line":323},[241,1039,1040],{"class":260},"preheader",[241,1042,874],{"class":264},[241,1044,1045],{"class":268},"\"{{invoice.total}} due by {{due}}.\"\n",[241,1047,1048],{"class":243,"line":329},[241,1049,1006],{"class":264},[241,1051,1052],{"class":243,"line":360},[241,1053,314],{"emptyLinePlaceholder":313},[241,1055,1056],{"class":243,"line":372},[241,1057,1059],{"class":1058},"su3Io","# Your invoice\n",[241,1061,1062],{"class":243,"line":390},[241,1063,314],{"emptyLinePlaceholder":313},[241,1065,1066],{"class":243,"line":411},[241,1067,1068],{"class":264},"Hi {{name | there}}, here is invoice {{invoice.number}} for September.\n",[241,1070,1071],{"class":243,"line":417},[241,1072,314],{"emptyLinePlaceholder":313},[241,1074,1075],{"class":243,"line":473},[241,1076,1077],{"class":264},"::invoice{:invoice=\"invoice\"}\n",[241,1079,1080],{"class":243,"line":479},[241,1081,1082],{"class":264},"::\n",[241,1084,1085],{"class":243,"line":484},[241,1086,314],{"emptyLinePlaceholder":313},[241,1088,1089],{"class":243,"line":490},[241,1090,1091],{"class":264},"::section\n",[241,1093,1094],{"class":243,"line":503},[241,1095,1096],{"class":264},"Please pay by {{due}} to keep your plan active.\n",[241,1098,1099],{"class":243,"line":512},[241,1100,314],{"emptyLinePlaceholder":313},[241,1102,1103],{"class":243,"line":521},[241,1104,1105],{"class":264},":button[Pay {{invoice.total}}]{href=\"{{pay_url}}\"}\n",[241,1107,1108],{"class":243,"line":532},[241,1109,1082],{"class":264},[241,1111,1112],{"class":243,"line":537},[241,1113,314],{"emptyLinePlaceholder":313},[241,1115,1116],{"class":243,"line":542},[241,1117,1118],{"class":264},"::footer{note=\"Questions about this invoice? Reply to this email.\"}\n",[241,1120,1121],{"class":243,"line":548},[241,1122,1082],{"class":264},[211,1124,1125,1126,1129,1130,1132,1133,1135,1136,1139,1140,1143,1144,229],{},"In the component's templates, ",[215,1127,1128],{},".Bind.invoice"," is then an ",[215,1131,269],{},". Fields and methods are checked at load, and a value prints through its ",[215,1134,348],{}," method: ",[215,1137,1138],{},"{{.Bind.invoice.Total}}"," renders ",[215,1141,1142],{},"$76.00",". The text form calls the method explicitly, to pass a string to ",[215,1145,1146],{},"leader",[231,1148,1153],{"className":1149,"code":1151,"filename":1152,"language":900,"meta":237},[1150],"language-text","{{- \u002F* The invoice as dot leaders. leaders lines its rows up in one\ncolumn; each row here is its own call, since a template cannot collect\nrows in a loop, and short labels share the same column anyway. *\u002F -}}\n{{upper .Attrs.title}} {{.Bind.invoice.Number}}\n\n{{range .Bind.invoice.Lines -}}\n{{leaders (leader (printf \"%s x%d\" .Name .Qty) .Amount.String)}}\n{{end -}}\n{{leaders (leader \"Total\" .Bind.invoice.Total.String)}}\n","tutorial\u002Fkit\u002Fcomponents\u002Finvoice\u002Ftext.tmpl",[215,1154,1151],{"__ignoreMap":237},[211,1156,1157,1158,1161,1162,1165],{},"The bound value must have exactly the registered type. These are compile errors from ",[215,1159,1160],{},"lttr.Compile"," against the tutorial kit, each from ",[215,1163,1164],{},"invoice.md"," above with one change to line 12:",[1167,1168,1169,1182],"table",{},[1170,1171,1172],"thead",{},[1173,1174,1175,1179],"tr",{},[1176,1177,1178],"th",{},"Template",[1176,1180,1181],{},"Error",[1183,1184,1185,1199,1212],"tbody",{},[1173,1186,1187,1194],{},[1188,1189,1190,1193],"td",{},[215,1191,1192],{},"::invoice"," with no binding",[1188,1195,1196],{},[215,1197,1198],{},"invoice:12:1: invoice: missing binding \":invoice\"",[1173,1200,1201,1207],{},[1188,1202,1203,1206],{},[215,1204,1205],{},"::invoice{:invoice=\"due\"}",", a string field",[1188,1208,1209],{},[215,1210,1211],{},"invoice:12:1: invoice: :invoice is string, want tutorial.Invoice",[1173,1213,1214,1220],{},[1188,1215,1216,1217],{},"Unchanged, but compiled as ",[215,1218,1219],{},"map[string]any",[1188,1221,1222],{},[215,1223,1224],{},"invoice:12:1: invoice: :invoice is untyped data (invoice), want tutorial.Invoice",[211,1226,1227,1228,445],{},"Untyped data can fill merge tags, but never a binding. See ",[1229,1230,53],"a",{"href":54},[220,1232,1234],{"id":1233},"add-template-functions","Add template functions",[211,1236,1237,1240,1241,1244],{},[215,1238,1239],{},"kit.Funcs"," adds functions to every kit template: HTML, text and ",[215,1242,1243],{},"styles.css",". The renderer installs the same functions when it renders. Use them for what templates cannot express, such as formatting or choosing a word; keep the markup in the templates.",[231,1246,1249],{"className":285,"code":1247,"filename":1248,"language":288,"meta":237,"style":237},"package main\n\nimport (\n    \"fmt\"\n    \"log\"\n    \"os\"\n\n    \"github.com\u002Fsulv-io\u002Flttr\u002Fkit\"\n)\n\n\u002F\u002F Money, Line and Invoice are the Go values the kit's invoice component\n\u002F\u002F binds; kit.yaml lists Invoice under `types`.\ntype Money int64\n\nfunc (m Money) String() string { return fmt.Sprintf(\"$%d.%02d\", m\u002F100, m%100) }\n\ntype Line struct {\n    Name   string\n    Qty    int\n    Amount Money\n}\n\ntype Invoice struct {\n    Number string\n    Lines  []Line\n    Total  Money\n}\n\n\u002F\u002F plural is an extra template function: {{plural .Qty \"seat\" \"seats\"}}.\nfunc plural(n int, one, many string) string {\n    if n == 1 {\n        return one\n    }\n    return many\n}\n\nfunc main() {\n    k, err := kit.Load(os.DirFS(\"emailkit\"),\n        kit.Types(kit.TypeOf[Invoice](\"Invoice\")),\n        kit.Funcs(map[string]any{\"plural\": plural}),\n    )\n    if err != nil {\n        log.Fatal(err) \u002F\u002F every problem, each with its kit file position\n    }\n    fmt.Printf(\"loaded %s: %d components\\n\", k.Name(), len(k.Components()))\n}\n","main.go",[215,1250,1251,1259,1263,1271,1282,1291,1300,1304,1313,1317,1321,1326,1331,1339,1343,1399,1403,1413,1419,1425,1431,1435,1439,1449,1455,1461,1467,1471,1475,1480,1514,1529,1537,1541,1548,1552,1557,1568,1594,1617,1649,1655,1671,1686,1691,1739],{"__ignoreMap":237},[241,1252,1253,1256],{"class":243,"line":244},[241,1254,1255],{"class":300},"package",[241,1257,1258],{"class":304}," main\n",[241,1260,1261],{"class":243,"line":251},[241,1262,314],{"emptyLinePlaceholder":313},[241,1264,1265,1268],{"class":243,"line":257},[241,1266,1267],{"class":300},"import",[241,1269,1270],{"class":264}," (\n",[241,1272,1273,1276,1279],{"class":243,"line":317},[241,1274,1275],{"class":268},"    \"",[241,1277,1278],{"class":304},"fmt",[241,1280,1281],{"class":268},"\"\n",[241,1283,1284,1286,1289],{"class":243,"line":323},[241,1285,1275],{"class":268},[241,1287,1288],{"class":304},"log",[241,1290,1281],{"class":268},[241,1292,1293,1295,1298],{"class":243,"line":329},[241,1294,1275],{"class":268},[241,1296,1297],{"class":304},"os",[241,1299,1281],{"class":268},[241,1301,1302],{"class":243,"line":360},[241,1303,314],{"emptyLinePlaceholder":313},[241,1305,1306,1308,1311],{"class":243,"line":372},[241,1307,1275],{"class":268},[241,1309,1310],{"class":304},"github.com\u002Fsulv-io\u002Flttr\u002Fkit",[241,1312,1281],{"class":268},[241,1314,1315],{"class":243,"line":390},[241,1316,470],{"class":264},[241,1318,1319],{"class":243,"line":411},[241,1320,314],{"emptyLinePlaceholder":313},[241,1322,1323],{"class":243,"line":417},[241,1324,1325],{"class":247},"\u002F\u002F Money, Line and Invoice are the Go values the kit's invoice component\n",[241,1327,1328],{"class":243,"line":473},[241,1329,1330],{"class":247},"\u002F\u002F binds; kit.yaml lists Invoice under `types`.\n",[241,1332,1333,1335,1337],{"class":243,"line":479},[241,1334,301],{"class":300},[241,1336,305],{"class":304},[241,1338,308],{"class":300},[241,1340,1341],{"class":243,"line":484},[241,1342,314],{"emptyLinePlaceholder":313},[241,1344,1345,1347,1349,1351,1353,1355,1357,1359,1361,1364,1367,1369,1371,1373,1376,1378,1380,1382,1384,1386,1388,1390,1392,1394,1396],{"class":243,"line":490},[241,1346,332],{"class":300},[241,1348,335],{"class":264},[241,1350,339],{"class":338},[241,1352,281],{"class":304},[241,1354,344],{"class":264},[241,1356,348],{"class":347},[241,1358,351],{"class":264},[241,1360,354],{"class":300},[241,1362,1363],{"class":264}," { ",[241,1365,1366],{"class":300},"return",[241,1368,423],{"class":264},[241,1370,426],{"class":347},[241,1372,429],{"class":264},[241,1374,1375],{"class":268},"\"$",[241,1377,442],{"class":435},[241,1379,445],{"class":268},[241,1381,448],{"class":435},[241,1383,432],{"class":268},[241,1385,462],{"class":264},[241,1387,456],{"class":300},[241,1389,459],{"class":384},[241,1391,462],{"class":264},[241,1393,465],{"class":300},[241,1395,459],{"class":384},[241,1397,1398],{"class":264},") }\n",[241,1400,1401],{"class":243,"line":503},[241,1402,314],{"emptyLinePlaceholder":313},[241,1404,1405,1407,1409,1411],{"class":243,"line":512},[241,1406,301],{"class":300},[241,1408,495],{"class":304},[241,1410,498],{"class":300},[241,1412,357],{"class":264},[241,1414,1415,1417],{"class":243,"line":521},[241,1416,506],{"class":264},[241,1418,509],{"class":300},[241,1420,1421,1423],{"class":243,"line":532},[241,1422,515],{"class":264},[241,1424,518],{"class":300},[241,1426,1427,1429],{"class":243,"line":537},[241,1428,524],{"class":264},[241,1430,589],{"class":304},[241,1432,1433],{"class":243,"line":542},[241,1434,476],{"class":264},[241,1436,1437],{"class":243,"line":548},[241,1438,314],{"emptyLinePlaceholder":313},[241,1440,1441,1443,1445,1447],{"class":243,"line":554},[241,1442,301],{"class":300},[241,1444,559],{"class":304},[241,1446,498],{"class":300},[241,1448,357],{"class":264},[241,1450,1451,1453],{"class":243,"line":566},[241,1452,569],{"class":264},[241,1454,509],{"class":300},[241,1456,1457,1459],{"class":243,"line":574},[241,1458,577],{"class":264},[241,1460,580],{"class":304},[241,1462,1463,1465],{"class":243,"line":583},[241,1464,586],{"class":264},[241,1466,589],{"class":304},[241,1468,1469],{"class":243,"line":592},[241,1470,476],{"class":264},[241,1472,1473],{"class":243,"line":597},[241,1474,314],{"emptyLinePlaceholder":313},[241,1476,1477],{"class":243,"line":602},[241,1478,1479],{"class":247},"\u002F\u002F plural is an extra template function: {{plural .Qty \"seat\" \"seats\"}}.\n",[241,1481,1482,1484,1487,1489,1492,1495,1497,1500,1502,1505,1508,1510,1512],{"class":243,"line":608},[241,1483,332],{"class":300},[241,1485,1486],{"class":347}," plural",[241,1488,429],{"class":264},[241,1490,1491],{"class":338},"n",[241,1493,1494],{"class":300}," int",[241,1496,402],{"class":264},[241,1498,1499],{"class":338},"one",[241,1501,402],{"class":264},[241,1503,1504],{"class":338},"many",[241,1506,1507],{"class":300}," string",[241,1509,344],{"class":264},[241,1511,354],{"class":300},[241,1513,357],{"class":264},[241,1515,1516,1518,1521,1524,1527],{"class":243,"line":614},[241,1517,375],{"class":300},[241,1519,1520],{"class":264}," n ",[241,1522,1523],{"class":300},"==",[241,1525,1526],{"class":384}," 1",[241,1528,357],{"class":264},[241,1530,1531,1534],{"class":243,"line":626},[241,1532,1533],{"class":300},"        return",[241,1535,1536],{"class":264}," one\n",[241,1538,1539],{"class":243,"line":637},[241,1540,414],{"class":264},[241,1542,1543,1545],{"class":243,"line":648},[241,1544,420],{"class":300},[241,1546,1547],{"class":264}," many\n",[241,1549,1550],{"class":243,"line":659},[241,1551,476],{"class":264},[241,1553,1555],{"class":243,"line":1554},36,[241,1556,314],{"emptyLinePlaceholder":313},[241,1558,1560,1562,1565],{"class":243,"line":1559},37,[241,1561,332],{"class":300},[241,1563,1564],{"class":347}," main",[241,1566,1567],{"class":264},"() {\n",[241,1569,1571,1574,1576,1578,1580,1583,1586,1588,1591],{"class":243,"line":1570},38,[241,1572,1573],{"class":264},"    k, err ",[241,1575,366],{"class":300},[241,1577,739],{"class":264},[241,1579,742],{"class":347},[241,1581,1582],{"class":264},"(os.",[241,1584,1585],{"class":347},"DirFS",[241,1587,429],{"class":264},[241,1589,1590],{"class":268},"\"emailkit\"",[241,1592,1593],{"class":264},"),\n",[241,1595,1597,1600,1602,1604,1606,1608,1610,1612,1614],{"class":243,"line":1596},39,[241,1598,1599],{"class":264},"        kit.",[241,1601,748],{"class":347},[241,1603,751],{"class":264},[241,1605,754],{"class":347},[241,1607,757],{"class":264},[241,1609,269],{"class":304},[241,1611,762],{"class":264},[241,1613,765],{"class":268},[241,1615,1616],{"class":264},")),\n",[241,1618,1620,1622,1625,1627,1630,1632,1634,1637,1640,1643,1646],{"class":243,"line":1619},40,[241,1621,1599],{"class":264},[241,1623,1624],{"class":347},"Funcs",[241,1626,429],{"class":264},[241,1628,1629],{"class":300},"map",[241,1631,757],{"class":264},[241,1633,354],{"class":300},[241,1635,1636],{"class":264},"]",[241,1638,1639],{"class":304},"any",[241,1641,1642],{"class":264},"{",[241,1644,1645],{"class":268},"\"plural\"",[241,1647,1648],{"class":264},": plural}),\n",[241,1650,1652],{"class":243,"line":1651},41,[241,1653,1654],{"class":264},"    )\n",[241,1656,1658,1660,1663,1666,1669],{"class":243,"line":1657},42,[241,1659,375],{"class":300},[241,1661,1662],{"class":264}," err ",[241,1664,1665],{"class":300},"!=",[241,1667,1668],{"class":384}," nil",[241,1670,357],{"class":264},[241,1672,1674,1677,1680,1683],{"class":243,"line":1673},43,[241,1675,1676],{"class":264},"        log.",[241,1678,1679],{"class":347},"Fatal",[241,1681,1682],{"class":264},"(err) ",[241,1684,1685],{"class":247},"\u002F\u002F every problem, each with its kit file position\n",[241,1687,1689],{"class":243,"line":1688},44,[241,1690,414],{"class":264},[241,1692,1694,1697,1700,1702,1705,1707,1709,1711,1714,1717,1719,1722,1725,1728,1731,1734,1736],{"class":243,"line":1693},45,[241,1695,1696],{"class":264},"    fmt.",[241,1698,1699],{"class":347},"Printf",[241,1701,429],{"class":264},[241,1703,1704],{"class":268},"\"loaded ",[241,1706,436],{"class":435},[241,1708,874],{"class":268},[241,1710,442],{"class":435},[241,1712,1713],{"class":268}," components",[241,1715,1716],{"class":435},"\\n",[241,1718,432],{"class":268},[241,1720,1721],{"class":264},", k.",[241,1723,1724],{"class":347},"Name",[241,1726,1727],{"class":264},"(), ",[241,1729,1730],{"class":347},"len",[241,1732,1733],{"class":264},"(k.",[241,1735,48],{"class":347},[241,1737,1738],{"class":264},"()))\n",[241,1740,1742],{"class":243,"line":1741},46,[241,1743,476],{"class":264},[774,1745,1746,1754,1771,1784],{},[777,1747,1748,1753],{},[780,1749,1750,1751,445],{},"A function returns one value, or a value and an ",[215,1752,729],{}," A non-nil error is a render error at the call, like any core function's.",[777,1755,1756,1759,1760,1763,1764,1767,1768,445],{},[780,1757,1758],{},"Calls are type-checked"," against the Go signature. With ",[215,1761,1762],{},"plural"," registered, ",[215,1765,1766],{},"(plural .Name \"seat\" \"seats\")"," in the invoice's text form fails at load: ",[215,1769,1770],{},"components\u002Finvoice\u002Ftext.tmpl:7:58: plural: argument 1 is string, want int",[777,1772,1773,1775,1776,1779,1780,1783],{},[780,1774,810],{}," must be identifiers and must not collide with a core function (",[215,1777,1778],{},"kit.CoreFuncNames()",") or a ",[215,1781,1782],{},"text\u002Ftemplate"," builtin.",[777,1785,1786,1791],{},[780,1787,1788,1790],{},[215,1789,742],{}," never runs them."," The type check reads their signatures, and the escape check executes stand-ins.",[211,1793,1794],{},"A bad registration is a load error with no file position:",[231,1796,1800],{"className":1797,"code":1798,"filename":1799,"language":900,"meta":237},[1150],"funcs: \"len\" collides with a template builtin\nfuncs: \"token\" collides with a core function\nfuncs: \"two\" must return one value, or a value and an error\n","kit.Load error",[215,1801,1798],{"__ignoreMap":237},[220,1803,1805],{"id":1804},"know-why-the-cli-cannot-load-them","Know why the CLI cannot load them",[211,1807,1808,1809,1811,1812,1814],{},"The CLI loads a kit directory with no Go options: it has no Go types and no functions for it. A kit that lists ",[215,1810,261],{},", or calls a function from ",[215,1813,1239],{},", fails to load there, and the CLI says so:",[231,1816,1820],{"className":1817,"code":1818,"filename":1819,"language":900,"meta":237},[1150],"$ lttr kit check examples\u002Ftutorial\u002Fkit\nexamples\u002Ftutorial\u002Fkit\u002Fkit.yaml:12:9: types: \"Invoice\" is not registered\nexamples\u002Ftutorial\u002Fkit: kit directories load without Go types; check kits that bind Go types from Go (see README)\n","Terminal",[215,1821,1818],{"__ignoreMap":237},[231,1823,1826],{"className":1824,"code":1825,"filename":1819,"language":900,"meta":237},[1150],"$ lttr kit check .\u002Femailkit\nemailkit\u002Fcomponents\u002Fsection\u002Ftext.tmpl:1: function \"money\" not defined\n.\u002Femailkit: kit directories load without Go template functions (kit.Funcs); check kits that add functions from Go (see README)\n",[215,1827,1825],{"__ignoreMap":237},[211,1829,1830,1831,402,1834,402,1837,1840,1841,1844],{},"So ",[215,1832,1833],{},"lttr kit check",[215,1835,1836],{},"lint",[215,1838,1839],{},"preview"," and ",[215,1842,1843],{},"serve"," cannot show such a kit from its directory. Check it from Go instead.",[220,1846,1848],{"id":1847},"check-a-typed-kit-from-go","Check a typed kit from Go",[211,1850,1851,1852,1854,1855,1858,1859,1862,1863,1866],{},"Test the kit in its own package: load it with its options, then compile and render every template with typed data and lint the HTML. The ",[215,1853,1836],{}," package does the compiling, rendering and linting over an ",[215,1856,1857],{},"lttr.SampleSet",", which holds the kit, the ",[215,1860,1861],{},"Config"," to render with and the samples. The tutorial's package describes its invoice template that way, with the ",[215,1864,1865],{},"billing"," profile the template uses and typed sample data:",[231,1868,1871],{"className":285,"code":1869,"filename":1870,"language":288,"meta":237,"style":237},"\u002F\u002F Set returns the tutorial as a sample set: the kit, a Config with the\n\u002F\u002F \"billing\" profile the template names, and the invoice template with\n\u002F\u002F typed sample data, rendered for ada@example.com.\nfunc Set() *lttr.SampleSet {\n    k := MustKit()\n    return &lttr.SampleSet{\n        Kit: k,\n        Config: lttr.Config{\n            Kit: k,\n            Profiles: []lttr.Profile{{\n                Name: \"billing\",\n                From: mail.Address{Name: \"Example Billing\", Address: \"billing@example.com\"},\n            }},\n        },\n        Samples: []lttr.Sample{\n            lttr.NewSample(\"invoice.md\", invoiceSource, sampleInvoice(), lttr.Recipient{Address: \"ada@example.com\", Name: \"Ada\"}),\n        },\n    }\n}\n\n\u002F\u002F sampleInvoice is the data the tutorial's invoice is shown with.\nfunc sampleInvoice() Data {\n    return Data{\n        Invoice: Invoice{\n            Number: \"INV-0042\",\n            Lines: []Line{\n                {Name: \"Team plan, September\", Qty: 1, Amount: 4900},\n                {Name: \"Extra seats\", Qty: 3, Amount: 2700},\n            },\n            Total: 7600,\n        },\n        Due:    \"9 October\",\n        PayURL: \"https:\u002F\u002Fexample.com\u002Fbilling\u002FINV-0042\",\n    }\n}\n","tutorial\u002Ftutorial.go#L105-L139",[215,1872,1873,1878,1883,1888,1909,1922,1938,1943,1956,1961,1976,1987,2015,2020,2025,2039,2082,2086,2090,2094,2098,2103,2117,2125,2134,2144,2154,2176,2195,2200,2210,2214,2224,2234,2238],{"__ignoreMap":237},[241,1874,1875],{"class":243,"line":244},[241,1876,1877],{"class":247},"\u002F\u002F Set returns the tutorial as a sample set: the kit, a Config with the\n",[241,1879,1880],{"class":243,"line":251},[241,1881,1882],{"class":247},"\u002F\u002F \"billing\" profile the template names, and the invoice template with\n",[241,1884,1885],{"class":243,"line":257},[241,1886,1887],{"class":247},"\u002F\u002F typed sample data, rendered for ada@example.com.\n",[241,1889,1890,1892,1895,1897,1899,1902,1904,1907],{"class":243,"line":317},[241,1891,332],{"class":300},[241,1893,1894],{"class":347}," Set",[241,1896,351],{"class":264},[241,1898,716],{"class":300},[241,1900,1901],{"class":304},"lttr",[241,1903,445],{"class":264},[241,1905,1906],{"class":304},"SampleSet",[241,1908,357],{"class":264},[241,1910,1911,1914,1916,1919],{"class":243,"line":323},[241,1912,1913],{"class":264},"    k ",[241,1915,366],{"class":300},[241,1917,1918],{"class":347}," MustKit",[241,1920,1921],{"class":264},"()\n",[241,1923,1924,1926,1929,1931,1933,1935],{"class":243,"line":329},[241,1925,420],{"class":300},[241,1927,1928],{"class":300}," &",[241,1930,1901],{"class":304},[241,1932,445],{"class":264},[241,1934,1906],{"class":304},[241,1936,1937],{"class":264},"{\n",[241,1939,1940],{"class":243,"line":360},[241,1941,1942],{"class":264},"        Kit: k,\n",[241,1944,1945,1948,1950,1952,1954],{"class":243,"line":372},[241,1946,1947],{"class":264},"        Config: ",[241,1949,1901],{"class":304},[241,1951,445],{"class":264},[241,1953,1861],{"class":304},[241,1955,1937],{"class":264},[241,1957,1958],{"class":243,"line":390},[241,1959,1960],{"class":264},"            Kit: k,\n",[241,1962,1963,1966,1968,1970,1973],{"class":243,"line":411},[241,1964,1965],{"class":264},"            Profiles: []",[241,1967,1901],{"class":304},[241,1969,445],{"class":264},[241,1971,1972],{"class":304},"Profile",[241,1974,1975],{"class":264},"{{\n",[241,1977,1978,1981,1984],{"class":243,"line":417},[241,1979,1980],{"class":264},"                Name: ",[241,1982,1983],{"class":268},"\"billing\"",[241,1985,1986],{"class":264},",\n",[241,1988,1989,1992,1995,1997,2000,2003,2006,2009,2012],{"class":243,"line":473},[241,1990,1991],{"class":264},"                From: ",[241,1993,1994],{"class":304},"mail",[241,1996,445],{"class":264},[241,1998,1999],{"class":304},"Address",[241,2001,2002],{"class":264},"{Name: ",[241,2004,2005],{"class":268},"\"Example Billing\"",[241,2007,2008],{"class":264},", Address: ",[241,2010,2011],{"class":268},"\"billing@example.com\"",[241,2013,2014],{"class":264},"},\n",[241,2016,2017],{"class":243,"line":479},[241,2018,2019],{"class":264},"            }},\n",[241,2021,2022],{"class":243,"line":484},[241,2023,2024],{"class":264},"        },\n",[241,2026,2027,2030,2032,2034,2037],{"class":243,"line":490},[241,2028,2029],{"class":264},"        Samples: []",[241,2031,1901],{"class":304},[241,2033,445],{"class":264},[241,2035,2036],{"class":304},"Sample",[241,2038,1937],{"class":264},[241,2040,2041,2044,2047,2049,2052,2055,2058,2060,2062,2064,2067,2070,2073,2076,2079],{"class":243,"line":503},[241,2042,2043],{"class":264},"            lttr.",[241,2045,2046],{"class":347},"NewSample",[241,2048,429],{"class":264},[241,2050,2051],{"class":268},"\"invoice.md\"",[241,2053,2054],{"class":264},", invoiceSource, ",[241,2056,2057],{"class":347},"sampleInvoice",[241,2059,1727],{"class":264},[241,2061,1901],{"class":304},[241,2063,445],{"class":264},[241,2065,2066],{"class":304},"Recipient",[241,2068,2069],{"class":264},"{Address: ",[241,2071,2072],{"class":268},"\"ada@example.com\"",[241,2074,2075],{"class":264},", Name: ",[241,2077,2078],{"class":268},"\"Ada\"",[241,2080,2081],{"class":264},"}),\n",[241,2083,2084],{"class":243,"line":512},[241,2085,2024],{"class":264},[241,2087,2088],{"class":243,"line":521},[241,2089,414],{"class":264},[241,2091,2092],{"class":243,"line":532},[241,2093,476],{"class":264},[241,2095,2096],{"class":243,"line":537},[241,2097,314],{"emptyLinePlaceholder":313},[241,2099,2100],{"class":243,"line":542},[241,2101,2102],{"class":247},"\u002F\u002F sampleInvoice is the data the tutorial's invoice is shown with.\n",[241,2104,2105,2107,2110,2112,2115],{"class":243,"line":548},[241,2106,332],{"class":300},[241,2108,2109],{"class":347}," sampleInvoice",[241,2111,351],{"class":264},[241,2113,2114],{"class":304},"Data",[241,2116,357],{"class":264},[241,2118,2119,2121,2123],{"class":243,"line":554},[241,2120,420],{"class":300},[241,2122,619],{"class":304},[241,2124,1937],{"class":264},[241,2126,2127,2130,2132],{"class":243,"line":566},[241,2128,2129],{"class":264},"        Invoice: ",[241,2131,269],{"class":304},[241,2133,1937],{"class":264},[241,2135,2136,2139,2142],{"class":243,"line":574},[241,2137,2138],{"class":264},"            Number: ",[241,2140,2141],{"class":268},"\"INV-0042\"",[241,2143,1986],{"class":264},[241,2145,2146,2149,2152],{"class":243,"line":583},[241,2147,2148],{"class":264},"            Lines: []",[241,2150,2151],{"class":304},"Line",[241,2153,1937],{"class":264},[241,2155,2156,2159,2162,2165,2168,2171,2174],{"class":243,"line":592},[241,2157,2158],{"class":264},"                {Name: ",[241,2160,2161],{"class":268},"\"Team plan, September\"",[241,2163,2164],{"class":264},", Qty: ",[241,2166,2167],{"class":384},"1",[241,2169,2170],{"class":264},", Amount: ",[241,2172,2173],{"class":384},"4900",[241,2175,2014],{"class":264},[241,2177,2178,2180,2183,2185,2188,2190,2193],{"class":243,"line":597},[241,2179,2158],{"class":264},[241,2181,2182],{"class":268},"\"Extra seats\"",[241,2184,2164],{"class":264},[241,2186,2187],{"class":384},"3",[241,2189,2170],{"class":264},[241,2191,2192],{"class":384},"2700",[241,2194,2014],{"class":264},[241,2196,2197],{"class":243,"line":602},[241,2198,2199],{"class":264},"            },\n",[241,2201,2202,2205,2208],{"class":243,"line":608},[241,2203,2204],{"class":264},"            Total: ",[241,2206,2207],{"class":384},"7600",[241,2209,1986],{"class":264},[241,2211,2212],{"class":243,"line":614},[241,2213,2024],{"class":264},[241,2215,2216,2219,2222],{"class":243,"line":626},[241,2217,2218],{"class":264},"        Due:    ",[241,2220,2221],{"class":268},"\"9 October\"",[241,2223,1986],{"class":264},[241,2225,2226,2229,2232],{"class":243,"line":637},[241,2227,2228],{"class":264},"        PayURL: ",[241,2230,2231],{"class":268},"\"https:\u002F\u002Fexample.com\u002Fbilling\u002FINV-0042\"",[241,2233,1986],{"class":264},[241,2235,2236],{"class":243,"line":648},[241,2237,414],{"class":264},[241,2239,2240],{"class":243,"line":659},[241,2241,476],{"class":264},[211,2243,2244,2247],{},[215,2245,2246],{},"lint.Check"," returns every compile, render and lint problem of the set, each with its file position. A render error names the Markdown position and the kit file position:",[231,2249,2252],{"className":285,"code":2250,"filename":2251,"language":288,"meta":237,"style":237},"\u002F\u002F TestCheck runs lint.Check over the tutorial's sample set (Set): the\n\u002F\u002F invoice, with its typed data, compiles, renders and lints clean.\nfunc TestCheck(t *testing.T) {\n    for _, p := range lint.Failures(lint.Check(Set())) {\n        t.Error(p) \u002F\u002F file:line:col: message\n    }\n}\n\n\u002F\u002F TestSamples checks the kit's samples\u002F*.md with their data from\n\u002F\u002F samples.yaml: lint.Check compiles and renders each one and lints the\n\u002F\u002F HTML. `lttr kit check` does this for a kit that loads without Go types;\n\u002F\u002F this kit binds Invoice, so its samples are checked here instead.\nfunc TestSamples(t *testing.T) {\n    set, err := lttr.KitSamples(MustKit(), lttr.Config{\n        Profiles: []lttr.Profile{{Name: \"default\", From: mail.Address{Address: \"hello@example.com\"}}},\n    })\n    if err != nil {\n        t.Fatal(err)\n    }\n    if len(set.Samples) == 0 {\n        t.Fatal(\"the kit has no samples\")\n    }\n    for _, p := range lint.Failures(lint.Check(set)) {\n        t.Error(p)\n    }\n}\n","tutorial\u002Ftutorial_test.go#L17-L42",[215,2253,2254,2259,2264,2288,2321,2334,2338,2342,2346,2351,2356,2361,2366,2387,2415,2449,2454,2466,2475,2479,2495,2508,2512,2533,2542,2546],{"__ignoreMap":237},[241,2255,2256],{"class":243,"line":244},[241,2257,2258],{"class":247},"\u002F\u002F TestCheck runs lint.Check over the tutorial's sample set (Set): the\n",[241,2260,2261],{"class":243,"line":251},[241,2262,2263],{"class":247},"\u002F\u002F invoice, with its typed data, compiles, renders and lints clean.\n",[241,2265,2266,2268,2271,2273,2276,2279,2282,2284,2286],{"class":243,"line":257},[241,2267,332],{"class":300},[241,2269,2270],{"class":347}," TestCheck",[241,2272,429],{"class":264},[241,2274,2275],{"class":338},"t",[241,2277,2278],{"class":300}," *",[241,2280,2281],{"class":304},"testing",[241,2283,445],{"class":264},[241,2285,792],{"class":304},[241,2287,732],{"class":264},[241,2289,2290,2293,2296,2298,2301,2304,2307,2310,2313,2315,2318],{"class":243,"line":317},[241,2291,2292],{"class":300},"    for",[241,2294,2295],{"class":264}," _, p ",[241,2297,366],{"class":300},[241,2299,2300],{"class":300}," range",[241,2302,2303],{"class":264}," lint.",[241,2305,2306],{"class":347},"Failures",[241,2308,2309],{"class":264},"(lint.",[241,2311,2312],{"class":347},"Check",[241,2314,429],{"class":264},[241,2316,2317],{"class":347},"Set",[241,2319,2320],{"class":264},"())) {\n",[241,2322,2323,2326,2328,2331],{"class":243,"line":323},[241,2324,2325],{"class":264},"        t.",[241,2327,1181],{"class":347},[241,2329,2330],{"class":264},"(p) ",[241,2332,2333],{"class":247},"\u002F\u002F file:line:col: message\n",[241,2335,2336],{"class":243,"line":329},[241,2337,414],{"class":264},[241,2339,2340],{"class":243,"line":360},[241,2341,476],{"class":264},[241,2343,2344],{"class":243,"line":372},[241,2345,314],{"emptyLinePlaceholder":313},[241,2347,2348],{"class":243,"line":390},[241,2349,2350],{"class":247},"\u002F\u002F TestSamples checks the kit's samples\u002F*.md with their data from\n",[241,2352,2353],{"class":243,"line":411},[241,2354,2355],{"class":247},"\u002F\u002F samples.yaml: lint.Check compiles and renders each one and lints the\n",[241,2357,2358],{"class":243,"line":417},[241,2359,2360],{"class":247},"\u002F\u002F HTML. `lttr kit check` does this for a kit that loads without Go types;\n",[241,2362,2363],{"class":243,"line":473},[241,2364,2365],{"class":247},"\u002F\u002F this kit binds Invoice, so its samples are checked here instead.\n",[241,2367,2368,2370,2373,2375,2377,2379,2381,2383,2385],{"class":243,"line":479},[241,2369,332],{"class":300},[241,2371,2372],{"class":347}," TestSamples",[241,2374,429],{"class":264},[241,2376,2275],{"class":338},[241,2378,2278],{"class":300},[241,2380,2281],{"class":304},[241,2382,445],{"class":264},[241,2384,792],{"class":304},[241,2386,732],{"class":264},[241,2388,2389,2392,2394,2397,2400,2402,2405,2407,2409,2411,2413],{"class":243,"line":484},[241,2390,2391],{"class":264},"    set, err ",[241,2393,366],{"class":300},[241,2395,2396],{"class":264}," lttr.",[241,2398,2399],{"class":347},"KitSamples",[241,2401,429],{"class":264},[241,2403,2404],{"class":347},"MustKit",[241,2406,1727],{"class":264},[241,2408,1901],{"class":304},[241,2410,445],{"class":264},[241,2412,1861],{"class":304},[241,2414,1937],{"class":264},[241,2416,2417,2420,2422,2424,2426,2429,2432,2435,2437,2439,2441,2443,2446],{"class":243,"line":490},[241,2418,2419],{"class":264},"        Profiles: []",[241,2421,1901],{"class":304},[241,2423,445],{"class":264},[241,2425,1972],{"class":304},[241,2427,2428],{"class":264},"{{Name: ",[241,2430,2431],{"class":268},"\"default\"",[241,2433,2434],{"class":264},", From: ",[241,2436,1994],{"class":304},[241,2438,445],{"class":264},[241,2440,1999],{"class":304},[241,2442,2069],{"class":264},[241,2444,2445],{"class":268},"\"hello@example.com\"",[241,2447,2448],{"class":264},"}}},\n",[241,2450,2451],{"class":243,"line":503},[241,2452,2453],{"class":264},"    })\n",[241,2455,2456,2458,2460,2462,2464],{"class":243,"line":512},[241,2457,375],{"class":300},[241,2459,1662],{"class":264},[241,2461,1665],{"class":300},[241,2463,1668],{"class":384},[241,2465,357],{"class":264},[241,2467,2468,2470,2472],{"class":243,"line":521},[241,2469,2325],{"class":264},[241,2471,1679],{"class":347},[241,2473,2474],{"class":264},"(err)\n",[241,2476,2477],{"class":243,"line":532},[241,2478,414],{"class":264},[241,2480,2481,2483,2486,2489,2491,2493],{"class":243,"line":537},[241,2482,375],{"class":300},[241,2484,2485],{"class":347}," len",[241,2487,2488],{"class":264},"(set.Samples) ",[241,2490,1523],{"class":300},[241,2492,385],{"class":384},[241,2494,357],{"class":264},[241,2496,2497,2499,2501,2503,2506],{"class":243,"line":542},[241,2498,2325],{"class":264},[241,2500,1679],{"class":347},[241,2502,429],{"class":264},[241,2504,2505],{"class":268},"\"the kit has no samples\"",[241,2507,470],{"class":264},[241,2509,2510],{"class":243,"line":548},[241,2511,414],{"class":264},[241,2513,2514,2516,2518,2520,2522,2524,2526,2528,2530],{"class":243,"line":554},[241,2515,2292],{"class":300},[241,2517,2295],{"class":264},[241,2519,366],{"class":300},[241,2521,2300],{"class":300},[241,2523,2303],{"class":264},[241,2525,2306],{"class":347},[241,2527,2309],{"class":264},[241,2529,2312],{"class":347},[241,2531,2532],{"class":264},"(set)) {\n",[241,2534,2535,2537,2539],{"class":243,"line":566},[241,2536,2325],{"class":264},[241,2538,1181],{"class":347},[241,2540,2541],{"class":264},"(p)\n",[241,2543,2544],{"class":243,"line":574},[241,2545,414],{"class":264},[241,2547,2548],{"class":243,"line":583},[241,2549,476],{"class":264},[211,2551,2552,2555,2556,2559,2560,2562,2563,2566,2567,1840,2570,2573,2574,2576,2577,2579,2580,1840,2582,445],{},[215,2553,2554],{},"TestSamples"," checks the kit's own ",[215,2557,2558],{},"samples\u002F*.md"," too, which ",[215,2561,1833],{}," would do for an untyped kit. ",[215,2564,2565],{},"lttr.KitSamples"," builds that set from ",[215,2568,2569],{},"samples\u002F",[215,2571,2572],{},"samples\u002Fsamples.yaml","; the data comes from YAML, so it is untyped (",[215,2575,1219],{},"). ",[215,2578,1836],{}," is a public package, so this test works unchanged in your own module. See ",[1229,2581,159],{"href":160},[1229,2583,102],{"href":103},[220,2585,2587],{"id":2586},"next-steps","Next steps",[774,2589,2590,2595],{},[777,2591,2592,2594],{},[1229,2593,92],{"href":93},": what the checker does with your types.",[777,2596,2597,2599],{},[1229,2598,170],{"href":171},": the tutorial kit, step by step.",[2601,2602,2603],"style",{},"html pre.shiki code .sBq4M, html code.shiki .sBq4M{--shiki-light:#66707B;--shiki-default:#66707B;--shiki-dark:#6A737D}html pre.shiki code .s71pN, html code.shiki .s71pN{--shiki-light:#024C1A;--shiki-default:#024C1A;--shiki-dark:#85E89D}html pre.shiki code .sihDN, html code.shiki .sihDN{--shiki-light:#0E1116;--shiki-default:#0E1116;--shiki-dark:#E1E4E8}html pre.shiki code .sRBGO, html code.shiki .sRBGO{--shiki-light:#032563;--shiki-default:#032563;--shiki-dark:#9ECBFF}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .s1Q0q, html code.shiki .s1Q0q{--shiki-light:#A0111F;--shiki-default:#A0111F;--shiki-dark:#F97583}html pre.shiki code .sSlKG, html code.shiki .sSlKG{--shiki-light:#702C00;--shiki-default:#702C00;--shiki-dark:#B392F0}html pre.shiki code .s-BBy, html code.shiki .s-BBy{--shiki-light:#702C00;--shiki-default:#702C00;--shiki-dark:#FFAB70}html pre.shiki code .sPmw6, html code.shiki .sPmw6{--shiki-light:#622CBC;--shiki-default:#622CBC;--shiki-dark:#B392F0}html pre.shiki code .sTl1q, html code.shiki .sTl1q{--shiki-light:#023B95;--shiki-default:#023B95;--shiki-dark:#79B8FF}html pre.shiki code .sFaxo, html code.shiki .sFaxo{--shiki-light:#A0111F;--shiki-default:#A0111F;--shiki-dark:#79B8FF}html pre.shiki code .su3Io, html code.shiki .su3Io{--shiki-light:#023B95;--shiki-light-font-weight:bold;--shiki-default:#023B95;--shiki-default-font-weight:bold;--shiki-dark:#79B8FF;--shiki-dark-font-weight:bold}",{"title":237,"searchDepth":251,"depth":251,"links":2605},[2606,2607,2608,2609,2610,2611],{"id":222,"depth":251,"text":223},{"id":840,"depth":251,"text":841},{"id":1233,"depth":251,"text":1234},{"id":1804,"depth":251,"text":1805},{"id":1847,"depth":251,"text":1848},{"id":2586,"depth":251,"text":2587},"Register the Go types components bind with kit.Types, add template functions with kit.Funcs, and check such a kit from Go, since the CLI cannot load it.","md",null,{},{"icon":100},{"title":97,"description":2612},"wSsEK1XP8uAShF94egAn3O63YMH2rIwMivYV6KkkFLk",[2620,2622],{"title":92,"path":93,"stem":94,"description":2621,"icon":95,"children":-1},"What kit.Load checks in every kit template before anything renders, the errors it reports, and the mistakes that only surface at render time.",{"title":102,"path":103,"stem":104,"description":2623,"icon":105,"children":-1},"The rules a kit's HTML must follow to survive mail clients, the lint that enforces them, the Outlook helpers, and how Plain handles dark mode.",1790467462568]