[{"data":1,"prerenderedAt":5040},["ShallowReactive",2],{"navigation_docs":3,"-guides-build-your-own-kit":205,"-guides-build-your-own-kit-surround":5035},[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":170,"body":207,"description":5028,"extension":5029,"links":5030,"meta":5031,"navigation":5032,"path":171,"seo":5033,"stem":172,"__hash__":5034},"docs\u002F6.guides\u002F1.build-your-own-kit.md",{"type":208,"value":209,"toc":5015},"minimark",[210,228,243,253,258,264,298,305,353,356,372,378,395,399,413,416,486,535,538,562,601,604,670,674,677,694,700,715,724,728,735,738,870,927,933,956,974,1514,1570,1580,1587,1600,1603,1616,1644,1650,1664,1670,1690,1705,1809,1821,2173,2199,2205,2680,2718,2722,2732,2861,2882,2885,3000,3013,3019,3026,3032,3036,3051,3420,3440,3450,3585,3593,3601,3695,3718,3807,3810,3816,3819,3826,3829,3853,3859,3903,3907,3929,3968,3979,3983,4002,4016,4022,4029,4469,4486,4490,4493,4922,4928,4943,4947,5012],[211,212,213,214,218,219,223,224,227],"p",{},"This guide builds a small kit called ",[215,216,217],"code",{},"tutorial",", step by step. It starts as a copy of ",[220,221,222],"a",{"href":75},"Plain",", gets its own accent colour and font, and gains an ",[215,225,226],{},"invoice"," component that binds a Go type. Then it adds a template that uses the component, and tests that load the kit, render the template and compare it with golden files.",[211,229,230,231,234,235,238,239,242],{},"The finished kit is in the lttr repository as ",[215,232,233],{},"examples\u002Ftutorial",". Every kit and Go snippet on this page is labelled with its path in that directory (",[215,236,237],{},"tutorial\u002Fkit\u002Fkit.yaml",", ",[215,240,241],{},"tutorial\u002Ftutorial.go","), and the docs build checks that each one is byte for byte the file it names. What you copy here is what the tests run.",[244,245,251],"pre",{"className":246,"code":248,"filename":233,"language":249,"meta":250},[247],"language-text","kit\u002F                          the kit: Plain's files, edited, plus components\u002Finvoice\u002F\ntemplates\u002Finvoice.md          a template that uses the invoice component\ntutorial.go                   the Go types, the embedded kit, the compiled template and its sample set\ntutorial_test.go              check, golden, typo and render tests\ntestdata\u002Finvoice.html, .txt   the golden files\n","text","",[215,252,248],{"__ignoreMap":250},[254,255,257],"h2",{"id":256},"start-from-plain","Start from Plain",[211,259,260,263],{},[215,261,262],{},"lttr kit init"," copies Plain into a new directory and renames it. Flags go before the directory:",[244,265,270],{"className":266,"code":267,"filename":268,"language":269,"meta":250,"style":250},"language-bash shiki shiki-themes github-light-high-contrast github-light-high-contrast github-dark","lttr kit init -name tutorial .\u002Fkit\n","Terminal","bash",[215,271,272],{"__ignoreMap":250},[273,274,277,281,285,288,292,295],"span",{"class":275,"line":276},"line",1,[273,278,280],{"class":279},"sSlKG","lttr",[273,282,284],{"class":283},"sRBGO"," kit",[273,286,287],{"class":283}," init",[273,289,291],{"class":290},"sTl1q"," -name",[273,293,294],{"class":283}," tutorial",[273,296,297],{"class":283}," .\u002Fkit\n",[244,299,303],{"className":300,"code":301,"filename":302,"language":249,"meta":250},[247],"wrote 29 files to .\u002Fkit; check it with: lttr kit check .\u002Fkit\n","Output",[215,304,301],{"__ignoreMap":250},[211,306,307,308,311,312,315,316,318,319,238,322,325,326,329,330,238,333,238,336,238,339,238,342,325,345,348,349,352],{},"Without ",[215,309,310],{},"-name",", the kit is named after the directory. The copy is Plain exactly, apart from the ",[215,313,314],{},"name:"," line and the header comment of ",[215,317,79],{},": the layouts, ",[215,320,321],{},"styles.css",[215,323,324],{},"blocks.html"," and ",[215,327,328],{},"blocks.txt",", the six components (",[215,331,332],{},"section",[215,334,335],{},"button",[215,337,338],{},"image",[215,340,341],{},"columns",[215,343,344],{},"column",[215,346,347],{},"footer","), two images under ",[215,350,351],{},"assets\u002F"," and two samples with their data.",[211,354,355],{},"Check it straight away, so you know the starting point is clean:",[244,357,359],{"className":266,"code":358,"filename":268,"language":269,"meta":250,"style":250},"lttr kit check .\u002Fkit\n",[215,360,361],{"__ignoreMap":250},[273,362,363,365,367,370],{"class":275,"line":276},[273,364,280],{"class":279},[273,366,284],{"class":283},[273,368,369],{"class":283}," check",[273,371,297],{"class":283},[244,373,376],{"className":374,"code":375,"filename":302,"language":249,"meta":250},[247],"kit tutorial: 2 samples rendered, no problems\n",[215,377,375],{"__ignoreMap":250},[211,379,380,383,384,387,388,391,392,394],{},[215,381,382],{},"kit check"," loads the kit, which type-checks every template, then renders each ",[215,385,386],{},"samples\u002F*.md"," with its data from ",[215,389,390],{},"samples\u002Fsamples.yaml"," and lints the HTML. It exits 1 on any problem. See ",[220,393,74],{"href":75},".",[254,396,398],{"id":397},"change-the-tokens","Change the tokens",[211,400,401,402,405,406,409,410,412],{},"Tokens are the kit's design values. Plain's templates read them by name, with ",[215,403,404],{},"{{token \"size.side\"}}"," or ",[215,407,408],{},"{{style \"color\" \"color.accent\"}}",", and never hard-code a colour, a font or a size, so most restyling happens in ",[215,411,79],{}," alone. The tutorial changes two things.",[211,414,415],{},"The accent colour, used for links, and the button colour both go from Plain's blue to green:",[244,417,422],{"className":418,"code":419,"filename":420,"language":421,"meta":250,"style":250},"language-yaml shiki shiki-themes github-light-high-contrast github-light-high-contrast github-dark","  color.accent:  { light: \"#1A7F37\", dark: \"#3FB950\" }  # was Plain's blue\n  color.button:  { light: \"#1A7F37\", dark: \"#1A7F37\" }  # was Plain's blue\n","tutorial\u002Fkit\u002Fkit.yaml#L19-L20","yaml",[215,423,424,460],{"__ignoreMap":250},[273,425,426,430,434,437,440,443,445,448,450,453,456],{"class":275,"line":276},[273,427,429],{"class":428},"s71pN","  color.accent",[273,431,433],{"class":432},"sihDN",":  { ",[273,435,436],{"class":428},"light",[273,438,439],{"class":432},": ",[273,441,442],{"class":283},"\"#1A7F37\"",[273,444,238],{"class":432},[273,446,447],{"class":428},"dark",[273,449,439],{"class":432},[273,451,452],{"class":283},"\"#3FB950\"",[273,454,455],{"class":432}," }  ",[273,457,459],{"class":458},"sBq4M","# was Plain's blue\n",[273,461,463,466,468,470,472,474,476,478,480,482,484],{"class":275,"line":462},2,[273,464,465],{"class":428},"  color.button",[273,467,433],{"class":432},[273,469,436],{"class":428},[273,471,439],{"class":432},[273,473,442],{"class":283},[273,475,238],{"class":432},[273,477,447],{"class":428},[273,479,439],{"class":432},[273,481,442],{"class":283},[273,483,455],{"class":432},[273,485,459],{"class":458},[211,487,488,489,492,493,495,496,238,499,238,502,405,505,508,509,512,513,515,516,518,519,522,523,526,527,530,531,534],{},"A colour token written ",[215,490,491],{},"{ light: …, dark: … }"," has a value for each scheme. The light value is written into the HTML's inline styles, and the dark value goes into the dark-mode rules of ",[215,494,321],{},". Any CSS colour works: ",[215,497,498],{},"#1A7F37",[215,500,501],{},"rgb(26 127 55)",[215,503,504],{},"rgba(26,127,55,0.9)",[215,506,507],{},"hsl(135 66% 30%)",". Plain writes colours through the core ",[215,510,511],{},"style"," function (",[215,514,408],{},"), which html\u002Ftemplate accepts whatever the colour's syntax. Keep that pattern when you edit a template: a colour written straight into a ",[215,517,511],{}," attribute, as ",[215,520,521],{},"color:{{token \"color.accent\"}};",", is rejected when it holds ",[215,524,525],{},"("," and renders as ",[215,528,529],{},"ZgotmplZ",", which ",[215,532,533],{},"lttr kit check"," reports.",[211,536,537],{},"The font stack changes from the system stack to Helvetica Neue:",[244,539,542],{"className":418,"code":540,"filename":541,"language":421,"meta":250,"style":250},"  # Quote family names with spaces in single quotes: \"'Helvetica Neue',Arial,sans-serif\".\n  font.sans: \"'Helvetica Neue',Arial,sans-serif\"  # was the system stack\n","tutorial\u002Fkit\u002Fkit.yaml#L24-L25",[215,543,544,549],{"__ignoreMap":250},[273,545,546],{"class":275,"line":276},[273,547,548],{"class":458},"  # Quote family names with spaces in single quotes: \"'Helvetica Neue',Arial,sans-serif\".\n",[273,550,551,554,556,559],{"class":275,"line":462},[273,552,553],{"class":428},"  font.sans",[273,555,439],{"class":432},[273,557,558],{"class":283},"\"'Helvetica Neue',Arial,sans-serif\"",[273,560,561],{"class":458},"  # was the system stack\n",[211,563,564,565,512,567,570,571,573,574,238,577,238,580,238,583,238,586,238,589,238,592,595,596,598,599,394],{},"Quote a family name that has spaces in single quotes, inside a double-quoted YAML string. Plain writes font stacks through the core ",[215,566,511],{},[215,568,569],{},"{{style \"font-family\" \"font.sans\"}}","), which accepts quoted names, so the stack reaches every ",[215,572,511],{}," attribute intact. Token values may not contain ",[215,575,576],{},"\u003C",[215,578,579],{},">",[215,581,582],{},"{",[215,584,585],{},"}",[215,587,588],{},";",[215,590,591],{},"\"",[215,593,594],{},"\\"," or control characters, because ",[215,597,321],{}," writes them into CSS unescaped. See ",[220,600,79],{"href":80},[211,602,603],{},"Here is the whole change against Plain so far:",[244,605,609],{"className":606,"code":607,"filename":79,"language":608,"meta":250,"style":250},"language-diff shiki shiki-themes github-light-high-contrast github-light-high-contrast github-dark","-  color.accent:  { light: \"#2F6FEB\", dark: \"#4493F8\" }\n-  color.button:  { light: \"#2F6FEB\", dark: \"#2F6FEB\" }\n+  color.accent:  { light: \"#1A7F37\", dark: \"#3FB950\" }  # was Plain's blue\n+  color.button:  { light: \"#1A7F37\", dark: \"#1A7F37\" }  # was Plain's blue\n   color.on_button: { light: \"#FFFFFF\", dark: \"#FFFFFF\" }\n   color.border:  { light: \"#D1D9E0\", dark: \"#3D444D\" }\n   color.subtle:  { light: \"#EFF2F5\", dark: \"#262C36\" }\n   # Quote family names with spaces in single quotes: \"'Helvetica Neue',Arial,sans-serif\".\n-  font.sans: \"-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif\"\n+  font.sans: \"'Helvetica Neue',Arial,sans-serif\"  # was the system stack\n","diff",[215,610,611,617,622,628,634,640,646,652,658,664],{"__ignoreMap":250},[273,612,613],{"class":275,"line":276},[273,614,616],{"class":615},"s1qwZ","-  color.accent:  { light: \"#2F6FEB\", dark: \"#4493F8\" }\n",[273,618,619],{"class":275,"line":462},[273,620,621],{"class":615},"-  color.button:  { light: \"#2F6FEB\", dark: \"#2F6FEB\" }\n",[273,623,625],{"class":275,"line":624},3,[273,626,627],{"class":428},"+  color.accent:  { light: \"#1A7F37\", dark: \"#3FB950\" }  # was Plain's blue\n",[273,629,631],{"class":275,"line":630},4,[273,632,633],{"class":428},"+  color.button:  { light: \"#1A7F37\", dark: \"#1A7F37\" }  # was Plain's blue\n",[273,635,637],{"class":275,"line":636},5,[273,638,639],{"class":432},"   color.on_button: { light: \"#FFFFFF\", dark: \"#FFFFFF\" }\n",[273,641,643],{"class":275,"line":642},6,[273,644,645],{"class":432},"   color.border:  { light: \"#D1D9E0\", dark: \"#3D444D\" }\n",[273,647,649],{"class":275,"line":648},7,[273,650,651],{"class":432},"   color.subtle:  { light: \"#EFF2F5\", dark: \"#262C36\" }\n",[273,653,655],{"class":275,"line":654},8,[273,656,657],{"class":432},"   # Quote family names with spaces in single quotes: \"'Helvetica Neue',Arial,sans-serif\".\n",[273,659,661],{"class":275,"line":660},9,[273,662,663],{"class":615},"-  font.sans: \"-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif\"\n",[273,665,667],{"class":275,"line":666},10,[273,668,669],{"class":428},"+  font.sans: \"'Helvetica Neue',Arial,sans-serif\"  # was the system stack\n",[254,671,673],{"id":672},"preview-it-while-it-is-untyped","Preview it while it is untyped",[211,675,676],{},"So far the kit binds no Go types, so the CLI can load it from disk. Run the studio and leave it open while you edit:",[244,678,680],{"className":266,"code":679,"filename":268,"language":269,"meta":250,"style":250},"lttr serve -kit .\u002Fkit\n",[215,681,682],{"__ignoreMap":250},[273,683,684,686,689,692],{"class":275,"line":276},[273,685,280],{"class":279},[273,687,688],{"class":283}," serve",[273,690,691],{"class":290}," -kit",[273,693,297],{"class":283},[244,695,698],{"className":696,"code":697,"filename":302,"language":249,"meta":250},[247],"lttr studio: serving kit (2 samples) on http:\u002F\u002Flocalhost:7070\n",[215,699,697],{"__ignoreMap":250},[211,701,702,703,705,706,708,709,712,713,394],{},"The studio watches the whole kit (",[215,704,79],{},", the templates, ",[215,707,321],{}," and the samples), so a saved token shows in the open page within half a second, with no reload. The grid shows every sample, and each opens at 600 and 375 px, in light and dark, with its text part and its problems as ",[215,710,711],{},"file:line:col"," lines. See ",[220,714,144],{"href":145},[211,716,717,718,238,721,723],{},"This is the time to work on anything the samples show: tokens, ",[215,719,720],{},"layout.html",[215,722,324],{}," and the existing components. The next step binds a Go type. After that the CLI can't load the kit any more, and you preview and check it from Go instead.",[254,725,727],{"id":726},"add-the-invoice-component","Add the invoice component",[211,729,730,731,734],{},"A component is a directory under ",[215,732,733],{},"components\u002F"," with a schema, an HTML template and, optionally, a text template. The invoice component shows an invoice's lines and total. It takes the invoice as a Go value, through a binding, rather than as text attributes.",[211,736,737],{},"The schema declares one attribute, one binding, no Markdown content and the component's spacing:",[244,739,742],{"className":418,"code":740,"filename":741,"language":421,"meta":250,"style":250},"# 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,743,744,749,754,764,772,800,807,832,842,849,859],{"__ignoreMap":250},[273,745,746],{"class":275,"line":276},[273,747,748],{"class":458},"# An invoice: the bound Invoice's lines, then its total. A template\n",[273,750,751],{"class":275,"line":462},[273,752,753],{"class":458},"# passes the invoice with a binding: ::invoice{:invoice=\"invoice\"}.\n",[273,755,756,759,761],{"class":275,"line":624},[273,757,758],{"class":428},"name",[273,760,439],{"class":432},[273,762,763],{"class":283},"invoice\n",[273,765,766,769],{"class":275,"line":630},[273,767,768],{"class":428},"attrs",[273,770,771],{"class":432},":\n",[273,773,774,777,780,783,785,787,789,792,794,797],{"class":275,"line":636},[273,775,776],{"class":428},"  title",[273,778,779],{"class":432},": { ",[273,781,782],{"class":428},"type",[273,784,439],{"class":432},[273,786,249],{"class":283},[273,788,238],{"class":432},[273,790,791],{"class":428},"default",[273,793,439],{"class":432},[273,795,796],{"class":283},"Invoice",[273,798,799],{"class":432}," }\n",[273,801,802,805],{"class":275,"line":642},[273,803,804],{"class":428},"bindings",[273,806,771],{"class":432},[273,808,809,812,814,816,818,820,822,825,827,830],{"class":275,"line":648},[273,810,811],{"class":428},"  invoice",[273,813,779],{"class":432},[273,815,782],{"class":428},[273,817,439],{"class":432},[273,819,796],{"class":283},[273,821,238],{"class":432},[273,823,824],{"class":428},"required",[273,826,439],{"class":432},[273,828,829],{"class":290},"true",[273,831,799],{"class":432},[273,833,834,837,839],{"class":275,"line":654},[273,835,836],{"class":428},"content",[273,838,439],{"class":432},[273,840,841],{"class":283},"none\n",[273,843,844,847],{"class":275,"line":660},[273,845,846],{"class":428},"spacing",[273,848,771],{"class":432},[273,850,851,854,856],{"class":275,"line":666},[273,852,853],{"class":428},"  top",[273,855,439],{"class":432},[273,857,858],{"class":283},"size.block\n",[273,860,862,865,867],{"class":275,"line":861},11,[273,863,864],{"class":428},"  bottom",[273,866,439],{"class":432},[273,868,869],{"class":283},"size.gap\n",[871,872,873,891,916,922],"ul",{},[874,875,876,879,880,882,883,886,887,890],"li",{},[215,877,878],{},"title"," is a ",[215,881,249],{}," attribute with a default, so ",[215,884,885],{},"::invoice"," alone renders \"Invoice\" and ",[215,888,889],{},"::invoice{title=\"Receipt\"}"," changes it.",[874,892,893,895,896,238,898,900,901,904,905,908,909,911,912,915],{},[215,894,226],{}," is a binding. Its ",[215,897,782],{},[215,899,796],{},", is a name the kit's ",[215,902,903],{},"types"," list declares and Go registers (the next step). ",[215,906,907],{},"required: true"," makes ",[215,910,885],{}," without ",[215,913,914],{},":invoice=\"…\""," a compile error.",[874,917,918,921],{},[215,919,920],{},"content: none"," means the component takes no Markdown between its fences.",[874,923,924,926],{},[215,925,846],{}," sets the padding above and below. Values may be numbers of pixels or size tokens, as here.",[211,928,929,930,932],{},"See ",[220,931,84],{"href":85}," for every key.",[211,934,935,936,939,940,943,944,947,948,950,951,955],{},"If ",[215,937,938],{},"lttr serve"," is still watching ",[215,941,942],{},".\u002Fkit"," from the earlier step, saving this file shows an interim kit problem in the studio, above the last good renders: ",[215,945,946],{},"bindings.invoice: type \"Invoice\" is not in kit.yaml types",". That is expected — ",[215,949,796],{}," isn't registered until ",[220,952,954],{"href":953},"#register-the-go-type","Register the Go type",", further down.",[211,957,958,959,439,962,965,966,969,970,973],{},"The HTML template renders one table row of the kit's message column. It executes with a ",[215,960,961],{},"kit.View",[215,963,964],{},".Attrs"," holds the attributes, ",[215,967,968],{},".Bind"," the bound values and ",[215,971,972],{},".Section"," the resolved spacing:",[244,975,980],{"className":976,"code":977,"filename":978,"language":979,"meta":250,"style":250},"language-html shiki shiki-themes github-light-high-contrast github-light-high-contrast github-dark","{{- \u002F* The title and number, one row per line (name, quantity, amount),\nthen the total. .Bind.invoice is an Invoice, so every field below is\nchecked against the Go type when the kit loads. *\u002F -}}\n\u003Ctr>\u003Ctd class=\"pl-px\" align=\"left\" style=\"padding:{{px .Section.Top}} {{token \"size.side\"}}px {{px .Section.Bottom}};\">\n\u003Cp class=\"pl-text\" style=\"margin:0 0 8px;{{style \"font-family\" \"font.sans\"}}font-size:{{token \"size.h2\"}}px;line-height:{{token \"size.h2_line\"}}px;font-weight:600;{{style \"color\" \"color.text\"}}\">{{.Attrs.title}} {{.Bind.invoice.Number}}\u003C\u002Fp>\n\u003Ctable role=\"presentation\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border-collapse:collapse;\">\n{{- range .Bind.invoice.Lines}}\n\u003Ctr>\u003Ctd class=\"pl-text pl-rule\" align=\"left\" style=\"padding:10px 0;{{style \"border-bottom\" (printf \"1px solid %s\" (token \"color.border\"))}}{{style \"font-family\" \"font.sans\"}}font-size:{{token \"size.text\"}}px;line-height:{{token \"size.line\"}}px;{{style \"color\" \"color.text\"}}\">{{.Name}}\u003C\u002Ftd>\n\u003Ctd class=\"pl-muted pl-rule\" align=\"right\" style=\"padding:10px 0 10px 12px;{{style \"border-bottom\" (printf \"1px solid %s\" (token \"color.border\"))}}{{style \"font-family\" \"font.sans\"}}font-size:{{token \"size.text\"}}px;line-height:{{token \"size.line\"}}px;{{style \"color\" \"color.muted\"}}white-space:nowrap;\">&times;&nbsp;{{.Qty}}\u003C\u002Ftd>\n\u003Ctd class=\"pl-text pl-rule\" align=\"right\" style=\"padding:10px 0 10px 12px;{{style \"border-bottom\" (printf \"1px solid %s\" (token \"color.border\"))}}{{style \"font-family\" \"font.sans\"}}font-size:{{token \"size.text\"}}px;line-height:{{token \"size.line\"}}px;{{style \"color\" \"color.text\"}}white-space:nowrap;\">{{.Amount}}\u003C\u002Ftd>\u003C\u002Ftr>\n{{- end}}\n\u003Ctr>\u003Ctd class=\"pl-text\" colspan=\"2\" align=\"left\" style=\"padding:10px 0 0;{{style \"font-family\" \"font.sans\"}}font-size:{{token \"size.text\"}}px;line-height:{{token \"size.line\"}}px;font-weight:600;{{style \"color\" \"color.text\"}}\">Total\u003C\u002Ftd>\n\u003Ctd class=\"pl-text\" align=\"right\" style=\"padding:10px 0 0 12px;{{style \"font-family\" \"font.sans\"}}font-size:{{token \"size.text\"}}px;line-height:{{token \"size.line\"}}px;font-weight:600;{{style \"color\" \"color.text\"}}white-space:nowrap;\">{{.Bind.invoice.Total}}\u003C\u002Ftd>\u003C\u002Ftr>\n\u003C\u002Ftable>\n\u003C\u002Ftd>\u003C\u002Ftr>\n","tutorial\u002Fkit\u002Fcomponents\u002Finvoice\u002Fhtml.tmpl","html",[215,981,982,987,992,997,1054,1101,1155,1160,1237,1308,1375,1380,1440,1491,1501],{"__ignoreMap":250},[273,983,984],{"class":275,"line":276},[273,985,986],{"class":432},"{{- \u002F* The title and number, one row per line (name, quantity, amount),\n",[273,988,989],{"class":275,"line":462},[273,990,991],{"class":432},"then the total. .Bind.invoice is an Invoice, so every field below is\n",[273,993,994],{"class":275,"line":624},[273,995,996],{"class":432},"checked against the Go type when the kit loads. *\u002F -}}\n",[273,998,999,1001,1004,1007,1010,1014,1017,1020,1024,1026,1029,1032,1034,1037,1040,1043,1046,1049,1051],{"class":275,"line":630},[273,1000,576],{"class":432},[273,1002,1003],{"class":428},"tr",[273,1005,1006],{"class":432},">\u003C",[273,1008,1009],{"class":428},"td",[273,1011,1013],{"class":1012},"sQJpg"," class",[273,1015,1016],{"class":432},"=",[273,1018,1019],{"class":283},"\"pl-px\"",[273,1021,1023],{"class":1022},"s-oVe"," align",[273,1025,1016],{"class":432},[273,1027,1028],{"class":283},"\"left\"",[273,1030,1031],{"class":1012}," style",[273,1033,1016],{"class":432},[273,1035,1036],{"class":283},"\"padding:{{px .Section.Top}} {{token \"",[273,1038,1039],{"class":1012},"size.side",[273,1041,1042],{"class":1022},"\"}}px",[273,1044,1045],{"class":1012}," {{px",[273,1047,1048],{"class":1012}," .Section.Bottom}};",[273,1050,591],{"class":1022},[273,1052,1053],{"class":432},">\n",[273,1055,1056,1058,1060,1062,1064,1067,1069,1071,1074,1077,1079,1082,1085,1088,1091,1094,1097,1099],{"class":275,"line":636},[273,1057,576],{"class":432},[273,1059,211],{"class":428},[273,1061,1013],{"class":1012},[273,1063,1016],{"class":432},[273,1065,1066],{"class":283},"\"pl-text\"",[273,1068,1031],{"class":1012},[273,1070,1016],{"class":432},[273,1072,1073],{"class":283},"\"margin:0 0 8px;{{style \"",[273,1075,1076],{"class":1012},"font-family",[273,1078,591],{"class":1022},[273,1080,1081],{"class":1022}," \"font.sans\"}}font-size:{{token",[273,1083,1084],{"class":1022}," \"size.h2\"}}px;line-height:{{token",[273,1086,1087],{"class":1022}," \"size.h2_line\"}}px;font-weight:600;{{style",[273,1089,1090],{"class":1022}," \"color\"",[273,1092,1093],{"class":1022}," \"color.text\"}}\"",[273,1095,1096],{"class":432},">{{.Attrs.title}} {{.Bind.invoice.Number}}\u003C\u002F",[273,1098,211],{"class":428},[273,1100,1053],{"class":432},[273,1102,1103,1105,1108,1111,1113,1116,1119,1121,1124,1127,1129,1132,1135,1137,1139,1142,1144,1146,1148,1150,1153],{"class":275,"line":642},[273,1104,576],{"class":432},[273,1106,1107],{"class":428},"table",[273,1109,1110],{"class":1012}," role",[273,1112,1016],{"class":432},[273,1114,1115],{"class":283},"\"presentation\"",[273,1117,1118],{"class":1012}," width",[273,1120,1016],{"class":432},[273,1122,1123],{"class":283},"\"100%\"",[273,1125,1126],{"class":1012}," cellpadding",[273,1128,1016],{"class":432},[273,1130,1131],{"class":283},"\"0\"",[273,1133,1134],{"class":1012}," cellspacing",[273,1136,1016],{"class":432},[273,1138,1131],{"class":283},[273,1140,1141],{"class":1022}," border",[273,1143,1016],{"class":432},[273,1145,1131],{"class":283},[273,1147,1031],{"class":1012},[273,1149,1016],{"class":432},[273,1151,1152],{"class":283},"\"border-collapse:collapse;\"",[273,1154,1053],{"class":432},[273,1156,1157],{"class":275,"line":648},[273,1158,1159],{"class":432},"{{- range .Bind.invoice.Lines}}\n",[273,1161,1162,1164,1166,1168,1170,1172,1174,1177,1179,1181,1183,1185,1187,1190,1193,1195,1198,1201,1204,1207,1209,1212,1215,1218,1220,1223,1226,1228,1230,1233,1235],{"class":275,"line":654},[273,1163,576],{"class":432},[273,1165,1003],{"class":428},[273,1167,1006],{"class":432},[273,1169,1009],{"class":428},[273,1171,1013],{"class":1012},[273,1173,1016],{"class":432},[273,1175,1176],{"class":283},"\"pl-text pl-rule\"",[273,1178,1023],{"class":1022},[273,1180,1016],{"class":432},[273,1182,1028],{"class":283},[273,1184,1031],{"class":1012},[273,1186,1016],{"class":432},[273,1188,1189],{"class":283},"\"padding:10px 0;{{style \"",[273,1191,1192],{"class":1012},"border-bottom",[273,1194,591],{"class":1022},[273,1196,1197],{"class":1012}," (printf",[273,1199,1200],{"class":1022}," \"1px",[273,1202,1203],{"class":1012}," solid",[273,1205,1206],{"class":1012}," %s",[273,1208,591],{"class":1022},[273,1210,1211],{"class":1012}," (token",[273,1213,1214],{"class":1022}," \"color.border\"))}}{{style",[273,1216,1217],{"class":1022}," \"font-family\"",[273,1219,1081],{"class":1022},[273,1221,1222],{"class":1022}," \"size.text\"}}px;line-height:{{token",[273,1224,1225],{"class":1022}," \"size.line\"}}px;{{style",[273,1227,1090],{"class":1022},[273,1229,1093],{"class":1022},[273,1231,1232],{"class":432},">{{.Name}}\u003C\u002F",[273,1234,1009],{"class":428},[273,1236,1053],{"class":432},[273,1238,1239,1241,1243,1245,1247,1250,1252,1254,1257,1259,1261,1264,1266,1268,1270,1272,1274,1276,1278,1280,1282,1284,1286,1288,1290,1292,1295,1297,1301,1304,1306],{"class":275,"line":660},[273,1240,576],{"class":432},[273,1242,1009],{"class":428},[273,1244,1013],{"class":1012},[273,1246,1016],{"class":432},[273,1248,1249],{"class":283},"\"pl-muted pl-rule\"",[273,1251,1023],{"class":1022},[273,1253,1016],{"class":432},[273,1255,1256],{"class":283},"\"right\"",[273,1258,1031],{"class":1012},[273,1260,1016],{"class":432},[273,1262,1263],{"class":283},"\"padding:10px 0 10px 12px;{{style \"",[273,1265,1192],{"class":1012},[273,1267,591],{"class":1022},[273,1269,1197],{"class":1012},[273,1271,1200],{"class":1022},[273,1273,1203],{"class":1012},[273,1275,1206],{"class":1012},[273,1277,591],{"class":1022},[273,1279,1211],{"class":1012},[273,1281,1214],{"class":1022},[273,1283,1217],{"class":1022},[273,1285,1081],{"class":1022},[273,1287,1222],{"class":1022},[273,1289,1225],{"class":1022},[273,1291,1090],{"class":1022},[273,1293,1294],{"class":1022}," \"color.muted\"}}white-space:nowrap;\"",[273,1296,579],{"class":432},[273,1298,1300],{"class":1299},"sFaxo","&times;&nbsp;",[273,1302,1303],{"class":432},"{{.Qty}}\u003C\u002F",[273,1305,1009],{"class":428},[273,1307,1053],{"class":432},[273,1309,1310,1312,1314,1316,1318,1320,1322,1324,1326,1328,1330,1332,1334,1336,1338,1340,1342,1344,1346,1348,1350,1352,1354,1356,1358,1360,1363,1366,1368,1371,1373],{"class":275,"line":666},[273,1311,576],{"class":432},[273,1313,1009],{"class":428},[273,1315,1013],{"class":1012},[273,1317,1016],{"class":432},[273,1319,1176],{"class":283},[273,1321,1023],{"class":1022},[273,1323,1016],{"class":432},[273,1325,1256],{"class":283},[273,1327,1031],{"class":1012},[273,1329,1016],{"class":432},[273,1331,1263],{"class":283},[273,1333,1192],{"class":1012},[273,1335,591],{"class":1022},[273,1337,1197],{"class":1012},[273,1339,1200],{"class":1022},[273,1341,1203],{"class":1012},[273,1343,1206],{"class":1012},[273,1345,591],{"class":1022},[273,1347,1211],{"class":1012},[273,1349,1214],{"class":1022},[273,1351,1217],{"class":1022},[273,1353,1081],{"class":1022},[273,1355,1222],{"class":1022},[273,1357,1225],{"class":1022},[273,1359,1090],{"class":1022},[273,1361,1362],{"class":1022}," \"color.text\"}}white-space:nowrap;\"",[273,1364,1365],{"class":432},">{{.Amount}}\u003C\u002F",[273,1367,1009],{"class":428},[273,1369,1370],{"class":432},">\u003C\u002F",[273,1372,1003],{"class":428},[273,1374,1053],{"class":432},[273,1376,1377],{"class":275,"line":861},[273,1378,1379],{"class":432},"{{- end}}\n",[273,1381,1383,1385,1387,1389,1391,1393,1395,1397,1400,1402,1405,1407,1409,1411,1413,1415,1418,1420,1422,1424,1426,1429,1431,1433,1436,1438],{"class":275,"line":1382},12,[273,1384,576],{"class":432},[273,1386,1003],{"class":428},[273,1388,1006],{"class":432},[273,1390,1009],{"class":428},[273,1392,1013],{"class":1012},[273,1394,1016],{"class":432},[273,1396,1066],{"class":283},[273,1398,1399],{"class":1012}," colspan",[273,1401,1016],{"class":432},[273,1403,1404],{"class":283},"\"2\"",[273,1406,1023],{"class":1022},[273,1408,1016],{"class":432},[273,1410,1028],{"class":283},[273,1412,1031],{"class":1012},[273,1414,1016],{"class":432},[273,1416,1417],{"class":283},"\"padding:10px 0 0;{{style \"",[273,1419,1076],{"class":1012},[273,1421,591],{"class":1022},[273,1423,1081],{"class":1022},[273,1425,1222],{"class":1022},[273,1427,1428],{"class":1022}," \"size.line\"}}px;font-weight:600;{{style",[273,1430,1090],{"class":1022},[273,1432,1093],{"class":1022},[273,1434,1435],{"class":432},">Total\u003C\u002F",[273,1437,1009],{"class":428},[273,1439,1053],{"class":432},[273,1441,1443,1445,1447,1449,1451,1453,1455,1457,1459,1461,1463,1466,1468,1470,1472,1474,1476,1478,1480,1483,1485,1487,1489],{"class":275,"line":1442},13,[273,1444,576],{"class":432},[273,1446,1009],{"class":428},[273,1448,1013],{"class":1012},[273,1450,1016],{"class":432},[273,1452,1066],{"class":283},[273,1454,1023],{"class":1022},[273,1456,1016],{"class":432},[273,1458,1256],{"class":283},[273,1460,1031],{"class":1012},[273,1462,1016],{"class":432},[273,1464,1465],{"class":283},"\"padding:10px 0 0 12px;{{style \"",[273,1467,1076],{"class":1012},[273,1469,591],{"class":1022},[273,1471,1081],{"class":1022},[273,1473,1222],{"class":1022},[273,1475,1428],{"class":1022},[273,1477,1090],{"class":1022},[273,1479,1362],{"class":1022},[273,1481,1482],{"class":432},">{{.Bind.invoice.Total}}\u003C\u002F",[273,1484,1009],{"class":428},[273,1486,1370],{"class":432},[273,1488,1003],{"class":428},[273,1490,1053],{"class":432},[273,1492,1494,1497,1499],{"class":275,"line":1493},14,[273,1495,1496],{"class":432},"\u003C\u002F",[273,1498,1107],{"class":428},[273,1500,1053],{"class":432},[273,1502,1504,1506,1508,1510,1512],{"class":275,"line":1503},15,[273,1505,1496],{"class":432},[273,1507,1009],{"class":428},[273,1509,1370],{"class":432},[273,1511,1003],{"class":428},[273,1513,1053],{"class":432},[211,1515,1516,1519,1520,1522,1523,1526,1527,1530,1531,325,1534,1537,1538,1540,1541,1522,1544,238,1547,325,1550,1553,1554,238,1557,238,1560,238,1563,1566,1567,1569],{},[215,1517,1518],{},".Bind.invoice"," is an ",[215,1521,796],{},", so ",[215,1524,1525],{},".Bind.invoice.Number",", the ",[215,1528,1529],{},"range"," over ",[215,1532,1533],{},".Bind.invoice.Lines",[215,1535,1536],{},".Bind.invoice.Total"," are all checked against the Go type when the kit loads. Inside the ",[215,1539,1529],{},", the dot is a ",[215,1542,1543],{},"Line",[215,1545,1546],{},".Name",[215,1548,1549],{},".Qty",[215,1551,1552],{},".Amount"," are checked against that. The class names (",[215,1555,1556],{},"pl-px",[215,1558,1559],{},"pl-text",[215,1561,1562],{},"pl-rule",[215,1564,1565],{},"pl-muted",") are Plain's hooks for its mobile and dark-mode rules in ",[215,1568,321],{},", so the new rows follow the rest of the kit.",[211,1571,1572,1573,325,1576,1579],{},"The text template gives the plain-text part its form of the invoice. It uses the text-only ",[215,1574,1575],{},"leaders",[215,1577,1578],{},"leader"," functions for dot-leader rows:",[244,1581,1585],{"className":1582,"code":1583,"filename":1584,"language":249,"meta":250},[247],"{{- \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,1586,1583],{"__ignoreMap":250},[211,1588,1589,1590,1593,1594,1596,1597,1599],{},"A component without ",[215,1591,1592],{},"text.tmpl"," has no text form, and its HTML stands alone. See ",[220,1595,88],{"href":89}," for the view types and every core function, and ",[220,1598,107],{"href":108}," for how the text part is joined.",[254,1601,954],{"id":1602},"register-the-go-type",[211,1604,1605,1606,1608,1609,1611,1612,1615],{},"A kit names the Go types its components may bind in ",[215,1607,79],{},". Put the ",[215,1610,903],{}," line at the top level, after ",[215,1613,1614],{},"dark: true",":",[244,1617,1620],{"className":418,"code":1618,"filename":1619,"language":421,"meta":250,"style":250},"# 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",[215,1621,1622,1627,1632],{"__ignoreMap":250},[273,1623,1624],{"class":275,"line":276},[273,1625,1626],{"class":458},"# Go types components may bind. The kit's Go package registers each one\n",[273,1628,1629],{"class":275,"line":462},[273,1630,1631],{"class":458},"# with kit.Types, so this kit loads from Go, not from the CLI.\n",[273,1633,1634,1636,1639,1641],{"class":275,"line":624},[273,1635,903],{"class":428},[273,1637,1638],{"class":432},": [",[273,1640,796],{"class":283},[273,1642,1643],{"class":432},"]\n",[211,1645,1646,1647,1649],{},"The CLI has no way to know what ",[215,1648,796],{}," is, so from here on it refuses to load the kit directory, and says why:",[244,1651,1652],{"className":266,"code":358,"filename":268,"language":269,"meta":250,"style":250},[215,1653,1654],{"__ignoreMap":250},[273,1655,1656,1658,1660,1662],{"class":275,"line":276},[273,1657,280],{"class":279},[273,1659,284],{"class":283},[273,1661,369],{"class":283},[273,1663,297],{"class":283},[244,1665,1668],{"className":1666,"code":1667,"filename":302,"language":249,"meta":250},[247],"kit\u002Fkit.yaml:14:9: types: \"Invoice\" is not registered\n.\u002Fkit: kit directories load without Go types; check kits that bind Go types from Go (see README)\n",[215,1669,1667],{"__ignoreMap":250},[211,1671,1672,1673,1675,1676,1679,1680,1682,1683,1685,1686,1689],{},"The line number depends on the header comment above ",[215,1674,314],{},". ",[215,1677,1678],{},"kit init"," wrote a six-line header, so the ",[215,1681,903],{}," block lands after ",[215,1684,1614],{}," and a blank line, on line 14. The tutorial's shorter header in the repository puts it on line 12. ",[215,1687,1688],{},"lttr serve -kit .\u002Fkit"," shows the same error as a kit problem, and started afresh it shows only the kit-failure page, since the kit never loads.",[211,1691,1692,1693,1696,1697,1700,1701,1704],{},"The kit now lives in a Go package. ",[215,1694,1695],{},"tutorial.go",", next to the ",[215,1698,1699],{},"kit\u002F"," directory, starts with its package clause and imports (",[215,1702,1703],{},"net\u002Fmail"," is for the sample set, further down):",[244,1706,1711],{"className":1707,"code":1708,"filename":1709,"language":1710,"meta":250,"style":250},"language-go shiki shiki-themes github-light-high-contrast github-light-high-contrast github-dark","package tutorial\n\nimport (\n    \"embed\"\n    \"fmt\"\n    \"io\u002Ffs\"\n    \"net\u002Fmail\"\n    \"sync\"\n\n    \"github.com\u002Fsulv-io\u002Flttr\"\n    \"github.com\u002Fsulv-io\u002Flttr\u002Fkit\"\n)\n","tutorial\u002Ftutorial.go#L1-L12","go",[215,1712,1713,1722,1728,1736,1747,1756,1765,1773,1782,1786,1795,1804],{"__ignoreMap":250},[273,1714,1715,1719],{"class":275,"line":276},[273,1716,1718],{"class":1717},"s1Q0q","package",[273,1720,1721],{"class":279}," tutorial\n",[273,1723,1724],{"class":275,"line":462},[273,1725,1727],{"emptyLinePlaceholder":1726},true,"\n",[273,1729,1730,1733],{"class":275,"line":624},[273,1731,1732],{"class":1717},"import",[273,1734,1735],{"class":432}," (\n",[273,1737,1738,1741,1744],{"class":275,"line":630},[273,1739,1740],{"class":283},"    \"",[273,1742,1743],{"class":279},"embed",[273,1745,1746],{"class":283},"\"\n",[273,1748,1749,1751,1754],{"class":275,"line":636},[273,1750,1740],{"class":283},[273,1752,1753],{"class":279},"fmt",[273,1755,1746],{"class":283},[273,1757,1758,1760,1763],{"class":275,"line":642},[273,1759,1740],{"class":283},[273,1761,1762],{"class":279},"io\u002Ffs",[273,1764,1746],{"class":283},[273,1766,1767,1769,1771],{"class":275,"line":648},[273,1768,1740],{"class":283},[273,1770,1703],{"class":279},[273,1772,1746],{"class":283},[273,1774,1775,1777,1780],{"class":275,"line":654},[273,1776,1740],{"class":283},[273,1778,1779],{"class":279},"sync",[273,1781,1746],{"class":283},[273,1783,1784],{"class":275,"line":660},[273,1785,1727],{"emptyLinePlaceholder":1726},[273,1787,1788,1790,1793],{"class":275,"line":666},[273,1789,1740],{"class":283},[273,1791,1792],{"class":279},"github.com\u002Fsulv-io\u002Flttr",[273,1794,1746],{"class":283},[273,1796,1797,1799,1802],{"class":275,"line":861},[273,1798,1740],{"class":283},[273,1800,1801],{"class":279},"github.com\u002Fsulv-io\u002Flttr\u002Fkit",[273,1803,1746],{"class":283},[273,1805,1806],{"class":275,"line":1382},[273,1807,1808],{"class":432},")\n",[211,1810,1811,1812,1814,1815,1818,1819,1615],{},"First the types: ",[215,1813,796],{}," is what the component binds, and ",[215,1816,1817],{},"Data"," is the template's data, which carries an ",[215,1820,796],{},[244,1822,1825],{"className":1707,"code":1823,"filename":1824,"language":1710,"meta":250,"style":250},"\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",[215,1826,1827,1832,1842,1846,1851,1856,1887,1898,1913,1931,1936,1986,1991,1995,2000,2012,2021,2030,2041,2046,2051,2057,2063,2075,2083,2092,2101,2106,2111,2117,2123,2135,2146,2157,2168],{"__ignoreMap":250},[273,1828,1829],{"class":275,"line":276},[273,1830,1831],{"class":458},"\u002F\u002F Money is an amount in cents.\n",[273,1833,1834,1836,1839],{"class":275,"line":462},[273,1835,782],{"class":1717},[273,1837,1838],{"class":279}," Money",[273,1840,1841],{"class":1717}," int64\n",[273,1843,1844],{"class":275,"line":624},[273,1845,1727],{"emptyLinePlaceholder":1726},[273,1847,1848],{"class":275,"line":630},[273,1849,1850],{"class":458},"\u002F\u002F String formats m in dollars, such as \"$1250.00\". Merge tags and kit\n",[273,1852,1853],{"class":275,"line":636},[273,1854,1855],{"class":458},"\u002F\u002F templates both print a Money through it.\n",[273,1857,1858,1861,1864,1868,1871,1874,1878,1881,1884],{"class":275,"line":642},[273,1859,1860],{"class":1717},"func",[273,1862,1863],{"class":432}," (",[273,1865,1867],{"class":1866},"s-BBy","m ",[273,1869,1870],{"class":279},"Money",[273,1872,1873],{"class":432},") ",[273,1875,1877],{"class":1876},"sPmw6","String",[273,1879,1880],{"class":432},"() ",[273,1882,1883],{"class":1717},"string",[273,1885,1886],{"class":432}," {\n",[273,1888,1889,1892,1895],{"class":275,"line":648},[273,1890,1891],{"class":432},"    sign ",[273,1893,1894],{"class":1717},":=",[273,1896,1897],{"class":283}," \"\"\n",[273,1899,1900,1903,1906,1908,1911],{"class":275,"line":654},[273,1901,1902],{"class":1717},"    if",[273,1904,1905],{"class":432}," m ",[273,1907,576],{"class":1717},[273,1909,1910],{"class":290}," 0",[273,1912,1886],{"class":432},[273,1914,1915,1918,1920,1923,1925,1928],{"class":275,"line":660},[273,1916,1917],{"class":432},"        sign, m ",[273,1919,1016],{"class":1717},[273,1921,1922],{"class":283}," \"-\"",[273,1924,238],{"class":432},[273,1926,1927],{"class":1717},"-",[273,1929,1930],{"class":432},"m\n",[273,1932,1933],{"class":275,"line":666},[273,1934,1935],{"class":432},"    }\n",[273,1937,1938,1941,1944,1947,1949,1951,1954,1957,1960,1962,1965,1967,1970,1973,1976,1979,1982,1984],{"class":275,"line":861},[273,1939,1940],{"class":1717},"    return",[273,1942,1943],{"class":432}," fmt.",[273,1945,1946],{"class":1876},"Sprintf",[273,1948,525],{"class":432},[273,1950,591],{"class":283},[273,1952,1953],{"class":1299},"%s",[273,1955,1956],{"class":283},"$",[273,1958,1959],{"class":1299},"%d",[273,1961,394],{"class":283},[273,1963,1964],{"class":1299},"%02d",[273,1966,591],{"class":283},[273,1968,1969],{"class":432},", sign, m",[273,1971,1972],{"class":1717},"\u002F",[273,1974,1975],{"class":290},"100",[273,1977,1978],{"class":432},", m",[273,1980,1981],{"class":1717},"%",[273,1983,1975],{"class":290},[273,1985,1808],{"class":432},[273,1987,1988],{"class":275,"line":1382},[273,1989,1990],{"class":432},"}\n",[273,1992,1993],{"class":275,"line":1442},[273,1994,1727],{"emptyLinePlaceholder":1726},[273,1996,1997],{"class":275,"line":1493},[273,1998,1999],{"class":458},"\u002F\u002F Line is one line of an invoice.\n",[273,2001,2002,2004,2007,2010],{"class":275,"line":1503},[273,2003,782],{"class":1717},[273,2005,2006],{"class":279}," Line",[273,2008,2009],{"class":1717}," struct",[273,2011,1886],{"class":432},[273,2013,2015,2018],{"class":275,"line":2014},16,[273,2016,2017],{"class":432},"    Name   ",[273,2019,2020],{"class":1717},"string\n",[273,2022,2024,2027],{"class":275,"line":2023},17,[273,2025,2026],{"class":432},"    Qty    ",[273,2028,2029],{"class":1717},"int\n",[273,2031,2033,2036,2038],{"class":275,"line":2032},18,[273,2034,2035],{"class":432},"    Amount ",[273,2037,1870],{"class":279},[273,2039,2040],{"class":458}," \u002F\u002F the line total\n",[273,2042,2044],{"class":275,"line":2043},19,[273,2045,1990],{"class":432},[273,2047,2049],{"class":275,"line":2048},20,[273,2050,1727],{"emptyLinePlaceholder":1726},[273,2052,2054],{"class":275,"line":2053},21,[273,2055,2056],{"class":458},"\u002F\u002F Invoice is the Go type the kit's invoice component binds. kit.yaml lists\n",[273,2058,2060],{"class":275,"line":2059},22,[273,2061,2062],{"class":458},"\u002F\u002F it under `types`, and Kit registers it under the same name.\n",[273,2064,2066,2068,2071,2073],{"class":275,"line":2065},23,[273,2067,782],{"class":1717},[273,2069,2070],{"class":279}," Invoice",[273,2072,2009],{"class":1717},[273,2074,1886],{"class":432},[273,2076,2078,2081],{"class":275,"line":2077},24,[273,2079,2080],{"class":432},"    Number ",[273,2082,2020],{"class":1717},[273,2084,2086,2089],{"class":275,"line":2085},25,[273,2087,2088],{"class":432},"    Lines  []",[273,2090,2091],{"class":279},"Line\n",[273,2093,2095,2098],{"class":275,"line":2094},26,[273,2096,2097],{"class":432},"    Total  ",[273,2099,2100],{"class":279},"Money\n",[273,2102,2104],{"class":275,"line":2103},27,[273,2105,1990],{"class":432},[273,2107,2109],{"class":275,"line":2108},28,[273,2110,1727],{"emptyLinePlaceholder":1726},[273,2112,2114],{"class":275,"line":2113},29,[273,2115,2116],{"class":458},"\u002F\u002F Data is the data of templates\u002Finvoice.md. Merge tags such as\n",[273,2118,2120],{"class":275,"line":2119},30,[273,2121,2122],{"class":458},"\u002F\u002F {{invoice.number}} and the :invoice=\"invoice\" binding resolve against it.\n",[273,2124,2126,2128,2131,2133],{"class":275,"line":2125},31,[273,2127,782],{"class":1717},[273,2129,2130],{"class":279}," Data",[273,2132,2009],{"class":1717},[273,2134,1886],{"class":432},[273,2136,2138,2141,2143],{"class":275,"line":2137},32,[273,2139,2140],{"class":432},"    Invoice ",[273,2142,796],{"class":279},[273,2144,2145],{"class":283}," `json:\"invoice\"`\n",[273,2147,2149,2152,2154],{"class":275,"line":2148},33,[273,2150,2151],{"class":432},"    Due     ",[273,2153,1883],{"class":1717},[273,2155,2156],{"class":283},"  `json:\"due\"`\n",[273,2158,2160,2163,2165],{"class":275,"line":2159},34,[273,2161,2162],{"class":432},"    PayURL  ",[273,2164,1883],{"class":1717},[273,2166,2167],{"class":283},"  `json:\"pay_url\"`\n",[273,2169,2171],{"class":275,"line":2170},35,[273,2172,1990],{"class":432},[211,2174,2175,2177,2178,1522,2181,2184,2185,2188,2189,2192,2193,2196,2197,394],{},[215,2176,1870],{}," implements ",[215,2179,2180],{},"fmt.Stringer",[215,2182,2183],{},"{{.Amount}}"," in a kit template and ",[215,2186,2187],{},"{{invoice.total}}"," in a Markdown template both print ",[215,2190,2191],{},"$76.00",", not ",[215,2194,2195],{},"7600",". A merge tag needs a scalar: a string or integer kind, or any ",[215,2198,2180],{},[211,2200,2201,2202,2204],{},"Then the package embeds the kit directory and loads it with the type registered under the name ",[215,2203,79],{}," uses:",[244,2206,2209],{"className":1707,"code":2207,"filename":2208,"language":1710,"meta":250,"style":250},"\u002F\u002F files holds the kit directory, kit\u002F.\n\u002F\u002F\n\u002F\u002Fgo:embed kit\nvar files embed.FS\n\n\u002F\u002F Files returns the kit's files, rooted at kit\u002F.\nfunc Files() fs.FS {\n    sub, err := fs.Sub(files, \"kit\")\n    if err != nil {\n        panic(err) \u002F\u002F \"kit\" is a valid path, so Sub cannot fail\n    }\n    return sub\n}\n\n\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\n\u002F\u002F load is LoadKit, kept for callers within the package.\nfunc load(fsys fs.FS) (*kit.Kit, error) { return LoadKit(fsys) }\n\n\u002F\u002F loadOnce loads the kit once, so every template and renderer shares the\n\u002F\u002F same immutable *kit.Kit.\nvar loadOnce = sync.OnceValues(func() (*kit.Kit, error) { return LoadKit(Files()) })\n\n\u002F\u002F Kit returns the loaded tutorial kit. It is safe for concurrent use and\n\u002F\u002F returns the same *kit.Kit on every call.\nfunc Kit() (*kit.Kit, error) { return loadOnce() }\n\n\u002F\u002F MustKit is Kit that panics on error; the embedded kit is tested, so an\n\u002F\u002F error means a broken build.\nfunc MustKit() *kit.Kit {\n    k, err := Kit()\n    if err != nil {\n        panic(err)\n    }\n    return k\n}\n","tutorial\u002Ftutorial.go#L50-L91",[215,2210,2211,2216,2221,2226,2241,2245,2250,2269,2290,2305,2316,2320,2327,2331,2335,2340,2345,2350,2355,2396,2432,2436,2440,2445,2487,2491,2496,2501,2549,2553,2558,2563,2594,2598,2603,2608,2628,2641,2654,2662,2667,2675],{"__ignoreMap":250},[273,2212,2213],{"class":275,"line":276},[273,2214,2215],{"class":458},"\u002F\u002F files holds the kit directory, kit\u002F.\n",[273,2217,2218],{"class":275,"line":462},[273,2219,2220],{"class":458},"\u002F\u002F\n",[273,2222,2223],{"class":275,"line":624},[273,2224,2225],{"class":458},"\u002F\u002Fgo:embed kit\n",[273,2227,2228,2231,2234,2236,2238],{"class":275,"line":630},[273,2229,2230],{"class":1717},"var",[273,2232,2233],{"class":432}," files ",[273,2235,1743],{"class":279},[273,2237,394],{"class":432},[273,2239,2240],{"class":279},"FS\n",[273,2242,2243],{"class":275,"line":636},[273,2244,1727],{"emptyLinePlaceholder":1726},[273,2246,2247],{"class":275,"line":642},[273,2248,2249],{"class":458},"\u002F\u002F Files returns the kit's files, rooted at kit\u002F.\n",[273,2251,2252,2254,2257,2259,2262,2264,2267],{"class":275,"line":648},[273,2253,1860],{"class":1717},[273,2255,2256],{"class":1876}," Files",[273,2258,1880],{"class":432},[273,2260,2261],{"class":279},"fs",[273,2263,394],{"class":432},[273,2265,2266],{"class":279},"FS",[273,2268,1886],{"class":432},[273,2270,2271,2274,2276,2279,2282,2285,2288],{"class":275,"line":654},[273,2272,2273],{"class":432},"    sub, err ",[273,2275,1894],{"class":1717},[273,2277,2278],{"class":432}," fs.",[273,2280,2281],{"class":1876},"Sub",[273,2283,2284],{"class":432},"(files, ",[273,2286,2287],{"class":283},"\"kit\"",[273,2289,1808],{"class":432},[273,2291,2292,2294,2297,2300,2303],{"class":275,"line":660},[273,2293,1902],{"class":1717},[273,2295,2296],{"class":432}," err ",[273,2298,2299],{"class":1717},"!=",[273,2301,2302],{"class":290}," nil",[273,2304,1886],{"class":432},[273,2306,2307,2310,2313],{"class":275,"line":666},[273,2308,2309],{"class":1876},"        panic",[273,2311,2312],{"class":432},"(err) ",[273,2314,2315],{"class":458},"\u002F\u002F \"kit\" is a valid path, so Sub cannot fail\n",[273,2317,2318],{"class":275,"line":861},[273,2319,1935],{"class":432},[273,2321,2322,2324],{"class":275,"line":1382},[273,2323,1940],{"class":1717},[273,2325,2326],{"class":432}," sub\n",[273,2328,2329],{"class":275,"line":1442},[273,2330,1990],{"class":432},[273,2332,2333],{"class":275,"line":1493},[273,2334,1727],{"emptyLinePlaceholder":1726},[273,2336,2337],{"class":275,"line":1503},[273,2338,2339],{"class":458},"\u002F\u002F LoadKit loads the tutorial kit from fsys (a copy of kit\u002F on disk, say)\n",[273,2341,2342],{"class":275,"line":2014},[273,2343,2344],{"class":458},"\u002F\u002F with the Go types its components bind. A kit with `types` in kit.yaml\n",[273,2346,2347],{"class":275,"line":2023},[273,2348,2349],{"class":458},"\u002F\u002F loads only with every listed type registered. Kit() is\n",[273,2351,2352],{"class":275,"line":2032},[273,2353,2354],{"class":458},"\u002F\u002F LoadKit(Files()) cached.\n",[273,2356,2357,2359,2362,2364,2367,2370,2372,2374,2377,2380,2383,2385,2388,2390,2393],{"class":275,"line":2043},[273,2358,1860],{"class":1717},[273,2360,2361],{"class":1876}," LoadKit",[273,2363,525],{"class":432},[273,2365,2366],{"class":1866},"fsys",[273,2368,2369],{"class":279}," fs",[273,2371,394],{"class":432},[273,2373,2266],{"class":279},[273,2375,2376],{"class":432},") (",[273,2378,2379],{"class":1717},"*",[273,2381,2382],{"class":279},"kit",[273,2384,394],{"class":432},[273,2386,2387],{"class":279},"Kit",[273,2389,238],{"class":432},[273,2391,2392],{"class":1717},"error",[273,2394,2395],{"class":432},") {\n",[273,2397,2398,2400,2403,2406,2409,2412,2415,2418,2421,2423,2426,2429],{"class":275,"line":2048},[273,2399,1940],{"class":1717},[273,2401,2402],{"class":432}," kit.",[273,2404,2405],{"class":1876},"Load",[273,2407,2408],{"class":432},"(fsys, kit.",[273,2410,2411],{"class":1876},"Types",[273,2413,2414],{"class":432},"(kit.",[273,2416,2417],{"class":1876},"TypeOf",[273,2419,2420],{"class":432},"[",[273,2422,796],{"class":279},[273,2424,2425],{"class":432},"](",[273,2427,2428],{"class":283},"\"Invoice\"",[273,2430,2431],{"class":432},")))\n",[273,2433,2434],{"class":275,"line":2053},[273,2435,1990],{"class":432},[273,2437,2438],{"class":275,"line":2059},[273,2439,1727],{"emptyLinePlaceholder":1726},[273,2441,2442],{"class":275,"line":2065},[273,2443,2444],{"class":458},"\u002F\u002F load is LoadKit, kept for callers within the package.\n",[273,2446,2447,2449,2452,2454,2456,2458,2460,2462,2464,2466,2468,2470,2472,2474,2476,2479,2482,2484],{"class":275,"line":2077},[273,2448,1860],{"class":1717},[273,2450,2451],{"class":1876}," load",[273,2453,525],{"class":432},[273,2455,2366],{"class":1866},[273,2457,2369],{"class":279},[273,2459,394],{"class":432},[273,2461,2266],{"class":279},[273,2463,2376],{"class":432},[273,2465,2379],{"class":1717},[273,2467,2382],{"class":279},[273,2469,394],{"class":432},[273,2471,2387],{"class":279},[273,2473,238],{"class":432},[273,2475,2392],{"class":1717},[273,2477,2478],{"class":432},") { ",[273,2480,2481],{"class":1717},"return",[273,2483,2361],{"class":1876},[273,2485,2486],{"class":432},"(fsys) }\n",[273,2488,2489],{"class":275,"line":2085},[273,2490,1727],{"emptyLinePlaceholder":1726},[273,2492,2493],{"class":275,"line":2094},[273,2494,2495],{"class":458},"\u002F\u002F loadOnce loads the kit once, so every template and renderer shares the\n",[273,2497,2498],{"class":275,"line":2103},[273,2499,2500],{"class":458},"\u002F\u002F same immutable *kit.Kit.\n",[273,2502,2503,2505,2508,2510,2513,2516,2518,2520,2523,2525,2527,2529,2531,2533,2535,2537,2539,2541,2543,2546],{"class":275,"line":2108},[273,2504,2230],{"class":1717},[273,2506,2507],{"class":432}," loadOnce ",[273,2509,1016],{"class":1717},[273,2511,2512],{"class":432}," sync.",[273,2514,2515],{"class":1876},"OnceValues",[273,2517,525],{"class":432},[273,2519,1860],{"class":1717},[273,2521,2522],{"class":432},"() (",[273,2524,2379],{"class":1717},[273,2526,2382],{"class":279},[273,2528,394],{"class":432},[273,2530,2387],{"class":279},[273,2532,238],{"class":432},[273,2534,2392],{"class":1717},[273,2536,2478],{"class":432},[273,2538,2481],{"class":1717},[273,2540,2361],{"class":1876},[273,2542,525],{"class":432},[273,2544,2545],{"class":1876},"Files",[273,2547,2548],{"class":432},"()) })\n",[273,2550,2551],{"class":275,"line":2113},[273,2552,1727],{"emptyLinePlaceholder":1726},[273,2554,2555],{"class":275,"line":2119},[273,2556,2557],{"class":458},"\u002F\u002F Kit returns the loaded tutorial kit. It is safe for concurrent use and\n",[273,2559,2560],{"class":275,"line":2125},[273,2561,2562],{"class":458},"\u002F\u002F returns the same *kit.Kit on every call.\n",[273,2564,2565,2567,2570,2572,2574,2576,2578,2580,2582,2584,2586,2588,2591],{"class":275,"line":2137},[273,2566,1860],{"class":1717},[273,2568,2569],{"class":1876}," Kit",[273,2571,2522],{"class":432},[273,2573,2379],{"class":1717},[273,2575,2382],{"class":279},[273,2577,394],{"class":432},[273,2579,2387],{"class":279},[273,2581,238],{"class":432},[273,2583,2392],{"class":1717},[273,2585,2478],{"class":432},[273,2587,2481],{"class":1717},[273,2589,2590],{"class":1876}," loadOnce",[273,2592,2593],{"class":432},"() }\n",[273,2595,2596],{"class":275,"line":2148},[273,2597,1727],{"emptyLinePlaceholder":1726},[273,2599,2600],{"class":275,"line":2159},[273,2601,2602],{"class":458},"\u002F\u002F MustKit is Kit that panics on error; the embedded kit is tested, so an\n",[273,2604,2605],{"class":275,"line":2170},[273,2606,2607],{"class":458},"\u002F\u002F error means a broken build.\n",[273,2609,2611,2613,2616,2618,2620,2622,2624,2626],{"class":275,"line":2610},36,[273,2612,1860],{"class":1717},[273,2614,2615],{"class":1876}," MustKit",[273,2617,1880],{"class":432},[273,2619,2379],{"class":1717},[273,2621,2382],{"class":279},[273,2623,394],{"class":432},[273,2625,2387],{"class":279},[273,2627,1886],{"class":432},[273,2629,2631,2634,2636,2638],{"class":275,"line":2630},37,[273,2632,2633],{"class":432},"    k, err ",[273,2635,1894],{"class":1717},[273,2637,2569],{"class":1876},[273,2639,2640],{"class":432},"()\n",[273,2642,2644,2646,2648,2650,2652],{"class":275,"line":2643},38,[273,2645,1902],{"class":1717},[273,2647,2296],{"class":432},[273,2649,2299],{"class":1717},[273,2651,2302],{"class":290},[273,2653,1886],{"class":432},[273,2655,2657,2659],{"class":275,"line":2656},39,[273,2658,2309],{"class":1876},[273,2660,2661],{"class":432},"(err)\n",[273,2663,2665],{"class":275,"line":2664},40,[273,2666,1935],{"class":432},[273,2668,2670,2672],{"class":275,"line":2669},41,[273,2671,1940],{"class":1717},[273,2673,2674],{"class":432}," k\n",[273,2676,2678],{"class":275,"line":2677},42,[273,2679,1990],{"class":432},[211,2681,2682,2685,2686,2689,2690,2693,2694,325,2697,2700,2701,238,2703,325,2705,2708,2709,2712,2713,2715,2716,394],{},[215,2683,2684],{},"kit.Load"," decodes every file, checks every cross-reference and statically checks every template, and it returns every problem at once, each with its kit file position. Loading once with ",[215,2687,2688],{},"sync.OnceValues"," matters: a template must be compiled against the same ",[215,2691,2692],{},"*kit.Kit"," the renderer uses. ",[215,2695,2696],{},"kits\u002Fplain",[215,2698,2699],{},"kits\u002Fquiet"," expose the same ",[215,2702,2545],{},[215,2704,2387],{},[215,2706,2707],{},"MustKit"," trio. A kit that adds template functions passes ",[215,2710,2711],{},"kit.Funcs(…)"," to ",[215,2714,2405],{}," the same way. See ",[220,2717,97],{"href":98},[254,2719,2721],{"id":2720},"write-the-template","Write the template",[211,2723,2724,2725,2727,2728,2731],{},"The template is ordinary Comark. Loose Markdown goes into the kit's default component, ",[215,2726,332],{},". The invoice component takes the invoice through a binding, ",[215,2729,2730],{},":invoice=\"invoice\"",", which names a path in the data:",[244,2733,2738],{"className":2734,"code":2735,"filename":2736,"language":2737,"meta":250,"style":250},"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,2739,2740,2745,2754,2764,2774,2784,2788,2792,2798,2802,2807,2811,2816,2821,2825,2830,2835,2839,2844,2848,2852,2857],{"__ignoreMap":250},[273,2741,2742],{"class":275,"line":276},[273,2743,2744],{"class":432},"---\n",[273,2746,2747,2750,2752],{"class":275,"line":462},[273,2748,2749],{"class":428},"template",[273,2751,439],{"class":432},[273,2753,763],{"class":283},[273,2755,2756,2759,2761],{"class":275,"line":624},[273,2757,2758],{"class":428},"profile",[273,2760,439],{"class":432},[273,2762,2763],{"class":283},"billing\n",[273,2765,2766,2769,2771],{"class":275,"line":630},[273,2767,2768],{"class":428},"subject",[273,2770,439],{"class":432},[273,2772,2773],{"class":283},"\"Invoice {{invoice.number}}\"\n",[273,2775,2776,2779,2781],{"class":275,"line":636},[273,2777,2778],{"class":428},"preheader",[273,2780,439],{"class":432},[273,2782,2783],{"class":283},"\"{{invoice.total}} due by {{due}}.\"\n",[273,2785,2786],{"class":275,"line":642},[273,2787,2744],{"class":432},[273,2789,2790],{"class":275,"line":648},[273,2791,1727],{"emptyLinePlaceholder":1726},[273,2793,2794],{"class":275,"line":654},[273,2795,2797],{"class":2796},"su3Io","# Your invoice\n",[273,2799,2800],{"class":275,"line":660},[273,2801,1727],{"emptyLinePlaceholder":1726},[273,2803,2804],{"class":275,"line":666},[273,2805,2806],{"class":432},"Hi {{name | there}}, here is invoice {{invoice.number}} for September.\n",[273,2808,2809],{"class":275,"line":861},[273,2810,1727],{"emptyLinePlaceholder":1726},[273,2812,2813],{"class":275,"line":1382},[273,2814,2815],{"class":432},"::invoice{:invoice=\"invoice\"}\n",[273,2817,2818],{"class":275,"line":1442},[273,2819,2820],{"class":432},"::\n",[273,2822,2823],{"class":275,"line":1493},[273,2824,1727],{"emptyLinePlaceholder":1726},[273,2826,2827],{"class":275,"line":1503},[273,2828,2829],{"class":432},"::section\n",[273,2831,2832],{"class":275,"line":2014},[273,2833,2834],{"class":432},"Please pay by {{due}} to keep your plan active.\n",[273,2836,2837],{"class":275,"line":2023},[273,2838,1727],{"emptyLinePlaceholder":1726},[273,2840,2841],{"class":275,"line":2032},[273,2842,2843],{"class":432},":button[Pay {{invoice.total}}]{href=\"{{pay_url}}\"}\n",[273,2845,2846],{"class":275,"line":2043},[273,2847,2820],{"class":432},[273,2849,2850],{"class":275,"line":2048},[273,2851,1727],{"emptyLinePlaceholder":1726},[273,2853,2854],{"class":275,"line":2053},[273,2855,2856],{"class":432},"::footer{note=\"Questions about this invoice? Reply to this email.\"}\n",[273,2858,2859],{"class":275,"line":2059},[273,2860,2820],{"class":432},[211,2862,2863,2866,2867,2870,2871,325,2874,2877,2878,325,2880,394],{},[215,2864,2865],{},"profile: billing"," names the sender profile, which the renderer supplies. ",[215,2868,2869],{},"{{name | there}}"," falls back to \"there\" when the recipient has no name. ",[215,2872,2873],{},"::section",[215,2875,2876],{},"::footer"," are Plain's components, still in the kit. See ",[220,2879,38],{"href":39},[220,2881,53],{"href":54},[211,2883,2884],{},"The package compiles the template once, at init, against its kit:",[244,2886,2889],{"className":1707,"code":2887,"filename":2888,"language":1710,"meta":250,"style":250},"\u002F\u002F invoiceSource is the invoice template.\n\u002F\u002F\n\u002F\u002Fgo:embed templates\u002Finvoice.md\nvar invoiceSource []byte\n\n\u002F\u002F invoice is compiled once, at init, against the kit: a broken template\n\u002F\u002F stops the program at startup, never at send time.\nvar invoice = lttr.MustCompile[Data](MustKit(), \"invoice\", invoiceSource)\n\n\u002F\u002F Template returns the compiled invoice template.\nfunc Template() *lttr.Template[Data] { return invoice }\n","tutorial\u002Ftutorial.go#L93-L103",[215,2890,2891,2896,2900,2905,2915,2919,2924,2929,2961,2965,2970],{"__ignoreMap":250},[273,2892,2893],{"class":275,"line":276},[273,2894,2895],{"class":458},"\u002F\u002F invoiceSource is the invoice template.\n",[273,2897,2898],{"class":275,"line":462},[273,2899,2220],{"class":458},[273,2901,2902],{"class":275,"line":624},[273,2903,2904],{"class":458},"\u002F\u002Fgo:embed templates\u002Finvoice.md\n",[273,2906,2907,2909,2912],{"class":275,"line":630},[273,2908,2230],{"class":1717},[273,2910,2911],{"class":432}," invoiceSource []",[273,2913,2914],{"class":1717},"byte\n",[273,2916,2917],{"class":275,"line":636},[273,2918,1727],{"emptyLinePlaceholder":1726},[273,2920,2921],{"class":275,"line":642},[273,2922,2923],{"class":458},"\u002F\u002F invoice is compiled once, at init, against the kit: a broken template\n",[273,2925,2926],{"class":275,"line":648},[273,2927,2928],{"class":458},"\u002F\u002F stops the program at startup, never at send time.\n",[273,2930,2931,2933,2936,2938,2941,2944,2946,2948,2950,2952,2955,2958],{"class":275,"line":654},[273,2932,2230],{"class":1717},[273,2934,2935],{"class":432}," invoice ",[273,2937,1016],{"class":1717},[273,2939,2940],{"class":432}," lttr.",[273,2942,2943],{"class":1876},"MustCompile",[273,2945,2420],{"class":432},[273,2947,1817],{"class":279},[273,2949,2425],{"class":432},[273,2951,2707],{"class":1876},[273,2953,2954],{"class":432},"(), ",[273,2956,2957],{"class":283},"\"invoice\"",[273,2959,2960],{"class":432},", invoiceSource)\n",[273,2962,2963],{"class":275,"line":660},[273,2964,1727],{"emptyLinePlaceholder":1726},[273,2966,2967],{"class":275,"line":666},[273,2968,2969],{"class":458},"\u002F\u002F Template returns the compiled invoice template.\n",[273,2971,2972,2974,2977,2979,2981,2983,2985,2988,2990,2992,2995,2997],{"class":275,"line":861},[273,2973,1860],{"class":1717},[273,2975,2976],{"class":1876}," Template",[273,2978,1880],{"class":432},[273,2980,2379],{"class":1717},[273,2982,280],{"class":279},[273,2984,394],{"class":432},[273,2986,2987],{"class":279},"Template",[273,2989,2420],{"class":432},[273,2991,1817],{"class":279},[273,2993,2994],{"class":432},"] { ",[273,2996,2481],{"class":1717},[273,2998,2999],{"class":432}," invoice }\n",[211,3001,3002,3005,3006,3008,3009,3012],{},[215,3003,3004],{},"Compile"," checks every merge tag and binding against ",[215,3007,1817],{},", and every component and attribute against the kit's schemas. Misspell a field in the template, ",[215,3010,3011],{},"{{invoice.totl}}"," on line 18, and the package fails to initialise:",[244,3014,3017],{"className":3015,"code":3016,"filename":302,"language":249,"meta":250},[247],"panic: invoice:18:13: unknown field \"totl\" in tutorial.Invoice (did you mean invoice.total?)\n",[215,3018,3016],{"__ignoreMap":250},[211,3020,3021,3022,3025],{},"A binding must have exactly its registered type. ",[215,3023,3024],{},":invoice=\"due\""," binds a string:",[244,3027,3030],{"className":3028,"code":3029,"filename":302,"language":249,"meta":250},[247],"panic: invoice:12:1: invoice: :invoice is string, want tutorial.Invoice\n",[215,3031,3029],{"__ignoreMap":250},[254,3033,3035],{"id":3034},"test-it-from-go","Test it from Go",[211,3037,3038,3039,3042,3043,3046,3047,3050],{},"A kit that binds Go types is checked by its package's tests. They start from one description of \"this template, with this data\": an ",[215,3040,3041],{},"lttr.SampleSet",", which holds the kit, the ",[215,3044,3045],{},"Config"," to render with and the samples. The tutorial's ",[215,3048,3049],{},"Set"," puts the invoice template in it, with typed data and a recipient:",[244,3052,3055],{"className":1707,"code":3053,"filename":3054,"language":1710,"meta":250,"style":250},"\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,3056,3057,3062,3067,3072,3092,3103,3119,3124,3137,3142,3157,3168,3196,3201,3206,3220,3263,3267,3271,3275,3279,3284,3297,3305,3314,3324,3333,3355,3374,3379,3388,3392,3402,3412,3416],{"__ignoreMap":250},[273,3058,3059],{"class":275,"line":276},[273,3060,3061],{"class":458},"\u002F\u002F Set returns the tutorial as a sample set: the kit, a Config with the\n",[273,3063,3064],{"class":275,"line":462},[273,3065,3066],{"class":458},"\u002F\u002F \"billing\" profile the template names, and the invoice template with\n",[273,3068,3069],{"class":275,"line":624},[273,3070,3071],{"class":458},"\u002F\u002F typed sample data, rendered for ada@example.com.\n",[273,3073,3074,3076,3079,3081,3083,3085,3087,3090],{"class":275,"line":630},[273,3075,1860],{"class":1717},[273,3077,3078],{"class":1876}," Set",[273,3080,1880],{"class":432},[273,3082,2379],{"class":1717},[273,3084,280],{"class":279},[273,3086,394],{"class":432},[273,3088,3089],{"class":279},"SampleSet",[273,3091,1886],{"class":432},[273,3093,3094,3097,3099,3101],{"class":275,"line":636},[273,3095,3096],{"class":432},"    k ",[273,3098,1894],{"class":1717},[273,3100,2615],{"class":1876},[273,3102,2640],{"class":432},[273,3104,3105,3107,3110,3112,3114,3116],{"class":275,"line":642},[273,3106,1940],{"class":1717},[273,3108,3109],{"class":1717}," &",[273,3111,280],{"class":279},[273,3113,394],{"class":432},[273,3115,3089],{"class":279},[273,3117,3118],{"class":432},"{\n",[273,3120,3121],{"class":275,"line":648},[273,3122,3123],{"class":432},"        Kit: k,\n",[273,3125,3126,3129,3131,3133,3135],{"class":275,"line":654},[273,3127,3128],{"class":432},"        Config: ",[273,3130,280],{"class":279},[273,3132,394],{"class":432},[273,3134,3045],{"class":279},[273,3136,3118],{"class":432},[273,3138,3139],{"class":275,"line":660},[273,3140,3141],{"class":432},"            Kit: k,\n",[273,3143,3144,3147,3149,3151,3154],{"class":275,"line":666},[273,3145,3146],{"class":432},"            Profiles: []",[273,3148,280],{"class":279},[273,3150,394],{"class":432},[273,3152,3153],{"class":279},"Profile",[273,3155,3156],{"class":432},"{{\n",[273,3158,3159,3162,3165],{"class":275,"line":861},[273,3160,3161],{"class":432},"                Name: ",[273,3163,3164],{"class":283},"\"billing\"",[273,3166,3167],{"class":432},",\n",[273,3169,3170,3173,3176,3178,3181,3184,3187,3190,3193],{"class":275,"line":1382},[273,3171,3172],{"class":432},"                From: ",[273,3174,3175],{"class":279},"mail",[273,3177,394],{"class":432},[273,3179,3180],{"class":279},"Address",[273,3182,3183],{"class":432},"{Name: ",[273,3185,3186],{"class":283},"\"Example Billing\"",[273,3188,3189],{"class":432},", Address: ",[273,3191,3192],{"class":283},"\"billing@example.com\"",[273,3194,3195],{"class":432},"},\n",[273,3197,3198],{"class":275,"line":1442},[273,3199,3200],{"class":432},"            }},\n",[273,3202,3203],{"class":275,"line":1493},[273,3204,3205],{"class":432},"        },\n",[273,3207,3208,3211,3213,3215,3218],{"class":275,"line":1503},[273,3209,3210],{"class":432},"        Samples: []",[273,3212,280],{"class":279},[273,3214,394],{"class":432},[273,3216,3217],{"class":279},"Sample",[273,3219,3118],{"class":432},[273,3221,3222,3225,3228,3230,3233,3236,3239,3241,3243,3245,3248,3251,3254,3257,3260],{"class":275,"line":2014},[273,3223,3224],{"class":432},"            lttr.",[273,3226,3227],{"class":1876},"NewSample",[273,3229,525],{"class":432},[273,3231,3232],{"class":283},"\"invoice.md\"",[273,3234,3235],{"class":432},", invoiceSource, ",[273,3237,3238],{"class":1876},"sampleInvoice",[273,3240,2954],{"class":432},[273,3242,280],{"class":279},[273,3244,394],{"class":432},[273,3246,3247],{"class":279},"Recipient",[273,3249,3250],{"class":432},"{Address: ",[273,3252,3253],{"class":283},"\"ada@example.com\"",[273,3255,3256],{"class":432},", Name: ",[273,3258,3259],{"class":283},"\"Ada\"",[273,3261,3262],{"class":432},"}),\n",[273,3264,3265],{"class":275,"line":2023},[273,3266,3205],{"class":432},[273,3268,3269],{"class":275,"line":2032},[273,3270,1935],{"class":432},[273,3272,3273],{"class":275,"line":2043},[273,3274,1990],{"class":432},[273,3276,3277],{"class":275,"line":2048},[273,3278,1727],{"emptyLinePlaceholder":1726},[273,3280,3281],{"class":275,"line":2053},[273,3282,3283],{"class":458},"\u002F\u002F sampleInvoice is the data the tutorial's invoice is shown with.\n",[273,3285,3286,3288,3291,3293,3295],{"class":275,"line":2059},[273,3287,1860],{"class":1717},[273,3289,3290],{"class":1876}," sampleInvoice",[273,3292,1880],{"class":432},[273,3294,1817],{"class":279},[273,3296,1886],{"class":432},[273,3298,3299,3301,3303],{"class":275,"line":2065},[273,3300,1940],{"class":1717},[273,3302,2130],{"class":279},[273,3304,3118],{"class":432},[273,3306,3307,3310,3312],{"class":275,"line":2077},[273,3308,3309],{"class":432},"        Invoice: ",[273,3311,796],{"class":279},[273,3313,3118],{"class":432},[273,3315,3316,3319,3322],{"class":275,"line":2085},[273,3317,3318],{"class":432},"            Number: ",[273,3320,3321],{"class":283},"\"INV-0042\"",[273,3323,3167],{"class":432},[273,3325,3326,3329,3331],{"class":275,"line":2094},[273,3327,3328],{"class":432},"            Lines: []",[273,3330,1543],{"class":279},[273,3332,3118],{"class":432},[273,3334,3335,3338,3341,3344,3347,3350,3353],{"class":275,"line":2103},[273,3336,3337],{"class":432},"                {Name: ",[273,3339,3340],{"class":283},"\"Team plan, September\"",[273,3342,3343],{"class":432},", Qty: ",[273,3345,3346],{"class":290},"1",[273,3348,3349],{"class":432},", Amount: ",[273,3351,3352],{"class":290},"4900",[273,3354,3195],{"class":432},[273,3356,3357,3359,3362,3364,3367,3369,3372],{"class":275,"line":2108},[273,3358,3337],{"class":432},[273,3360,3361],{"class":283},"\"Extra seats\"",[273,3363,3343],{"class":432},[273,3365,3366],{"class":290},"3",[273,3368,3349],{"class":432},[273,3370,3371],{"class":290},"2700",[273,3373,3195],{"class":432},[273,3375,3376],{"class":275,"line":2113},[273,3377,3378],{"class":432},"            },\n",[273,3380,3381,3384,3386],{"class":275,"line":2119},[273,3382,3383],{"class":432},"            Total: ",[273,3385,2195],{"class":290},[273,3387,3167],{"class":432},[273,3389,3390],{"class":275,"line":2125},[273,3391,3205],{"class":432},[273,3393,3394,3397,3400],{"class":275,"line":2137},[273,3395,3396],{"class":432},"        Due:    ",[273,3398,3399],{"class":283},"\"9 October\"",[273,3401,3167],{"class":432},[273,3403,3404,3407,3410],{"class":275,"line":2148},[273,3405,3406],{"class":432},"        PayURL: ",[273,3408,3409],{"class":283},"\"https:\u002F\u002Fexample.com\u002Fbilling\u002FINV-0042\"",[273,3411,3167],{"class":432},[273,3413,3414],{"class":275,"line":2159},[273,3415,1935],{"class":432},[273,3417,3418],{"class":275,"line":2170},[273,3419,1990],{"class":432},[211,3421,3422,3425,3426,3428,3429,3432,3433,238,3436,3439],{},[215,3423,3424],{},"lttr.NewSample"," keeps the data's Go type, so the sample compiles against ",[215,3427,1817],{},", exactly as ",[215,3430,3431],{},"MustCompile[Data]"," does. A set can hold samples of different data types, and the same set feeds ",[215,3434,3435],{},"lint.Check",[215,3437,3438],{},"lint.Golden"," and your own previews.",[211,3441,3442,3445,3446,3449],{},[215,3443,3444],{},"tutorial_test.go"," is in the same package. It starts with its imports and the ",[215,3447,3448],{},"-update"," flag the golden test reads:",[244,3451,3454],{"className":1707,"code":3452,"filename":3453,"language":1710,"meta":250,"style":250},"package tutorial\n\nimport (\n    \"flag\"\n    \"io\u002Ffs\"\n    \"net\u002Fmail\"\n    \"strings\"\n    \"testing\"\n    \"testing\u002Ffstest\"\n\n    \"github.com\u002Fsulv-io\u002Flttr\"\n    \"github.com\u002Fsulv-io\u002Flttr\u002Flint\"\n)\n\nvar update = flag.Bool(\"update\", false, \"rewrite the golden files in testdata\u002F\")\n","tutorial\u002Ftutorial_test.go#L1-L15",[215,3455,3456,3462,3466,3472,3481,3489,3497,3506,3515,3524,3528,3536,3545,3549,3553],{"__ignoreMap":250},[273,3457,3458,3460],{"class":275,"line":276},[273,3459,1718],{"class":1717},[273,3461,1721],{"class":279},[273,3463,3464],{"class":275,"line":462},[273,3465,1727],{"emptyLinePlaceholder":1726},[273,3467,3468,3470],{"class":275,"line":624},[273,3469,1732],{"class":1717},[273,3471,1735],{"class":432},[273,3473,3474,3476,3479],{"class":275,"line":630},[273,3475,1740],{"class":283},[273,3477,3478],{"class":279},"flag",[273,3480,1746],{"class":283},[273,3482,3483,3485,3487],{"class":275,"line":636},[273,3484,1740],{"class":283},[273,3486,1762],{"class":279},[273,3488,1746],{"class":283},[273,3490,3491,3493,3495],{"class":275,"line":642},[273,3492,1740],{"class":283},[273,3494,1703],{"class":279},[273,3496,1746],{"class":283},[273,3498,3499,3501,3504],{"class":275,"line":648},[273,3500,1740],{"class":283},[273,3502,3503],{"class":279},"strings",[273,3505,1746],{"class":283},[273,3507,3508,3510,3513],{"class":275,"line":654},[273,3509,1740],{"class":283},[273,3511,3512],{"class":279},"testing",[273,3514,1746],{"class":283},[273,3516,3517,3519,3522],{"class":275,"line":660},[273,3518,1740],{"class":283},[273,3520,3521],{"class":279},"testing\u002Ffstest",[273,3523,1746],{"class":283},[273,3525,3526],{"class":275,"line":666},[273,3527,1727],{"emptyLinePlaceholder":1726},[273,3529,3530,3532,3534],{"class":275,"line":861},[273,3531,1740],{"class":283},[273,3533,1792],{"class":279},[273,3535,1746],{"class":283},[273,3537,3538,3540,3543],{"class":275,"line":1382},[273,3539,1740],{"class":283},[273,3541,3542],{"class":279},"github.com\u002Fsulv-io\u002Flttr\u002Flint",[273,3544,1746],{"class":283},[273,3546,3547],{"class":275,"line":1442},[273,3548,1808],{"class":432},[273,3550,3551],{"class":275,"line":1493},[273,3552,1727],{"emptyLinePlaceholder":1726},[273,3554,3555,3557,3560,3562,3565,3568,3570,3573,3575,3578,3580,3583],{"class":275,"line":1503},[273,3556,2230],{"class":1717},[273,3558,3559],{"class":432}," update ",[273,3561,1016],{"class":1717},[273,3563,3564],{"class":432}," flag.",[273,3566,3567],{"class":1876},"Bool",[273,3569,525],{"class":432},[273,3571,3572],{"class":283},"\"update\"",[273,3574,238],{"class":432},[273,3576,3577],{"class":290},"false",[273,3579,238],{"class":432},[273,3581,3582],{"class":283},"\"rewrite the golden files in testdata\u002F\"",[273,3584,1808],{"class":432},[211,3586,3587,3589,3590,3592],{},[215,3588,3542],{}," is lttr's HTML lint, the check ",[215,3591,533],{}," runs. It is a public package, so your own module imports it the same way.",[211,3594,3595,3597,3598,1615],{},[215,3596,3435],{}," compiles and renders every sample in a set, lints each HTML part, and returns every problem with its position, as ",[215,3599,3600],{},"file:line:col: message",[244,3602,3605],{"className":1707,"code":3603,"filename":3604,"language":1710,"meta":250,"style":250},"\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","tutorial\u002Ftutorial_test.go#L17-L23",[215,3606,3607,3612,3617,3641,3673,3687,3691],{"__ignoreMap":250},[273,3608,3609],{"class":275,"line":276},[273,3610,3611],{"class":458},"\u002F\u002F TestCheck runs lint.Check over the tutorial's sample set (Set): the\n",[273,3613,3614],{"class":275,"line":462},[273,3615,3616],{"class":458},"\u002F\u002F invoice, with its typed data, compiles, renders and lints clean.\n",[273,3618,3619,3621,3624,3626,3629,3632,3634,3636,3639],{"class":275,"line":624},[273,3620,1860],{"class":1717},[273,3622,3623],{"class":1876}," TestCheck",[273,3625,525],{"class":432},[273,3627,3628],{"class":1866},"t",[273,3630,3631],{"class":1717}," *",[273,3633,3512],{"class":279},[273,3635,394],{"class":432},[273,3637,3638],{"class":279},"T",[273,3640,2395],{"class":432},[273,3642,3643,3646,3649,3651,3654,3657,3660,3663,3666,3668,3670],{"class":275,"line":630},[273,3644,3645],{"class":1717},"    for",[273,3647,3648],{"class":432}," _, p ",[273,3650,1894],{"class":1717},[273,3652,3653],{"class":1717}," range",[273,3655,3656],{"class":432}," lint.",[273,3658,3659],{"class":1876},"Failures",[273,3661,3662],{"class":432},"(lint.",[273,3664,3665],{"class":1876},"Check",[273,3667,525],{"class":432},[273,3669,3049],{"class":1876},[273,3671,3672],{"class":432},"())) {\n",[273,3674,3675,3678,3681,3684],{"class":275,"line":636},[273,3676,3677],{"class":432},"        t.",[273,3679,3680],{"class":1876},"Error",[273,3682,3683],{"class":432},"(p) ",[273,3685,3686],{"class":458},"\u002F\u002F file:line:col: message\n",[273,3688,3689],{"class":275,"line":642},[273,3690,1935],{"class":432},[273,3692,3693],{"class":275,"line":648},[273,3694,1990],{"class":432},[211,3696,3697,3698,3700,3701,325,3704,3707,3708,325,3711,3714,3715,3717],{},"A golden test pins the output. ",[215,3699,3438],{}," renders each sample and compares its HTML and text with ",[215,3702,3703],{},"testdata\u002F\u003Ctemplate name>.html",[215,3705,3706],{},".txt",", here ",[215,3709,3710],{},"testdata\u002Finvoice.html",[215,3712,3713],{},"testdata\u002Finvoice.txt",". With ",[215,3716,3448],{}," it writes them instead, so any change to the kit or the template shows up as a diff you review:",[244,3719,3722],{"className":1707,"code":3720,"filename":3721,"language":1710,"meta":250,"style":250},"\u002F\u002F TestGolden compares the render of each sample in Set with its golden\n\u002F\u002F files, testdata\u002Finvoice.html and .txt. After a change to the kit or the\n\u002F\u002F template, run\n\u002F\u002F\n\u002F\u002F  go test .\u002Fexamples\u002Ftutorial -run Golden -update\n\u002F\u002F\n\u002F\u002F and review the diff: every changed line is a change recipients see.\nfunc TestGolden(t *testing.T) {\n    lint.Golden(t, Set(), \"testdata\", *update)\n}\n","tutorial\u002Ftutorial_test.go#L44-L53",[215,3723,3724,3729,3734,3739,3743,3748,3752,3757,3778,3803],{"__ignoreMap":250},[273,3725,3726],{"class":275,"line":276},[273,3727,3728],{"class":458},"\u002F\u002F TestGolden compares the render of each sample in Set with its golden\n",[273,3730,3731],{"class":275,"line":462},[273,3732,3733],{"class":458},"\u002F\u002F files, testdata\u002Finvoice.html and .txt. After a change to the kit or the\n",[273,3735,3736],{"class":275,"line":624},[273,3737,3738],{"class":458},"\u002F\u002F template, run\n",[273,3740,3741],{"class":275,"line":630},[273,3742,2220],{"class":458},[273,3744,3745],{"class":275,"line":636},[273,3746,3747],{"class":458},"\u002F\u002F  go test .\u002Fexamples\u002Ftutorial -run Golden -update\n",[273,3749,3750],{"class":275,"line":642},[273,3751,2220],{"class":458},[273,3753,3754],{"class":275,"line":648},[273,3755,3756],{"class":458},"\u002F\u002F and review the diff: every changed line is a change recipients see.\n",[273,3758,3759,3761,3764,3766,3768,3770,3772,3774,3776],{"class":275,"line":654},[273,3760,1860],{"class":1717},[273,3762,3763],{"class":1876}," TestGolden",[273,3765,525],{"class":432},[273,3767,3628],{"class":1866},[273,3769,3631],{"class":1717},[273,3771,3512],{"class":279},[273,3773,394],{"class":432},[273,3775,3638],{"class":279},[273,3777,2395],{"class":432},[273,3779,3780,3783,3786,3789,3791,3793,3796,3798,3800],{"class":275,"line":660},[273,3781,3782],{"class":432},"    lint.",[273,3784,3785],{"class":1876},"Golden",[273,3787,3788],{"class":432},"(t, ",[273,3790,3049],{"class":1876},[273,3792,2954],{"class":432},[273,3794,3795],{"class":283},"\"testdata\"",[273,3797,238],{"class":432},[273,3799,2379],{"class":1717},[273,3801,3802],{"class":432},"update)\n",[273,3804,3805],{"class":275,"line":666},[273,3806,1990],{"class":432},[211,3808,3809],{},"A render that differs from its golden fails with a line diff:",[244,3811,3814],{"className":3812,"code":3813,"filename":302,"language":249,"meta":250},[247],"--- FAIL: TestGolden (0.00s)\n    --- FAIL: TestGolden\u002Finvoice (0.00s)\n        tutorial_test.go:52: invoice.md: the render differs from testdata\u002Finvoice.txt; run with -update and review the diff:\n            --- testdata\u002Finvoice.txt\n            +++ render\n            @@ -10,1 +10,1 @@\n            -Extra seats x2 .................. $27.00\n            +Extra seats x3 .................. $27.00\n",[215,3815,3813],{"__ignoreMap":250},[211,3817,3818],{},"The text golden is the plain-text part a recipient sees:",[244,3820,3824],{"className":3821,"code":3822,"filename":3823,"language":249,"meta":250},[247],"Example\n\nYOUR INVOICE\n\nHi Ada, here is invoice INV-0042 for September.\n\nINVOICE INV-0042\n\nTeam plan, September x1 ......... $49.00\nExtra seats x3 .................. $27.00\nTotal ........................... $76.00\n\nPlease pay by 9 October to keep your plan active.\n\nPay $76.00:\nhttps:\u002F\u002Fexample.com\u002Fbilling\u002FINV-0042\n\n--\nQuestions about this invoice? Reply to this email.\n\nExample Inc. · 100 Main Street, Springfield\n","tutorial\u002Ftestdata\u002Finvoice.txt",[215,3825,3822],{"__ignoreMap":250},[211,3827,3828],{},"In the lttr repository, the tutorial's tests run like this:",[244,3830,3832],{"className":266,"code":3831,"filename":268,"language":269,"meta":250,"style":250},"go test -v -run 'Check|Samples|Golden|Typo' .\u002Fexamples\u002Ftutorial\u002F\n",[215,3833,3834],{"__ignoreMap":250},[273,3835,3836,3838,3841,3844,3847,3850],{"class":275,"line":276},[273,3837,1710],{"class":279},[273,3839,3840],{"class":283}," test",[273,3842,3843],{"class":290}," -v",[273,3845,3846],{"class":290}," -run",[273,3848,3849],{"class":283}," 'Check|Samples|Golden|Typo'",[273,3851,3852],{"class":283}," .\u002Fexamples\u002Ftutorial\u002F\n",[244,3854,3857],{"className":3855,"code":3856,"filename":302,"language":249,"meta":250},[247],"=== RUN   TestCheck\n--- PASS: TestCheck (0.00s)\n=== RUN   TestSamples\n--- PASS: TestSamples (0.01s)\n=== RUN   TestGolden\n=== RUN   TestGolden\u002Finvoice\n--- PASS: TestGolden (0.00s)\n    --- PASS: TestGolden\u002Finvoice (0.00s)\n=== RUN   TestTypo\n--- PASS: TestTypo (0.00s)\n=== RUN   TestCheckTypo\n--- PASS: TestCheckTypo (0.00s)\nPASS\nok      github.com\u002Fsulv-io\u002Flttr\u002Fexamples\u002Ftutorial   0.030s\n",[215,3858,3856],{"__ignoreMap":250},[211,3860,3861,3864,3865,3867,3868,325,3870,3872,3873,3876,3877,3879,3880,3883,3884,3886,3887,3890,3891,3894,3895,3897,3898,3900,3901,394],{},[215,3862,3863],{},"TestSamples"," runs ",[215,3866,3435],{}," over the samples Plain came with, built from ",[215,3869,386],{},[215,3871,390],{}," by ",[215,3874,3875],{},"lttr.KitSamples",": the check ",[215,3878,533],{}," would run if the kit loaded without Go types. ",[215,3881,3882],{},"TestCheckTypo"," misspells a merge tag and checks that ",[215,3885,3435],{}," reports it at ",[215,3888,3889],{},"invoice.md:18",", with ",[215,3892,3893],{},"(did you mean pay_url?)",". Copy all of them into your own module. Before the ",[215,3896,903],{}," line goes in, ",[215,3899,533],{}," does the same from the command line. See ",[220,3902,159],{"href":160},[254,3904,3906],{"id":3905},"preview-it-from-go","Preview it from Go",[211,3908,3909,3910,3913,3914,3917,3918,3921,3922,3925,3926,3928],{},"The studio can't load the kit from the CLI any more either. Run it from Go instead, with the ",[215,3911,3912],{},"studio"," package and the same sample set. ",[215,3915,3916],{},"examples\u002Ftutorial\u002Fcmd\u002Femaildev"," is the whole program: it serves ",[215,3919,3920],{},"tutorial.Set()",", and reloads the kit (with ",[215,3923,3924],{},"tutorial.LoadKit",", which registers ",[215,3927,796],{},") and the template from disk.",[244,3930,3932],{"className":266,"code":3931,"filename":268,"language":269,"meta":250,"style":250},"$ go run .\u002Fexamples\u002Ftutorial\u002Fcmd\u002Femaildev\nlttr studio: serving tutorial (1 sample) on http:\u002F\u002Flocalhost:7070\n",[215,3933,3934,3947],{"__ignoreMap":250},[273,3935,3936,3938,3941,3944],{"class":275,"line":276},[273,3937,1956],{"class":279},[273,3939,3940],{"class":283}," go",[273,3942,3943],{"class":283}," run",[273,3945,3946],{"class":283}," .\u002Fexamples\u002Ftutorial\u002Fcmd\u002Femaildev\n",[273,3948,3949,3951,3954,3957,3959,3962,3965],{"class":275,"line":462},[273,3950,280],{"class":279},[273,3952,3953],{"class":283}," studio:",[273,3955,3956],{"class":283}," serving",[273,3958,294],{"class":283},[273,3960,3961],{"class":432}," (1 ",[273,3963,3964],{"class":283},"sample",[273,3966,3967],{"class":432},") on http:\u002F\u002Flocalhost:7070\n",[211,3969,3970,3971,3974,3975,394],{},"Edits to the kit and to ",[215,3972,3973],{},"templates\u002Finvoice.md"," reload live; a change to the Go types or the sample data needs a restart. See ",[220,3976,3978],{"href":3977},"\u002Ftooling\u002Fstudio#run-it-for-your-own-go-types","Run it for your own Go types",[254,3980,3982],{"id":3981},"catch-a-typo","Catch a typo",[211,3984,3985,3986,3988,3989,2712,3992,3995,3996,3998,3999,1615],{},"Change ",[215,3987,1536],{}," on line 13 of ",[215,3990,3991],{},"html.tmpl",[215,3993,3994],{},".Bind.invoice.Totl",". The kit no longer loads, and because ",[215,3997,2943],{}," runs at init, nothing in the package does. Here the package is a module called ",[215,4000,4001],{},"example.com\u002Ftutorial",[244,4003,4005],{"className":266,"code":4004,"filename":268,"language":269,"meta":250,"style":250},"go test .\n",[215,4006,4007],{"__ignoreMap":250},[273,4008,4009,4011,4013],{"class":275,"line":276},[273,4010,1710],{"class":279},[273,4012,3840],{"class":283},[273,4014,4015],{"class":283}," .\n",[244,4017,4020],{"className":4018,"code":4019,"filename":302,"language":249,"meta":250},[247],"panic: components\u002Finvoice\u002Fhtml.tmpl:13:243: Invoice has no field or method \"Totl\"\n\ngoroutine 1 [running]:\nexample.com\u002Ftutorial.MustKit()\n    \u002Ftmp\u002Ftutorial\u002Ftutorial.go:83 +0x48\nexample.com\u002Ftutorial.init()\n    \u002Ftmp\u002Ftutorial\u002Ftutorial.go:95 +0xb8\nFAIL    example.com\u002Ftutorial    0.016s\nFAIL\n",[215,4021,4019],{"__ignoreMap":250},[211,4023,4024,4025,4028],{},"The error names the kit file, the line and the byte column of the typo, and the Go type that has no such field. The column is large because the total row is one long line of email HTML. The mistake never reaches a render, let alone a recipient. ",[215,4026,4027],{},"TestTypo"," pins this exact message, so the check can't quietly stop working:",[244,4030,4033],{"className":1707,"code":4031,"filename":4032,"language":1710,"meta":250,"style":250},"\u002F\u002F TestTypo: a misspelt field on a bound type fails kit.Load, with the\n\u002F\u002F position of the typo in the kit file.\nfunc TestTypo(t *testing.T) {\n    overlay := fstest.MapFS{}\n    err := fs.WalkDir(Files(), \".\", func(path string, d fs.DirEntry, err error) error {\n        if err != nil || d.IsDir() {\n            return err\n        }\n        b, err := fs.ReadFile(Files(), path)\n        if err != nil {\n            return err\n        }\n        overlay[path] = &fstest.MapFile{Data: b}\n        return nil\n    })\n    if err != nil {\n        t.Fatal(err)\n    }\n    const tmpl = \"components\u002Finvoice\u002Fhtml.tmpl\"\n    src := string(overlay[tmpl].Data)\n    if !strings.Contains(src, \".Bind.invoice.Total\") {\n        t.Fatalf(\"%s no longer shows .Bind.invoice.Total\", tmpl)\n    }\n    overlay[tmpl].Data = []byte(strings.Replace(src, \".Bind.invoice.Total\", \".Bind.invoice.Totl\", 1))\n\n    _, err = load(overlay)\n    const want = `components\u002Finvoice\u002Fhtml.tmpl:13:243: Invoice has no field or method \"Totl\"`\n    if err == nil || err.Error() != want {\n        t.Errorf(\"load error = %v\\nwant %s\", err, want)\n    }\n}\n","tutorial\u002Ftutorial_test.go#L55-L85",[215,4034,4035,4040,4045,4066,4084,4143,4166,4174,4179,4198,4210,4216,4220,4240,4248,4253,4265,4274,4278,4292,4304,4325,4344,4348,4383,4387,4399,4411,4436,4461,4465],{"__ignoreMap":250},[273,4036,4037],{"class":275,"line":276},[273,4038,4039],{"class":458},"\u002F\u002F TestTypo: a misspelt field on a bound type fails kit.Load, with the\n",[273,4041,4042],{"class":275,"line":462},[273,4043,4044],{"class":458},"\u002F\u002F position of the typo in the kit file.\n",[273,4046,4047,4049,4052,4054,4056,4058,4060,4062,4064],{"class":275,"line":624},[273,4048,1860],{"class":1717},[273,4050,4051],{"class":1876}," TestTypo",[273,4053,525],{"class":432},[273,4055,3628],{"class":1866},[273,4057,3631],{"class":1717},[273,4059,3512],{"class":279},[273,4061,394],{"class":432},[273,4063,3638],{"class":279},[273,4065,2395],{"class":432},[273,4067,4068,4071,4073,4076,4078,4081],{"class":275,"line":630},[273,4069,4070],{"class":432},"    overlay ",[273,4072,1894],{"class":1717},[273,4074,4075],{"class":279}," fstest",[273,4077,394],{"class":432},[273,4079,4080],{"class":279},"MapFS",[273,4082,4083],{"class":432},"{}\n",[273,4085,4086,4089,4091,4093,4096,4098,4100,4102,4105,4107,4109,4111,4114,4117,4119,4122,4124,4126,4129,4131,4134,4137,4139,4141],{"class":275,"line":636},[273,4087,4088],{"class":432},"    err ",[273,4090,1894],{"class":1717},[273,4092,2278],{"class":432},[273,4094,4095],{"class":1876},"WalkDir",[273,4097,525],{"class":432},[273,4099,2545],{"class":1876},[273,4101,2954],{"class":432},[273,4103,4104],{"class":283},"\".\"",[273,4106,238],{"class":432},[273,4108,1860],{"class":1717},[273,4110,525],{"class":432},[273,4112,4113],{"class":1866},"path",[273,4115,4116],{"class":1717}," string",[273,4118,238],{"class":432},[273,4120,4121],{"class":1866},"d",[273,4123,2369],{"class":279},[273,4125,394],{"class":432},[273,4127,4128],{"class":279},"DirEntry",[273,4130,238],{"class":432},[273,4132,4133],{"class":1866},"err",[273,4135,4136],{"class":1717}," error",[273,4138,1873],{"class":432},[273,4140,2392],{"class":1717},[273,4142,1886],{"class":432},[273,4144,4145,4148,4150,4152,4154,4157,4160,4163],{"class":275,"line":642},[273,4146,4147],{"class":1717},"        if",[273,4149,2296],{"class":432},[273,4151,2299],{"class":1717},[273,4153,2302],{"class":290},[273,4155,4156],{"class":1717}," ||",[273,4158,4159],{"class":432}," d.",[273,4161,4162],{"class":1876},"IsDir",[273,4164,4165],{"class":432},"() {\n",[273,4167,4168,4171],{"class":275,"line":648},[273,4169,4170],{"class":1717},"            return",[273,4172,4173],{"class":432}," err\n",[273,4175,4176],{"class":275,"line":654},[273,4177,4178],{"class":432},"        }\n",[273,4180,4181,4184,4186,4188,4191,4193,4195],{"class":275,"line":660},[273,4182,4183],{"class":432},"        b, err ",[273,4185,1894],{"class":1717},[273,4187,2278],{"class":432},[273,4189,4190],{"class":1876},"ReadFile",[273,4192,525],{"class":432},[273,4194,2545],{"class":1876},[273,4196,4197],{"class":432},"(), path)\n",[273,4199,4200,4202,4204,4206,4208],{"class":275,"line":666},[273,4201,4147],{"class":1717},[273,4203,2296],{"class":432},[273,4205,2299],{"class":1717},[273,4207,2302],{"class":290},[273,4209,1886],{"class":432},[273,4211,4212,4214],{"class":275,"line":861},[273,4213,4170],{"class":1717},[273,4215,4173],{"class":432},[273,4217,4218],{"class":275,"line":1382},[273,4219,4178],{"class":432},[273,4221,4222,4225,4227,4229,4232,4234,4237],{"class":275,"line":1442},[273,4223,4224],{"class":432},"        overlay[path] ",[273,4226,1016],{"class":1717},[273,4228,3109],{"class":1717},[273,4230,4231],{"class":279},"fstest",[273,4233,394],{"class":432},[273,4235,4236],{"class":279},"MapFile",[273,4238,4239],{"class":432},"{Data: b}\n",[273,4241,4242,4245],{"class":275,"line":1493},[273,4243,4244],{"class":1717},"        return",[273,4246,4247],{"class":290}," nil\n",[273,4249,4250],{"class":275,"line":1503},[273,4251,4252],{"class":432},"    })\n",[273,4254,4255,4257,4259,4261,4263],{"class":275,"line":2014},[273,4256,1902],{"class":1717},[273,4258,2296],{"class":432},[273,4260,2299],{"class":1717},[273,4262,2302],{"class":290},[273,4264,1886],{"class":432},[273,4266,4267,4269,4272],{"class":275,"line":2023},[273,4268,3677],{"class":432},[273,4270,4271],{"class":1876},"Fatal",[273,4273,2661],{"class":432},[273,4275,4276],{"class":275,"line":2032},[273,4277,1935],{"class":432},[273,4279,4280,4283,4286,4289],{"class":275,"line":2043},[273,4281,4282],{"class":1717},"    const",[273,4284,4285],{"class":290}," tmpl",[273,4287,4288],{"class":1717}," =",[273,4290,4291],{"class":283}," \"components\u002Finvoice\u002Fhtml.tmpl\"\n",[273,4293,4294,4297,4299,4301],{"class":275,"line":2048},[273,4295,4296],{"class":432},"    src ",[273,4298,1894],{"class":1717},[273,4300,4116],{"class":1717},[273,4302,4303],{"class":432},"(overlay[tmpl].Data)\n",[273,4305,4306,4308,4311,4314,4317,4320,4323],{"class":275,"line":2053},[273,4307,1902],{"class":1717},[273,4309,4310],{"class":1717}," !",[273,4312,4313],{"class":432},"strings.",[273,4315,4316],{"class":1876},"Contains",[273,4318,4319],{"class":432},"(src, ",[273,4321,4322],{"class":283},"\".Bind.invoice.Total\"",[273,4324,2395],{"class":432},[273,4326,4327,4329,4332,4334,4336,4338,4341],{"class":275,"line":2059},[273,4328,3677],{"class":432},[273,4330,4331],{"class":1876},"Fatalf",[273,4333,525],{"class":432},[273,4335,591],{"class":283},[273,4337,1953],{"class":1299},[273,4339,4340],{"class":283}," no longer shows .Bind.invoice.Total\"",[273,4342,4343],{"class":432},", tmpl)\n",[273,4345,4346],{"class":275,"line":2065},[273,4347,1935],{"class":432},[273,4349,4350,4353,4355,4358,4361,4364,4367,4369,4371,4373,4376,4378,4380],{"class":275,"line":2077},[273,4351,4352],{"class":432},"    overlay[tmpl].Data ",[273,4354,1016],{"class":1717},[273,4356,4357],{"class":432}," []",[273,4359,4360],{"class":1717},"byte",[273,4362,4363],{"class":432},"(strings.",[273,4365,4366],{"class":1876},"Replace",[273,4368,4319],{"class":432},[273,4370,4322],{"class":283},[273,4372,238],{"class":432},[273,4374,4375],{"class":283},"\".Bind.invoice.Totl\"",[273,4377,238],{"class":432},[273,4379,3346],{"class":290},[273,4381,4382],{"class":432},"))\n",[273,4384,4385],{"class":275,"line":2085},[273,4386,1727],{"emptyLinePlaceholder":1726},[273,4388,4389,4392,4394,4396],{"class":275,"line":2094},[273,4390,4391],{"class":432},"    _, err ",[273,4393,1016],{"class":1717},[273,4395,2451],{"class":1876},[273,4397,4398],{"class":432},"(overlay)\n",[273,4400,4401,4403,4406,4408],{"class":275,"line":2103},[273,4402,4282],{"class":1717},[273,4404,4405],{"class":290}," want",[273,4407,4288],{"class":1717},[273,4409,4410],{"class":283}," `components\u002Finvoice\u002Fhtml.tmpl:13:243: Invoice has no field or method \"Totl\"`\n",[273,4412,4413,4415,4417,4420,4422,4424,4427,4429,4431,4433],{"class":275,"line":2108},[273,4414,1902],{"class":1717},[273,4416,2296],{"class":432},[273,4418,4419],{"class":1717},"==",[273,4421,2302],{"class":290},[273,4423,4156],{"class":1717},[273,4425,4426],{"class":432}," err.",[273,4428,3680],{"class":1876},[273,4430,1880],{"class":432},[273,4432,2299],{"class":1717},[273,4434,4435],{"class":432}," want {\n",[273,4437,4438,4440,4443,4445,4448,4451,4454,4456,4458],{"class":275,"line":2113},[273,4439,3677],{"class":432},[273,4441,4442],{"class":1876},"Errorf",[273,4444,525],{"class":432},[273,4446,4447],{"class":283},"\"load error = ",[273,4449,4450],{"class":1299},"%v\\n",[273,4452,4453],{"class":283},"want ",[273,4455,1953],{"class":1299},[273,4457,591],{"class":283},[273,4459,4460],{"class":432},", err, want)\n",[273,4462,4463],{"class":275,"line":2119},[273,4464,1935],{"class":432},[273,4466,4467],{"class":275,"line":2125},[273,4468,1990],{"class":432},[211,4470,4471,4472,4475,4476,4479,4480,4482,4483,4485],{},"It copies the kit into an in-memory ",[215,4473,4474],{},"fstest.MapFS",", breaks one field and loads the copy with the same ",[215,4477,4478],{},"load"," function the package uses. See ",[220,4481,92],{"href":93}," for everything ",[215,4484,2684],{}," checks.",[254,4487,4489],{"id":4488},"send-it","Send it",[211,4491,4492],{},"The package is ready to use from any program. This one renders the invoice for Ada and prints the envelope and the text part:",[244,4494,4497],{"className":1707,"code":4495,"filename":4496,"language":1710,"meta":250,"style":250},"package main\n\nimport (\n    \"fmt\"\n    \"log\"\n    \"net\u002Fmail\"\n\n    \"github.com\u002Fsulv-io\u002Flttr\"\n    \"github.com\u002Fsulv-io\u002Flttr\u002Fexamples\u002Ftutorial\"\n)\n\nfunc main() {\n    r, err := lttr.NewRenderer(lttr.Config{\n        Kit: tutorial.MustKit(), \u002F\u002F the kit the invoice template was compiled against\n        Profiles: []lttr.Profile{{\n            Name: \"billing\",\n            From: mail.Address{Name: \"Example Billing\", Address: \"billing@example.com\"},\n        }},\n    })\n    if err != nil {\n        log.Fatal(err)\n    }\n\n    m, err := tutorial.Template().Render(r,\n        lttr.Recipient{Address: \"ada@example.com\", Name: \"Ada\"},\n        tutorial.Data{\n            Invoice: tutorial.Invoice{\n                Number: \"INV-0042\",\n                Lines: []tutorial.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    if err != nil {\n        log.Fatal(err)\n    }\n    fmt.Printf(\"%s → %s: %s\\n\\n\", m.From.Address, m.To.Address, m.Subject)\n    fmt.Print(m.Text)\n}\n","main.go",[215,4498,4499,4506,4510,4516,4524,4533,4541,4545,4553,4562,4566,4570,4579,4601,4613,4626,4635,4656,4661,4665,4677,4686,4690,4694,4715,4734,4745,4758,4767,4780,4797,4813,4818,4827,4831,4840,4849,4854,4866,4874,4878,4907,4917],{"__ignoreMap":250},[273,4500,4501,4503],{"class":275,"line":276},[273,4502,1718],{"class":1717},[273,4504,4505],{"class":279}," main\n",[273,4507,4508],{"class":275,"line":462},[273,4509,1727],{"emptyLinePlaceholder":1726},[273,4511,4512,4514],{"class":275,"line":624},[273,4513,1732],{"class":1717},[273,4515,1735],{"class":432},[273,4517,4518,4520,4522],{"class":275,"line":630},[273,4519,1740],{"class":283},[273,4521,1753],{"class":279},[273,4523,1746],{"class":283},[273,4525,4526,4528,4531],{"class":275,"line":636},[273,4527,1740],{"class":283},[273,4529,4530],{"class":279},"log",[273,4532,1746],{"class":283},[273,4534,4535,4537,4539],{"class":275,"line":642},[273,4536,1740],{"class":283},[273,4538,1703],{"class":279},[273,4540,1746],{"class":283},[273,4542,4543],{"class":275,"line":648},[273,4544,1727],{"emptyLinePlaceholder":1726},[273,4546,4547,4549,4551],{"class":275,"line":654},[273,4548,1740],{"class":283},[273,4550,1792],{"class":279},[273,4552,1746],{"class":283},[273,4554,4555,4557,4560],{"class":275,"line":660},[273,4556,1740],{"class":283},[273,4558,4559],{"class":279},"github.com\u002Fsulv-io\u002Flttr\u002Fexamples\u002Ftutorial",[273,4561,1746],{"class":283},[273,4563,4564],{"class":275,"line":666},[273,4565,1808],{"class":432},[273,4567,4568],{"class":275,"line":861},[273,4569,1727],{"emptyLinePlaceholder":1726},[273,4571,4572,4574,4577],{"class":275,"line":1382},[273,4573,1860],{"class":1717},[273,4575,4576],{"class":1876}," main",[273,4578,4165],{"class":432},[273,4580,4581,4584,4586,4588,4591,4593,4595,4597,4599],{"class":275,"line":1442},[273,4582,4583],{"class":432},"    r, err ",[273,4585,1894],{"class":1717},[273,4587,2940],{"class":432},[273,4589,4590],{"class":1876},"NewRenderer",[273,4592,525],{"class":432},[273,4594,280],{"class":279},[273,4596,394],{"class":432},[273,4598,3045],{"class":279},[273,4600,3118],{"class":432},[273,4602,4603,4606,4608,4610],{"class":275,"line":1493},[273,4604,4605],{"class":432},"        Kit: tutorial.",[273,4607,2707],{"class":1876},[273,4609,2954],{"class":432},[273,4611,4612],{"class":458},"\u002F\u002F the kit the invoice template was compiled against\n",[273,4614,4615,4618,4620,4622,4624],{"class":275,"line":1503},[273,4616,4617],{"class":432},"        Profiles: []",[273,4619,280],{"class":279},[273,4621,394],{"class":432},[273,4623,3153],{"class":279},[273,4625,3156],{"class":432},[273,4627,4628,4631,4633],{"class":275,"line":2014},[273,4629,4630],{"class":432},"            Name: ",[273,4632,3164],{"class":283},[273,4634,3167],{"class":432},[273,4636,4637,4640,4642,4644,4646,4648,4650,4652,4654],{"class":275,"line":2023},[273,4638,4639],{"class":432},"            From: ",[273,4641,3175],{"class":279},[273,4643,394],{"class":432},[273,4645,3180],{"class":279},[273,4647,3183],{"class":432},[273,4649,3186],{"class":283},[273,4651,3189],{"class":432},[273,4653,3192],{"class":283},[273,4655,3195],{"class":432},[273,4657,4658],{"class":275,"line":2032},[273,4659,4660],{"class":432},"        }},\n",[273,4662,4663],{"class":275,"line":2043},[273,4664,4252],{"class":432},[273,4666,4667,4669,4671,4673,4675],{"class":275,"line":2048},[273,4668,1902],{"class":1717},[273,4670,2296],{"class":432},[273,4672,2299],{"class":1717},[273,4674,2302],{"class":290},[273,4676,1886],{"class":432},[273,4678,4679,4682,4684],{"class":275,"line":2053},[273,4680,4681],{"class":432},"        log.",[273,4683,4271],{"class":1876},[273,4685,2661],{"class":432},[273,4687,4688],{"class":275,"line":2059},[273,4689,1935],{"class":432},[273,4691,4692],{"class":275,"line":2065},[273,4693,1727],{"emptyLinePlaceholder":1726},[273,4695,4696,4699,4701,4704,4706,4709,4712],{"class":275,"line":2077},[273,4697,4698],{"class":432},"    m, err ",[273,4700,1894],{"class":1717},[273,4702,4703],{"class":432}," tutorial.",[273,4705,2987],{"class":1876},[273,4707,4708],{"class":432},"().",[273,4710,4711],{"class":1876},"Render",[273,4713,4714],{"class":432},"(r,\n",[273,4716,4717,4720,4722,4724,4726,4728,4730,4732],{"class":275,"line":2085},[273,4718,4719],{"class":279},"        lttr",[273,4721,394],{"class":432},[273,4723,3247],{"class":279},[273,4725,3250],{"class":432},[273,4727,3253],{"class":283},[273,4729,3256],{"class":432},[273,4731,3259],{"class":283},[273,4733,3195],{"class":432},[273,4735,4736,4739,4741,4743],{"class":275,"line":2094},[273,4737,4738],{"class":279},"        tutorial",[273,4740,394],{"class":432},[273,4742,1817],{"class":279},[273,4744,3118],{"class":432},[273,4746,4747,4750,4752,4754,4756],{"class":275,"line":2103},[273,4748,4749],{"class":432},"            Invoice: ",[273,4751,217],{"class":279},[273,4753,394],{"class":432},[273,4755,796],{"class":279},[273,4757,3118],{"class":432},[273,4759,4760,4763,4765],{"class":275,"line":2108},[273,4761,4762],{"class":432},"                Number: ",[273,4764,3321],{"class":283},[273,4766,3167],{"class":432},[273,4768,4769,4772,4774,4776,4778],{"class":275,"line":2113},[273,4770,4771],{"class":432},"                Lines: []",[273,4773,217],{"class":279},[273,4775,394],{"class":432},[273,4777,1543],{"class":279},[273,4779,3118],{"class":432},[273,4781,4782,4785,4787,4789,4791,4793,4795],{"class":275,"line":2119},[273,4783,4784],{"class":432},"                    {Name: ",[273,4786,3340],{"class":283},[273,4788,3343],{"class":432},[273,4790,3346],{"class":290},[273,4792,3349],{"class":432},[273,4794,3352],{"class":290},[273,4796,3195],{"class":432},[273,4798,4799,4801,4803,4805,4807,4809,4811],{"class":275,"line":2125},[273,4800,4784],{"class":432},[273,4802,3361],{"class":283},[273,4804,3343],{"class":432},[273,4806,3366],{"class":290},[273,4808,3349],{"class":432},[273,4810,3371],{"class":290},[273,4812,3195],{"class":432},[273,4814,4815],{"class":275,"line":2137},[273,4816,4817],{"class":432},"                },\n",[273,4819,4820,4823,4825],{"class":275,"line":2148},[273,4821,4822],{"class":432},"                Total: ",[273,4824,2195],{"class":290},[273,4826,3167],{"class":432},[273,4828,4829],{"class":275,"line":2159},[273,4830,3378],{"class":432},[273,4832,4833,4836,4838],{"class":275,"line":2170},[273,4834,4835],{"class":432},"            Due:    ",[273,4837,3399],{"class":283},[273,4839,3167],{"class":432},[273,4841,4842,4845,4847],{"class":275,"line":2610},[273,4843,4844],{"class":432},"            PayURL: ",[273,4846,3409],{"class":283},[273,4848,3167],{"class":432},[273,4850,4851],{"class":275,"line":2630},[273,4852,4853],{"class":432},"        })\n",[273,4855,4856,4858,4860,4862,4864],{"class":275,"line":2643},[273,4857,1902],{"class":1717},[273,4859,2296],{"class":432},[273,4861,2299],{"class":1717},[273,4863,2302],{"class":290},[273,4865,1886],{"class":432},[273,4867,4868,4870,4872],{"class":275,"line":2656},[273,4869,4681],{"class":432},[273,4871,4271],{"class":1876},[273,4873,2661],{"class":432},[273,4875,4876],{"class":275,"line":2664},[273,4877,1935],{"class":432},[273,4879,4880,4883,4886,4888,4890,4892,4895,4897,4899,4902,4904],{"class":275,"line":2669},[273,4881,4882],{"class":432},"    fmt.",[273,4884,4885],{"class":1876},"Printf",[273,4887,525],{"class":432},[273,4889,591],{"class":283},[273,4891,1953],{"class":1299},[273,4893,4894],{"class":283}," → ",[273,4896,1953],{"class":1299},[273,4898,439],{"class":283},[273,4900,4901],{"class":1299},"%s\\n\\n",[273,4903,591],{"class":283},[273,4905,4906],{"class":432},", m.From.Address, m.To.Address, m.Subject)\n",[273,4908,4909,4911,4914],{"class":275,"line":2677},[273,4910,4882],{"class":432},[273,4912,4913],{"class":1876},"Print",[273,4915,4916],{"class":432},"(m.Text)\n",[273,4918,4920],{"class":275,"line":4919},43,[273,4921,1990],{"class":432},[244,4923,4926],{"className":4924,"code":4925,"filename":302,"language":249,"meta":250},[247],"billing@example.com → ada@example.com: Invoice INV-0042\n\nExample\n\nYOUR INVOICE\n\nHi Ada, here is invoice INV-0042 for September.\n\nINVOICE INV-0042\n\nTeam plan, September x1 ......... $49.00\nExtra seats x3 .................. $27.00\nTotal ........................... $76.00\n\nPlease pay by 9 October to keep your plan active.\n\nPay $76.00:\nhttps:\u002F\u002Fexample.com\u002Fbilling\u002FINV-0042\n\n--\nQuestions about this invoice? Reply to this email.\n\nExample Inc. · 100 Main Street, Springfield\n",[215,4927,4925],{"__ignoreMap":250},[211,4929,4930,4931,1863,4934,4937,4938,4940,4941,394],{},"\"Example\" and \"Example Inc. · 100 Main Street, Springfield\" are Plain's kit vars, which the tutorial kit kept. Set your own per renderer with ",[215,4932,4933],{},"Config.Vars",[215,4935,4936],{},"{\"brand\": …, \"company\": …, \"address\": …}","), or change their defaults in ",[215,4939,79],{},". To deliver the message, see ",[220,4942,128],{"href":129},[254,4944,4946],{"id":4945},"next-steps","Next steps",[1107,4948,4949,4961],{},[4950,4951,4952],"thead",{},[1003,4953,4954,4958],{},[4955,4956,4957],"th",{},"To",[4955,4959,4960],{},"Read",[4962,4963,4964,4976,4985,4994,5003],"tbody",{},[1003,4965,4966,4972],{},[1009,4967,4968,4969,4971],{},"Learn every ",[215,4970,79],{}," key",[1009,4973,4974],{},[220,4975,79],{"href":80},[1003,4977,4978,4981],{},[1009,4979,4980],{},"Give a component attributes, content rules or children",[1009,4982,4983],{},[220,4984,84],{"href":85},[1003,4986,4987,4990],{},[1009,4988,4989],{},"Use the view fields and core functions in templates",[1009,4991,4992],{},[220,4993,88],{"href":89},[1003,4995,4996,4999],{},[1009,4997,4998],{},"Keep the HTML working in Outlook and Gmail",[1009,5000,5001],{},[220,5002,102],{"href":103},[1003,5004,5005,5008],{},[1009,5006,5007],{},"See a complete kit with 24 components",[1009,5009,5010],{},[220,5011,175],{"href":176},[511,5013,5014],{},"html pre.shiki code .sSlKG, html code.shiki .sSlKG{--shiki-light:#702C00;--shiki-default:#702C00;--shiki-dark:#B392F0}html pre.shiki code .sRBGO, html code.shiki .sRBGO{--shiki-light:#032563;--shiki-default:#032563;--shiki-dark:#9ECBFF}html pre.shiki code .sTl1q, html code.shiki .sTl1q{--shiki-light:#023B95;--shiki-default:#023B95;--shiki-dark:#79B8FF}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 .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 .sBq4M, html code.shiki .sBq4M{--shiki-light:#66707B;--shiki-default:#66707B;--shiki-dark:#6A737D}html pre.shiki code .sQJpg, html code.shiki .sQJpg{--shiki-light:#023B95;--shiki-default:#023B95;--shiki-dark:#B392F0}html pre.shiki code .s-oVe, html code.shiki .s-oVe{--shiki-light:#6E011A;--shiki-light-font-style:italic;--shiki-default:#6E011A;--shiki-default-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic}html pre.shiki code .sFaxo, html code.shiki .sFaxo{--shiki-light:#A0111F;--shiki-default:#A0111F;--shiki-dark:#79B8FF}html pre.shiki code .s1Q0q, html code.shiki .s1Q0q{--shiki-light:#A0111F;--shiki-default:#A0111F;--shiki-dark:#F97583}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 .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}html pre.shiki code .s1qwZ, html code.shiki .s1qwZ{--shiki-light:#6E011A;--shiki-default:#6E011A;--shiki-dark:#FDAEB7}",{"title":250,"searchDepth":462,"depth":462,"links":5016},[5017,5018,5019,5020,5021,5022,5023,5024,5025,5026,5027],{"id":256,"depth":462,"text":257},{"id":397,"depth":462,"text":398},{"id":672,"depth":462,"text":673},{"id":726,"depth":462,"text":727},{"id":1602,"depth":462,"text":954},{"id":2720,"depth":462,"text":2721},{"id":3034,"depth":462,"text":3035},{"id":3905,"depth":462,"text":3906},{"id":3981,"depth":462,"text":3982},{"id":4488,"depth":462,"text":4489},{"id":4945,"depth":462,"text":4946},"Start from Plain with lttr kit init, change its tokens, add a component that binds a Go type, write a template for it and test the lot from Go.","md",null,{},{"icon":173},{"title":170,"description":5028},"OcLwq1m_KQQIOGxtXT5c5qp164aOb5yOVwkRKmOzFdw",[5036,5038],{"title":159,"path":160,"stem":161,"description":5037,"icon":162,"children":-1},"make golden and reviewing its diffs, sample sets, the lint package, make check, fuzzing, the coverage floor, and testing your own kit's templates.",{"title":175,"path":176,"stem":177,"description":5039,"icon":178,"children":-1},"The design lttr started with, as a kit — its 24 components, spacing rules, brand vars and profile-driven footers, and Loam, the nine example emails built on it.",1790467460985]