[{"data":1,"prerenderedAt":2799},["ShallowReactive",2],{"navigation_docs":3,"-authoring-merge-tags-and-data":205,"-authoring-merge-tags-and-data-surround":2794},[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":53,"body":207,"description":2787,"extension":2788,"links":2789,"meta":2790,"navigation":2791,"path":54,"seo":2792,"stem":55,"__hash__":2793},"docs\u002F2.authoring\u002F4.merge-tags-and-data.md",{"type":208,"value":209,"toc":2774},"minimark",[210,231,1125,1134,1161,1166,1181,1229,1233,1236,1307,1320,1327,1404,1407,1410,1425,1441,1492,1495,1499,1506,1540,1550,1557,1561,1568,1576,1579,1597,1608,1612,1622,2193,2199,2202,2266,2276,2280,2286,2301,2336,2343,2347,2358,2426,2450,2553,2564,2589,2611,2615,2625,2640,2670,2674,2696,2729,2735,2750,2754,2770],[211,212,213,214,218,219,222,223,226,227,230],"p",{},"A template is compiled against one data type, its ",[215,216,217],"code",{},"T",". With a struct, every ",[215,220,221],{},"{{path}}"," merge tag and every ",[215,224,225],{},":key=\"path\""," binding is resolved against that type when you call ",[215,228,229],{},"lttr.Compile",", so a typo is a compile error with a line and column, not a blank in a sent email. Rendering then follows precompiled accessors and never parses a path.",[232,233,239],"pre",{"className":234,"code":235,"filename":236,"language":237,"meta":238,"style":238},"language-go shiki shiki-themes github-light-high-contrast github-light-high-contrast github-dark","package main\n\nimport (\n    \"fmt\"\n    \"log\"\n    \"net\u002Fmail\"\n\n    \"github.com\u002Fsulv-io\u002Flttr\"\n    \"github.com\u002Fsulv-io\u002Flttr\u002Fkits\u002Fplain\"\n)\n\n\u002F\u002F Cents prints as dollars: a fmt.Stringer is a scalar.\ntype Cents int64\n\nfunc (c Cents) String() string { return fmt.Sprintf(\"$%d.%02d\", c\u002F100, c%100) }\n\ntype Courier struct {\n    FirstName string `json:\"first_name\"`\n    Phone     string \u002F\u002F no json tag: matched as \"phone\"\n}\n\ntype Links struct {\n    TrackURL string `json:\"track_url\"`\n}\n\ntype OrderShipped struct {\n    Links                     \u002F\u002F embedded: {{track_url}} is promoted\n    OrderID string            `json:\"order_id\"`\n    Courier *Courier          `json:\"courier\"` \u002F\u002F nil means \"no value\"\n    Total   Cents             `json:\"total\"`\n    Labels  map[string]string `json:\"labels\"`\n}\n\nconst src = `---\ntemplate: order.shipped\nprofile: orders\nsubject: \"Order {{order_id}} is on its way\"\npreheader: \"{{labels.eta | Arriving soon}}.\"\n---\n\n# On its way\n\nHi {{name | there}}, {{courier.first_name | your courier}} is bringing it.\nCall them on {{courier.phone | the number in the app}}.\n\nOrder total: {{total}}.\n\n::button{href=\"{{track_url}}\" label=\"Track delivery\"}\n::\n`\n\nvar orderShipped = lttr.MustCompile[OrderShipped](plain.MustKit(), \"order.shipped\", []byte(src))\n\nfunc main() {\n    for _, tag := range orderShipped.Meta().Tags {\n        fmt.Printf(\"%-18s %-12s %s\\n\", tag.Path, tag.Type, tag.Pos)\n    }\n\n    r, err := lttr.NewRenderer(lttr.Config{\n        Kit:      plain.MustKit(),\n        Profiles: []lttr.Profile{{Name: \"orders\", From: mail.Address{Name: \"Example\", Address: \"orders@example.com\"}}},\n    })\n    if err != nil {\n        log.Fatal(err)\n    }\n    msg, err := orderShipped.Render(r, lttr.Recipient{Address: \"kim@example.com\"}, OrderShipped{\n        Links:   Links{TrackURL: \"https:\u002F\u002Fexample.com\u002Forders\u002FA-1042\"},\n        OrderID: \"A-1042\",\n        Total:   4250,\n    })\n    if err != nil {\n        log.Fatal(err)\n    }\n    fmt.Println()\n    fmt.Println(msg.Preheader)\n    fmt.Print(msg.Text)\n}\n","main.go","go","",[215,240,241,254,261,271,284,294,304,309,319,329,335,340,347,359,364,444,449,463,474,485,491,496,508,519,524,529,541,550,561,579,590,612,617,622,637,643,649,655,661,667,672,678,683,689,695,700,706,711,717,723,729,734,778,783,794,818,845,851,856,882,893,938,944,961,973,978,1014,1032,1044,1055,1060,1073,1082,1087,1099,1109,1120],{"__ignoreMap":238},[242,243,246,250],"span",{"class":244,"line":245},"line",1,[242,247,249],{"class":248},"s1Q0q","package",[242,251,253],{"class":252},"sSlKG"," main\n",[242,255,257],{"class":244,"line":256},2,[242,258,260],{"emptyLinePlaceholder":259},true,"\n",[242,262,264,267],{"class":244,"line":263},3,[242,265,266],{"class":248},"import",[242,268,270],{"class":269},"sihDN"," (\n",[242,272,274,278,281],{"class":244,"line":273},4,[242,275,277],{"class":276},"sRBGO","    \"",[242,279,280],{"class":252},"fmt",[242,282,283],{"class":276},"\"\n",[242,285,287,289,292],{"class":244,"line":286},5,[242,288,277],{"class":276},[242,290,291],{"class":252},"log",[242,293,283],{"class":276},[242,295,297,299,302],{"class":244,"line":296},6,[242,298,277],{"class":276},[242,300,301],{"class":252},"net\u002Fmail",[242,303,283],{"class":276},[242,305,307],{"class":244,"line":306},7,[242,308,260],{"emptyLinePlaceholder":259},[242,310,312,314,317],{"class":244,"line":311},8,[242,313,277],{"class":276},[242,315,316],{"class":252},"github.com\u002Fsulv-io\u002Flttr",[242,318,283],{"class":276},[242,320,322,324,327],{"class":244,"line":321},9,[242,323,277],{"class":276},[242,325,326],{"class":252},"github.com\u002Fsulv-io\u002Flttr\u002Fkits\u002Fplain",[242,328,283],{"class":276},[242,330,332],{"class":244,"line":331},10,[242,333,334],{"class":269},")\n",[242,336,338],{"class":244,"line":337},11,[242,339,260],{"emptyLinePlaceholder":259},[242,341,343],{"class":244,"line":342},12,[242,344,346],{"class":345},"sBq4M","\u002F\u002F Cents prints as dollars: a fmt.Stringer is a scalar.\n",[242,348,350,353,356],{"class":244,"line":349},13,[242,351,352],{"class":248},"type",[242,354,355],{"class":252}," Cents",[242,357,358],{"class":248}," int64\n",[242,360,362],{"class":244,"line":361},14,[242,363,260],{"emptyLinePlaceholder":259},[242,365,367,370,373,377,380,383,387,390,393,396,399,402,405,408,411,415,418,421,424,427,430,434,436,439,441],{"class":244,"line":366},15,[242,368,369],{"class":248},"func",[242,371,372],{"class":269}," (",[242,374,376],{"class":375},"s-BBy","c ",[242,378,379],{"class":252},"Cents",[242,381,382],{"class":269},") ",[242,384,386],{"class":385},"sPmw6","String",[242,388,389],{"class":269},"() ",[242,391,392],{"class":248},"string",[242,394,395],{"class":269}," { ",[242,397,398],{"class":248},"return",[242,400,401],{"class":269}," fmt.",[242,403,404],{"class":385},"Sprintf",[242,406,407],{"class":269},"(",[242,409,410],{"class":276},"\"$",[242,412,414],{"class":413},"sFaxo","%d",[242,416,417],{"class":276},".",[242,419,420],{"class":413},"%02d",[242,422,423],{"class":276},"\"",[242,425,426],{"class":269},", c",[242,428,429],{"class":248},"\u002F",[242,431,433],{"class":432},"sTl1q","100",[242,435,426],{"class":269},[242,437,438],{"class":248},"%",[242,440,433],{"class":432},[242,442,443],{"class":269},") }\n",[242,445,447],{"class":244,"line":446},16,[242,448,260],{"emptyLinePlaceholder":259},[242,450,452,454,457,460],{"class":244,"line":451},17,[242,453,352],{"class":248},[242,455,456],{"class":252}," Courier",[242,458,459],{"class":248}," struct",[242,461,462],{"class":269}," {\n",[242,464,466,469,471],{"class":244,"line":465},18,[242,467,468],{"class":269},"    FirstName ",[242,470,392],{"class":248},[242,472,473],{"class":276}," `json:\"first_name\"`\n",[242,475,477,480,482],{"class":244,"line":476},19,[242,478,479],{"class":269},"    Phone     ",[242,481,392],{"class":248},[242,483,484],{"class":345}," \u002F\u002F no json tag: matched as \"phone\"\n",[242,486,488],{"class":244,"line":487},20,[242,489,490],{"class":269},"}\n",[242,492,494],{"class":244,"line":493},21,[242,495,260],{"emptyLinePlaceholder":259},[242,497,499,501,504,506],{"class":244,"line":498},22,[242,500,352],{"class":248},[242,502,503],{"class":252}," Links",[242,505,459],{"class":248},[242,507,462],{"class":269},[242,509,511,514,516],{"class":244,"line":510},23,[242,512,513],{"class":269},"    TrackURL ",[242,515,392],{"class":248},[242,517,518],{"class":276}," `json:\"track_url\"`\n",[242,520,522],{"class":244,"line":521},24,[242,523,490],{"class":269},[242,525,527],{"class":244,"line":526},25,[242,528,260],{"emptyLinePlaceholder":259},[242,530,532,534,537,539],{"class":244,"line":531},26,[242,533,352],{"class":248},[242,535,536],{"class":252}," OrderShipped",[242,538,459],{"class":248},[242,540,462],{"class":269},[242,542,544,547],{"class":244,"line":543},27,[242,545,546],{"class":252},"    Links",[242,548,549],{"class":345},"                     \u002F\u002F embedded: {{track_url}} is promoted\n",[242,551,553,556,558],{"class":244,"line":552},28,[242,554,555],{"class":269},"    OrderID ",[242,557,392],{"class":248},[242,559,560],{"class":276},"            `json:\"order_id\"`\n",[242,562,564,567,570,573,576],{"class":244,"line":563},29,[242,565,566],{"class":269},"    Courier ",[242,568,569],{"class":248},"*",[242,571,572],{"class":252},"Courier",[242,574,575],{"class":276},"          `json:\"courier\"`",[242,577,578],{"class":345}," \u002F\u002F nil means \"no value\"\n",[242,580,582,585,587],{"class":244,"line":581},30,[242,583,584],{"class":269},"    Total   ",[242,586,379],{"class":252},[242,588,589],{"class":276},"             `json:\"total\"`\n",[242,591,593,596,599,602,604,607,609],{"class":244,"line":592},31,[242,594,595],{"class":269},"    Labels  ",[242,597,598],{"class":248},"map",[242,600,601],{"class":269},"[",[242,603,392],{"class":248},[242,605,606],{"class":269},"]",[242,608,392],{"class":248},[242,610,611],{"class":276}," `json:\"labels\"`\n",[242,613,615],{"class":244,"line":614},32,[242,616,490],{"class":269},[242,618,620],{"class":244,"line":619},33,[242,621,260],{"emptyLinePlaceholder":259},[242,623,625,628,631,634],{"class":244,"line":624},34,[242,626,627],{"class":248},"const",[242,629,630],{"class":432}," src",[242,632,633],{"class":248}," =",[242,635,636],{"class":276}," `---\n",[242,638,640],{"class":244,"line":639},35,[242,641,642],{"class":276},"template: order.shipped\n",[242,644,646],{"class":244,"line":645},36,[242,647,648],{"class":276},"profile: orders\n",[242,650,652],{"class":244,"line":651},37,[242,653,654],{"class":276},"subject: \"Order {{order_id}} is on its way\"\n",[242,656,658],{"class":244,"line":657},38,[242,659,660],{"class":276},"preheader: \"{{labels.eta | Arriving soon}}.\"\n",[242,662,664],{"class":244,"line":663},39,[242,665,666],{"class":276},"---\n",[242,668,670],{"class":244,"line":669},40,[242,671,260],{"emptyLinePlaceholder":259},[242,673,675],{"class":244,"line":674},41,[242,676,677],{"class":276},"# On its way\n",[242,679,681],{"class":244,"line":680},42,[242,682,260],{"emptyLinePlaceholder":259},[242,684,686],{"class":244,"line":685},43,[242,687,688],{"class":276},"Hi {{name | there}}, {{courier.first_name | your courier}} is bringing it.\n",[242,690,692],{"class":244,"line":691},44,[242,693,694],{"class":276},"Call them on {{courier.phone | the number in the app}}.\n",[242,696,698],{"class":244,"line":697},45,[242,699,260],{"emptyLinePlaceholder":259},[242,701,703],{"class":244,"line":702},46,[242,704,705],{"class":276},"Order total: {{total}}.\n",[242,707,709],{"class":244,"line":708},47,[242,710,260],{"emptyLinePlaceholder":259},[242,712,714],{"class":244,"line":713},48,[242,715,716],{"class":276},"::button{href=\"{{track_url}}\" label=\"Track delivery\"}\n",[242,718,720],{"class":244,"line":719},49,[242,721,722],{"class":276},"::\n",[242,724,726],{"class":244,"line":725},50,[242,727,728],{"class":276},"`\n",[242,730,732],{"class":244,"line":731},51,[242,733,260],{"emptyLinePlaceholder":259},[242,735,737,740,743,746,749,752,754,757,760,763,766,769,772,775],{"class":244,"line":736},52,[242,738,739],{"class":248},"var",[242,741,742],{"class":269}," orderShipped ",[242,744,745],{"class":248},"=",[242,747,748],{"class":269}," lttr.",[242,750,751],{"class":385},"MustCompile",[242,753,601],{"class":269},[242,755,756],{"class":252},"OrderShipped",[242,758,759],{"class":269},"](plain.",[242,761,762],{"class":385},"MustKit",[242,764,765],{"class":269},"(), ",[242,767,768],{"class":276},"\"order.shipped\"",[242,770,771],{"class":269},", []",[242,773,774],{"class":248},"byte",[242,776,777],{"class":269},"(src))\n",[242,779,781],{"class":244,"line":780},53,[242,782,260],{"emptyLinePlaceholder":259},[242,784,786,788,791],{"class":244,"line":785},54,[242,787,369],{"class":248},[242,789,790],{"class":385}," main",[242,792,793],{"class":269},"() {\n",[242,795,797,800,803,806,809,812,815],{"class":244,"line":796},55,[242,798,799],{"class":248},"    for",[242,801,802],{"class":269}," _, tag ",[242,804,805],{"class":248},":=",[242,807,808],{"class":248}," range",[242,810,811],{"class":269}," orderShipped.",[242,813,814],{"class":385},"Meta",[242,816,817],{"class":269},"().Tags {\n",[242,819,821,824,827,829,831,834,837,840,842],{"class":244,"line":820},56,[242,822,823],{"class":269},"        fmt.",[242,825,826],{"class":385},"Printf",[242,828,407],{"class":269},[242,830,423],{"class":276},[242,832,833],{"class":413},"%-18s",[242,835,836],{"class":413}," %-12s",[242,838,839],{"class":413}," %s\\n",[242,841,423],{"class":276},[242,843,844],{"class":269},", tag.Path, tag.Type, tag.Pos)\n",[242,846,848],{"class":244,"line":847},57,[242,849,850],{"class":269},"    }\n",[242,852,854],{"class":244,"line":853},58,[242,855,260],{"emptyLinePlaceholder":259},[242,857,859,862,864,866,869,871,874,876,879],{"class":244,"line":858},59,[242,860,861],{"class":269},"    r, err ",[242,863,805],{"class":248},[242,865,748],{"class":269},[242,867,868],{"class":385},"NewRenderer",[242,870,407],{"class":269},[242,872,873],{"class":252},"lttr",[242,875,417],{"class":269},[242,877,878],{"class":252},"Config",[242,880,881],{"class":269},"{\n",[242,883,885,888,890],{"class":244,"line":884},60,[242,886,887],{"class":269},"        Kit:      plain.",[242,889,762],{"class":385},[242,891,892],{"class":269},"(),\n",[242,894,896,899,901,903,906,909,912,915,918,920,923,926,929,932,935],{"class":244,"line":895},61,[242,897,898],{"class":269},"        Profiles: []",[242,900,873],{"class":252},[242,902,417],{"class":269},[242,904,905],{"class":252},"Profile",[242,907,908],{"class":269},"{{Name: ",[242,910,911],{"class":276},"\"orders\"",[242,913,914],{"class":269},", From: ",[242,916,917],{"class":252},"mail",[242,919,417],{"class":269},[242,921,922],{"class":252},"Address",[242,924,925],{"class":269},"{Name: ",[242,927,928],{"class":276},"\"Example\"",[242,930,931],{"class":269},", Address: ",[242,933,934],{"class":276},"\"orders@example.com\"",[242,936,937],{"class":269},"}}},\n",[242,939,941],{"class":244,"line":940},62,[242,942,943],{"class":269},"    })\n",[242,945,947,950,953,956,959],{"class":244,"line":946},63,[242,948,949],{"class":248},"    if",[242,951,952],{"class":269}," err ",[242,954,955],{"class":248},"!=",[242,957,958],{"class":432}," nil",[242,960,462],{"class":269},[242,962,964,967,970],{"class":244,"line":963},64,[242,965,966],{"class":269},"        log.",[242,968,969],{"class":385},"Fatal",[242,971,972],{"class":269},"(err)\n",[242,974,976],{"class":244,"line":975},65,[242,977,850],{"class":269},[242,979,981,984,986,988,991,994,996,998,1001,1004,1007,1010,1012],{"class":244,"line":980},66,[242,982,983],{"class":269},"    msg, err ",[242,985,805],{"class":248},[242,987,811],{"class":269},[242,989,990],{"class":385},"Render",[242,992,993],{"class":269},"(r, ",[242,995,873],{"class":252},[242,997,417],{"class":269},[242,999,1000],{"class":252},"Recipient",[242,1002,1003],{"class":269},"{Address: ",[242,1005,1006],{"class":276},"\"kim@example.com\"",[242,1008,1009],{"class":269},"}, ",[242,1011,756],{"class":252},[242,1013,881],{"class":269},[242,1015,1017,1020,1023,1026,1029],{"class":244,"line":1016},67,[242,1018,1019],{"class":269},"        Links:   ",[242,1021,1022],{"class":252},"Links",[242,1024,1025],{"class":269},"{TrackURL: ",[242,1027,1028],{"class":276},"\"https:\u002F\u002Fexample.com\u002Forders\u002FA-1042\"",[242,1030,1031],{"class":269},"},\n",[242,1033,1035,1038,1041],{"class":244,"line":1034},68,[242,1036,1037],{"class":269},"        OrderID: ",[242,1039,1040],{"class":276},"\"A-1042\"",[242,1042,1043],{"class":269},",\n",[242,1045,1047,1050,1053],{"class":244,"line":1046},69,[242,1048,1049],{"class":269},"        Total:   ",[242,1051,1052],{"class":432},"4250",[242,1054,1043],{"class":269},[242,1056,1058],{"class":244,"line":1057},70,[242,1059,943],{"class":269},[242,1061,1063,1065,1067,1069,1071],{"class":244,"line":1062},71,[242,1064,949],{"class":248},[242,1066,952],{"class":269},[242,1068,955],{"class":248},[242,1070,958],{"class":432},[242,1072,462],{"class":269},[242,1074,1076,1078,1080],{"class":244,"line":1075},72,[242,1077,966],{"class":269},[242,1079,969],{"class":385},[242,1081,972],{"class":269},[242,1083,1085],{"class":244,"line":1084},73,[242,1086,850],{"class":269},[242,1088,1090,1093,1096],{"class":244,"line":1089},74,[242,1091,1092],{"class":269},"    fmt.",[242,1094,1095],{"class":385},"Println",[242,1097,1098],{"class":269},"()\n",[242,1100,1102,1104,1106],{"class":244,"line":1101},75,[242,1103,1092],{"class":269},[242,1105,1095],{"class":385},[242,1107,1108],{"class":269},"(msg.Preheader)\n",[242,1110,1112,1114,1117],{"class":244,"line":1111},76,[242,1113,1092],{"class":269},[242,1115,1116],{"class":385},"Print",[242,1118,1119],{"class":269},"(msg.Text)\n",[242,1121,1123],{"class":244,"line":1122},77,[242,1124,490],{"class":269},[232,1126,1132],{"className":1127,"code":1129,"filename":1130,"language":1131,"meta":238},[1128],"language-text","order_id           string       4:17\nlabels.eta         string       5:13\nname               string       10:4\ncourier.first_name string       10:22\ncourier.phone      string       11:14\ntotal              main.Cents   13:14\ntrack_url          string       15:16\n\nArriving soon.\nExample\n\nON ITS WAY\n\nHi there, your courier is bringing it. Call them on the number in the\napp.\n\nOrder total: $42.50.\n\nTrack delivery:\nhttps:\u002F\u002Fexample.com\u002Forders\u002FA-1042\n","Output","text",[215,1133,1129],{"__ignoreMap":238},[211,1135,1136,1139,1140,1143,1144,1146,1147,1152,1153,1156,1157,1160],{},[215,1137,1138],{},"Template.Meta().Tags"," lists every tag and binding with the Go type it resolved to. ",[215,1141,1142],{},"name"," is not a field of ",[215,1145,756],{},", so it resolved to the recipient's name — see ",[1148,1149,1151],"a",{"href":1150},"#search-data-then-the-recipient","Search data, then the recipient",". The recipient here has no name, the courier is ",[215,1154,1155],{},"nil"," and there is no ",[215,1158,1159],{},"eta"," label, so all three fallbacks were used.",[1162,1163,1165],"h2",{"id":1164},"write-a-merge-tag","Write a merge tag",[211,1167,1168,1169,1171,1172,1175,1176,1180],{},"A merge tag is ",[215,1170,221],{}," or ",[215,1173,1174],{},"{{path | fallback}}",". The full grammar is in ",[1148,1177,1179],{"href":1178},"\u002Fauthoring\u002Fcomark-syntax#insert-merge-tags","Insert merge tags",". In short:",[1182,1183,1184,1191,1206,1220],"ul",{},[1185,1186,1187,1188,417],"li",{},"A path is lower-case segments joined by dots: ",[215,1189,1190],{},"[a-z_][a-z0-9_]*",[1185,1192,1193,1194,1197,1198,1201,1202,1205],{},"The fallback is bare text, or ",[215,1195,1196],{},"\"quoted\""," when it holds ",[215,1199,1200],{},"|",", ",[215,1203,1204],{},"}"," or leading spaces. It is literal text: it can't hold another tag.",[1185,1207,1208,1211,1212,1215,1216,1219],{},[215,1209,1210],{},"\\{{"," is a literal ",[215,1213,1214],{},"{{",", and ",[215,1217,1218],{},"\\|"," is the separator to use inside a GFM table cell.",[1185,1221,1222,1223,1225,1226,417],{},"Anything that starts with ",[215,1224,1214],{}," but isn't a valid tag stays literal text, with the warning ",[215,1227,1228],{},"malformed merge tag \"{{ Name }}\"",[1162,1230,1232],{"id":1231},"name-a-path","Name a path",[211,1234,1235],{},"With typed data, each segment of a path selects:",[1182,1237,1238,1257,1277,1290],{},[1185,1239,1240,1244,1245,1248,1249,1252,1253,1256],{},[1241,1242,1243],"strong",{},"a struct field by its JSON name."," A field tagged ",[215,1246,1247],{},"`json:\"order_id\"`"," is ",[215,1250,1251],{},"order_id",". Options after the comma (",[215,1254,1255],{},",omitempty",") are ignored.",[1185,1258,1259,1262,1263,1248,1266,1215,1269,1272,1273,1276],{},[1241,1260,1261],{},"a struct field by its lower-cased name"," when it has no JSON name. ",[215,1264,1265],{},"Phone",[215,1267,1268],{},"phone",[215,1270,1271],{},"TrackURL"," without a tag would be ",[215,1274,1275],{},"trackurl",". Give fields JSON tags to choose readable names.",[1185,1278,1279,1282,1283,1286,1287,1289],{},[1241,1280,1281],{},"a promoted field"," of an embedded struct, as Go promotes it: ",[215,1284,1285],{},"track_url"," above comes from the embedded ",[215,1288,1022],{},". Embedded pointers to structs are followed too.",[1185,1291,1292,1295,1296,1299,1300,1303,1304,417],{},[1241,1293,1294],{},"a map key"," in a ",[215,1297,1298],{},"map[string]V",": ",[215,1301,1302],{},"labels.eta"," reads ",[215,1305,1306],{},"Labels[\"eta\"]",[211,1308,1309,1310,1313,1314,1316,1317,1319],{},"Pointers are followed at every step. Unexported fields and fields tagged ",[215,1311,1312],{},"`json:\"-\"`"," never match. A tag reads fields and map keys, never methods: a type's ",[215,1315,386],{}," method is how it prints, not something a path can name. (Kit templates can call methods on bound values; see ",[1148,1318,92],{"href":93},".)",[211,1321,1322,1323,1326],{},"A path that doesn't resolve is a compile error at the tag. These come from ",[215,1324,1325],{},"lttr lint"," on a copy of a Quiet example:",[1328,1329,1330,1343],"table",{},[1331,1332,1333],"thead",{},[1334,1335,1336,1340],"tr",{},[1337,1338,1339],"th",{},"Error",[1337,1341,1342],{},"Cause",[1344,1345,1346,1357,1367,1377,1391],"tbody",{},[1334,1347,1348,1354],{},[1349,1350,1351],"td",{},[215,1352,1353],{},"unknown name \"otp_cod\" (did you mean otp_code?)",[1349,1355,1356],{},"The first segment is not a field of your type or of the recipient. A close match is suggested.",[1334,1358,1359,1364],{},[1349,1360,1361],{},[215,1362,1363],{},"unknown field \"nme\" in quiet.Courier (did you mean courier.name?)",[1349,1365,1366],{},"A later segment is not a field of that struct. The suggestion is the whole corrected path.",[1334,1368,1369,1374],{},[1349,1370,1371],{},[215,1372,1373],{},"cannot descend into string at \"courier.rating\"",[1349,1375,1376],{},"A path continues past a scalar, a slice or a map with non-string keys.",[1334,1378,1379,1384],{},[1349,1380,1381],{},[215,1382,1383],{},"ambiguous field \"name\" in main.T",[1349,1385,1386,1387,1390],{},"Two embedded structs promote a field with the same name at the same depth. Go rejects the same selector; unlike ",[215,1388,1389],{},"encoding\u002Fjson",", a JSON tag on one of them does not break the tie.",[1334,1392,1393,1398],{},[1349,1394,1395],{},[215,1396,1397],{},"invalid path \"Order\" (did you mean order?)",[1349,1399,1400,1401,1319],{},"A binding path that is not lower-case segments. (A tag with such a path is not a tag at all, just a malformed-tag warning, ",[215,1402,1403],{},"malformed merge tag \"{{Order}}\" (did you mean order?)",[1162,1405,1151],{"id":1406},"search-data-then-the-recipient",[211,1408,1409],{},"The first segment of a path is looked up in two places, in order:",[1411,1412,1413,1419],"ol",{},[1185,1414,1415,1416,1418],{},"your data type ",[215,1417,217],{},",",[1185,1420,1421,1424],{},[215,1422,1423],{},"lttr.Recipient",", the person the email goes to.",[211,1426,1427,1428,1431,1432,1434,1435,1437,1438,1440],{},"The first match wins. So ",[215,1429,1430],{},"{{name}}"," is the recipient's name unless ",[215,1433,217],{}," has a ",[215,1436,1142],{}," field of its own. A ",[215,1439,1000],{}," has three fields (D39):",[1328,1442,1443,1453],{},[1331,1444,1445],{},[1334,1446,1447,1450],{},[1337,1448,1449],{},"Path",[1337,1451,1452],{},"Field",[1344,1454,1455,1467,1479],{},[1334,1456,1457,1462],{},[1349,1458,1459],{},[215,1460,1461],{},"address",[1349,1463,1464,1466],{},[215,1465,922],{},", the recipient's email address",[1334,1468,1469,1473],{},[1349,1470,1471],{},[215,1472,1142],{},[1349,1474,1475,1478],{},[215,1476,1477],{},"Name",", the display name",[1334,1480,1481,1486],{},[1349,1482,1483],{},[215,1484,1485],{},"unsubscribe_url",[1349,1487,1488,1491],{},[215,1489,1490],{},"UnsubscribeURL",", the one-click unsubscribe URL",[211,1493,1494],{},"Anything else your email shows per recipient, such as a first name or a region, belongs in your data type.",[1162,1496,1498],{"id":1497},"print-only-scalars","Print only scalars",[211,1500,1501,1502,1505],{},"A merge tag prints one value, so with typed data its path must end at a ",[1241,1503,1504],{},"scalar",":",[1182,1507,1508,1514,1527],{},[1185,1509,1510,1511,1513],{},"a string kind (",[215,1512,392],{}," or a named string type),",[1185,1515,1516,1517,1201,1520,1201,1523,1526],{},"an integer kind (",[215,1518,1519],{},"int",[215,1521,1522],{},"int64",[215,1524,1525],{},"uint8","…),",[1185,1528,1529,1530,1533,1534,1536,1537,417],{},"any type implementing ",[215,1531,1532],{},"fmt.Stringer"," with a value receiver, such as ",[215,1535,379],{}," above or Quiet's ",[215,1538,1539],{},"quiet.Money",[211,1541,1542,1543,1546,1547,1549],{},"Floats, bools, structs that aren't Stringers, slices and maps are not scalars. A tag that ends at one is a compile error naming the type: ",[215,1544,1545],{},"{{courier}} is quiet.Courier, not a scalar",". Format such values in Go, as a ",[215,1548,392],{}," field or a Stringer type, before they reach the template.",[211,1551,1552,1553,1556],{},"A value is printed with its ",[215,1554,1555],{},"String()"," method, as the string itself, or as a decimal integer.",[1162,1558,1560],{"id":1559},"give-a-fallback","Give a fallback",[211,1562,1563,1564,1567],{},"At render time, a tag has ",[1241,1565,1566],{},"no value"," when:",[1182,1569,1570,1573],{},[1185,1571,1572],{},"a nil pointer or a missing map key is on its path, or",[1185,1574,1575],{},"the value prints as the empty string.",[211,1577,1578],{},"Then its fallback is used:",[232,1580,1585],{"className":1581,"code":1582,"filename":1583,"language":1584,"meta":238,"style":238},"language-markdown shiki shiki-themes github-light-high-contrast github-light-high-contrast github-dark","Hi {{name | there}},\nYour courier is {{courier.first_name | \"on the way\"}}.\n","templates\u002Forder.md","markdown",[215,1586,1587,1592],{"__ignoreMap":238},[242,1588,1589],{"class":244,"line":245},[242,1590,1591],{"class":269},"Hi {{name | there}},\n",[242,1593,1594],{"class":244,"line":256},[242,1595,1596],{"class":269},"Your courier is {{courier.first_name | \"on the way\"}}.\n",[211,1598,1599,1600,1603,1604,1607],{},"A tag with no value and no fallback is a render error, with the tag's position: ",[215,1601,1602],{},"order.shipped:11:12: no value for {{deliver_to.city}}",". The ",[215,1605,1606],{},"preheader"," is the exception: a tag there with no value renders as nothing.",[1162,1609,1611],{"id":1610},"use-untyped-data","Use untyped data",[211,1613,1614,1617,1618,1621],{},[215,1615,1616],{},"Compile"," also takes ",[215,1619,1620],{},"map[string]any",", or any map with string keys, for data that has no Go type: a JSON payload, or a kit's YAML samples. Nothing is known about the data when the template compiles, so only the syntax and the kit's rules are checked then. Each path is read at render time instead (D50):",[232,1623,1625],{"className":234,"code":1624,"filename":236,"language":237,"meta":238,"style":238},"package main\n\nimport (\n    \"encoding\u002Fjson\"\n    \"fmt\"\n    \"log\"\n    \"net\u002Fmail\"\n    \"strings\"\n\n    \"github.com\u002Fsulv-io\u002Flttr\"\n    \"github.com\u002Fsulv-io\u002Flttr\u002Fkits\u002Fplain\"\n)\n\nconst src = `---\ntemplate: order.shipped\nprofile: orders\nsubject: \"Order {{order_id}} is on its way\"\npreheader: \"Arriving by {{eta}}.\"\n---\n\n# On its way\n\nHi {{name | there}}, order {{order_id}} comes to {{total}}.\nIt goes to {{deliver_to.city}}.\n`\n\n\u002F\u002F No Go type: only the syntax and the kit's rules are checked here.\nvar orderShipped = lttr.MustCompile[map[string]any](plain.MustKit(), \"order.shipped\", []byte(src))\n\nfunc main() {\n    r, err := lttr.NewRenderer(lttr.Config{\n        Kit:      plain.MustKit(),\n        Profiles: []lttr.Profile{{Name: \"orders\", From: mail.Address{Name: \"Example\", Address: \"orders@example.com\"}}},\n    })\n    if err != nil {\n        log.Fatal(err)\n    }\n    to := lttr.Recipient{Address: \"kim@example.com\", Name: \"Kim\"}\n    for _, payload := range []string{\n        `{\"order_id\": \"A-1042\", \"eta\": \"5:30 pm\", \"total\": 42.5, \"deliver_to\": {\"city\": \"Springfield\"}}`,\n        `{\"order_id\": \"A-1042\", \"eta\": \"5:30 pm\", \"total\": 42.5}`,\n        `{\"order_id\": \"A-1042\", \"eta\": \"5:30 pm\", \"total\": 42.5, \"deliver_to\": \"Springfield\"}`,\n        `{\"order_id\": \"A-1042\", \"eta\": \"5:30 pm\", \"total\": {\"amount\": 42.5}, \"deliver_to\": {\"city\": \"Springfield\"}}`,\n    } {\n        var data map[string]any\n        if err := json.Unmarshal([]byte(payload), &data); err != nil {\n            log.Fatal(err)\n        }\n        msg, err := orderShipped.Render(r, to, data)\n        if err != nil {\n            fmt.Println(\"error:\", err)\n            continue\n        }\n        for _, line := range strings.Split(msg.Text, \"\\n\") {\n            if strings.HasPrefix(line, \"Hi \") {\n                fmt.Println(\"ok:\", line)\n            }\n        }\n    }\n}\n",[215,1626,1627,1633,1637,1643,1651,1659,1667,1675,1684,1688,1696,1704,1708,1712,1722,1726,1730,1734,1739,1743,1747,1751,1755,1760,1765,1769,1773,1778,1817,1821,1829,1849,1857,1889,1893,1905,1913,1917,1943,1961,1968,1975,1982,1989,1994,2013,2048,2057,2062,2076,2088,2103,2108,2112,2143,2161,2176,2181,2185,2189],{"__ignoreMap":238},[242,1628,1629,1631],{"class":244,"line":245},[242,1630,249],{"class":248},[242,1632,253],{"class":252},[242,1634,1635],{"class":244,"line":256},[242,1636,260],{"emptyLinePlaceholder":259},[242,1638,1639,1641],{"class":244,"line":263},[242,1640,266],{"class":248},[242,1642,270],{"class":269},[242,1644,1645,1647,1649],{"class":244,"line":273},[242,1646,277],{"class":276},[242,1648,1389],{"class":252},[242,1650,283],{"class":276},[242,1652,1653,1655,1657],{"class":244,"line":286},[242,1654,277],{"class":276},[242,1656,280],{"class":252},[242,1658,283],{"class":276},[242,1660,1661,1663,1665],{"class":244,"line":296},[242,1662,277],{"class":276},[242,1664,291],{"class":252},[242,1666,283],{"class":276},[242,1668,1669,1671,1673],{"class":244,"line":306},[242,1670,277],{"class":276},[242,1672,301],{"class":252},[242,1674,283],{"class":276},[242,1676,1677,1679,1682],{"class":244,"line":311},[242,1678,277],{"class":276},[242,1680,1681],{"class":252},"strings",[242,1683,283],{"class":276},[242,1685,1686],{"class":244,"line":321},[242,1687,260],{"emptyLinePlaceholder":259},[242,1689,1690,1692,1694],{"class":244,"line":331},[242,1691,277],{"class":276},[242,1693,316],{"class":252},[242,1695,283],{"class":276},[242,1697,1698,1700,1702],{"class":244,"line":337},[242,1699,277],{"class":276},[242,1701,326],{"class":252},[242,1703,283],{"class":276},[242,1705,1706],{"class":244,"line":342},[242,1707,334],{"class":269},[242,1709,1710],{"class":244,"line":349},[242,1711,260],{"emptyLinePlaceholder":259},[242,1713,1714,1716,1718,1720],{"class":244,"line":361},[242,1715,627],{"class":248},[242,1717,630],{"class":432},[242,1719,633],{"class":248},[242,1721,636],{"class":276},[242,1723,1724],{"class":244,"line":366},[242,1725,642],{"class":276},[242,1727,1728],{"class":244,"line":446},[242,1729,648],{"class":276},[242,1731,1732],{"class":244,"line":451},[242,1733,654],{"class":276},[242,1735,1736],{"class":244,"line":465},[242,1737,1738],{"class":276},"preheader: \"Arriving by {{eta}}.\"\n",[242,1740,1741],{"class":244,"line":476},[242,1742,666],{"class":276},[242,1744,1745],{"class":244,"line":487},[242,1746,260],{"emptyLinePlaceholder":259},[242,1748,1749],{"class":244,"line":493},[242,1750,677],{"class":276},[242,1752,1753],{"class":244,"line":498},[242,1754,260],{"emptyLinePlaceholder":259},[242,1756,1757],{"class":244,"line":510},[242,1758,1759],{"class":276},"Hi {{name | there}}, order {{order_id}} comes to {{total}}.\n",[242,1761,1762],{"class":244,"line":521},[242,1763,1764],{"class":276},"It goes to {{deliver_to.city}}.\n",[242,1766,1767],{"class":244,"line":526},[242,1768,728],{"class":276},[242,1770,1771],{"class":244,"line":531},[242,1772,260],{"emptyLinePlaceholder":259},[242,1774,1775],{"class":244,"line":543},[242,1776,1777],{"class":345},"\u002F\u002F No Go type: only the syntax and the kit's rules are checked here.\n",[242,1779,1780,1782,1784,1786,1788,1790,1792,1794,1796,1798,1800,1803,1805,1807,1809,1811,1813,1815],{"class":244,"line":552},[242,1781,739],{"class":248},[242,1783,742],{"class":269},[242,1785,745],{"class":248},[242,1787,748],{"class":269},[242,1789,751],{"class":385},[242,1791,601],{"class":269},[242,1793,598],{"class":248},[242,1795,601],{"class":269},[242,1797,392],{"class":248},[242,1799,606],{"class":269},[242,1801,1802],{"class":252},"any",[242,1804,759],{"class":269},[242,1806,762],{"class":385},[242,1808,765],{"class":269},[242,1810,768],{"class":276},[242,1812,771],{"class":269},[242,1814,774],{"class":248},[242,1816,777],{"class":269},[242,1818,1819],{"class":244,"line":563},[242,1820,260],{"emptyLinePlaceholder":259},[242,1822,1823,1825,1827],{"class":244,"line":581},[242,1824,369],{"class":248},[242,1826,790],{"class":385},[242,1828,793],{"class":269},[242,1830,1831,1833,1835,1837,1839,1841,1843,1845,1847],{"class":244,"line":592},[242,1832,861],{"class":269},[242,1834,805],{"class":248},[242,1836,748],{"class":269},[242,1838,868],{"class":385},[242,1840,407],{"class":269},[242,1842,873],{"class":252},[242,1844,417],{"class":269},[242,1846,878],{"class":252},[242,1848,881],{"class":269},[242,1850,1851,1853,1855],{"class":244,"line":614},[242,1852,887],{"class":269},[242,1854,762],{"class":385},[242,1856,892],{"class":269},[242,1858,1859,1861,1863,1865,1867,1869,1871,1873,1875,1877,1879,1881,1883,1885,1887],{"class":244,"line":619},[242,1860,898],{"class":269},[242,1862,873],{"class":252},[242,1864,417],{"class":269},[242,1866,905],{"class":252},[242,1868,908],{"class":269},[242,1870,911],{"class":276},[242,1872,914],{"class":269},[242,1874,917],{"class":252},[242,1876,417],{"class":269},[242,1878,922],{"class":252},[242,1880,925],{"class":269},[242,1882,928],{"class":276},[242,1884,931],{"class":269},[242,1886,934],{"class":276},[242,1888,937],{"class":269},[242,1890,1891],{"class":244,"line":624},[242,1892,943],{"class":269},[242,1894,1895,1897,1899,1901,1903],{"class":244,"line":639},[242,1896,949],{"class":248},[242,1898,952],{"class":269},[242,1900,955],{"class":248},[242,1902,958],{"class":432},[242,1904,462],{"class":269},[242,1906,1907,1909,1911],{"class":244,"line":645},[242,1908,966],{"class":269},[242,1910,969],{"class":385},[242,1912,972],{"class":269},[242,1914,1915],{"class":244,"line":651},[242,1916,850],{"class":269},[242,1918,1919,1922,1924,1927,1929,1931,1933,1935,1938,1941],{"class":244,"line":657},[242,1920,1921],{"class":269},"    to ",[242,1923,805],{"class":248},[242,1925,1926],{"class":252}," lttr",[242,1928,417],{"class":269},[242,1930,1000],{"class":252},[242,1932,1003],{"class":269},[242,1934,1006],{"class":276},[242,1936,1937],{"class":269},", Name: ",[242,1939,1940],{"class":276},"\"Kim\"",[242,1942,490],{"class":269},[242,1944,1945,1947,1950,1952,1954,1957,1959],{"class":244,"line":663},[242,1946,799],{"class":248},[242,1948,1949],{"class":269}," _, payload ",[242,1951,805],{"class":248},[242,1953,808],{"class":248},[242,1955,1956],{"class":269}," []",[242,1958,392],{"class":248},[242,1960,881],{"class":269},[242,1962,1963,1966],{"class":244,"line":669},[242,1964,1965],{"class":276},"        `{\"order_id\": \"A-1042\", \"eta\": \"5:30 pm\", \"total\": 42.5, \"deliver_to\": {\"city\": \"Springfield\"}}`",[242,1967,1043],{"class":269},[242,1969,1970,1973],{"class":244,"line":674},[242,1971,1972],{"class":276},"        `{\"order_id\": \"A-1042\", \"eta\": \"5:30 pm\", \"total\": 42.5}`",[242,1974,1043],{"class":269},[242,1976,1977,1980],{"class":244,"line":680},[242,1978,1979],{"class":276},"        `{\"order_id\": \"A-1042\", \"eta\": \"5:30 pm\", \"total\": 42.5, \"deliver_to\": \"Springfield\"}`",[242,1981,1043],{"class":269},[242,1983,1984,1987],{"class":244,"line":685},[242,1985,1986],{"class":276},"        `{\"order_id\": \"A-1042\", \"eta\": \"5:30 pm\", \"total\": {\"amount\": 42.5}, \"deliver_to\": {\"city\": \"Springfield\"}}`",[242,1988,1043],{"class":269},[242,1990,1991],{"class":244,"line":691},[242,1992,1993],{"class":269},"    } {\n",[242,1995,1996,1999,2002,2004,2006,2008,2010],{"class":244,"line":697},[242,1997,1998],{"class":248},"        var",[242,2000,2001],{"class":269}," data ",[242,2003,598],{"class":248},[242,2005,601],{"class":269},[242,2007,392],{"class":248},[242,2009,606],{"class":269},[242,2011,2012],{"class":252},"any\n",[242,2014,2015,2018,2020,2022,2025,2028,2031,2033,2036,2039,2042,2044,2046],{"class":244,"line":702},[242,2016,2017],{"class":248},"        if",[242,2019,952],{"class":269},[242,2021,805],{"class":248},[242,2023,2024],{"class":269}," json.",[242,2026,2027],{"class":385},"Unmarshal",[242,2029,2030],{"class":269},"([]",[242,2032,774],{"class":248},[242,2034,2035],{"class":269},"(payload), ",[242,2037,2038],{"class":248},"&",[242,2040,2041],{"class":269},"data); err ",[242,2043,955],{"class":248},[242,2045,958],{"class":432},[242,2047,462],{"class":269},[242,2049,2050,2053,2055],{"class":244,"line":708},[242,2051,2052],{"class":269},"            log.",[242,2054,969],{"class":385},[242,2056,972],{"class":269},[242,2058,2059],{"class":244,"line":713},[242,2060,2061],{"class":269},"        }\n",[242,2063,2064,2067,2069,2071,2073],{"class":244,"line":719},[242,2065,2066],{"class":269},"        msg, err ",[242,2068,805],{"class":248},[242,2070,811],{"class":269},[242,2072,990],{"class":385},[242,2074,2075],{"class":269},"(r, to, data)\n",[242,2077,2078,2080,2082,2084,2086],{"class":244,"line":725},[242,2079,2017],{"class":248},[242,2081,952],{"class":269},[242,2083,955],{"class":248},[242,2085,958],{"class":432},[242,2087,462],{"class":269},[242,2089,2090,2093,2095,2097,2100],{"class":244,"line":731},[242,2091,2092],{"class":269},"            fmt.",[242,2094,1095],{"class":385},[242,2096,407],{"class":269},[242,2098,2099],{"class":276},"\"error:\"",[242,2101,2102],{"class":269},", err)\n",[242,2104,2105],{"class":244,"line":736},[242,2106,2107],{"class":248},"            continue\n",[242,2109,2110],{"class":244,"line":780},[242,2111,2061],{"class":269},[242,2113,2114,2117,2120,2122,2124,2127,2130,2133,2135,2138,2140],{"class":244,"line":785},[242,2115,2116],{"class":248},"        for",[242,2118,2119],{"class":269}," _, line ",[242,2121,805],{"class":248},[242,2123,808],{"class":248},[242,2125,2126],{"class":269}," strings.",[242,2128,2129],{"class":385},"Split",[242,2131,2132],{"class":269},"(msg.Text, ",[242,2134,423],{"class":276},[242,2136,2137],{"class":413},"\\n",[242,2139,423],{"class":276},[242,2141,2142],{"class":269},") {\n",[242,2144,2145,2148,2150,2153,2156,2159],{"class":244,"line":796},[242,2146,2147],{"class":248},"            if",[242,2149,2126],{"class":269},[242,2151,2152],{"class":385},"HasPrefix",[242,2154,2155],{"class":269},"(line, ",[242,2157,2158],{"class":276},"\"Hi \"",[242,2160,2142],{"class":269},[242,2162,2163,2166,2168,2170,2173],{"class":244,"line":820},[242,2164,2165],{"class":269},"                fmt.",[242,2167,1095],{"class":385},[242,2169,407],{"class":269},[242,2171,2172],{"class":276},"\"ok:\"",[242,2174,2175],{"class":269},", line)\n",[242,2177,2178],{"class":244,"line":847},[242,2179,2180],{"class":269},"            }\n",[242,2182,2183],{"class":244,"line":853},[242,2184,2061],{"class":269},[242,2186,2187],{"class":244,"line":858},[242,2188,850],{"class":269},[242,2190,2191],{"class":244,"line":884},[242,2192,490],{"class":269},[232,2194,2197],{"className":2195,"code":2196,"filename":1130,"language":1131,"meta":238},[1128],"ok: Hi Kim, order A-1042 comes to 42.5. It goes to Springfield.\nerror: order.shipped:11:12: no value for {{deliver_to.city}}\nerror: order.shipped:11:12: no value for {{deliver_to.city}}\nerror: order.shipped:10:50: {{total}} is map[string]interface {}, not a scalar\n",[215,2198,2196],{"__ignoreMap":238},[211,2200,2201],{},"The rules:",[1182,2203,2204,2217,2226,2243,2257],{},[1185,2205,2206,2209,2210,2212,2213,2216],{},[1241,2207,2208],{},"A missing key is no value."," The fallback is used, then the recipient for a first segment the map lacks (",[215,2211,1430],{}," became Kim), then it is a render error at the tag. A path that runs into a string (",[215,2214,2215],{},"\"deliver_to\": \"Springfield\"",") is missing too.",[1185,2218,2219,2222,2223,417],{},[1241,2220,2221],{},"A map or list is an error",", even with a fallback: ",[215,2224,2225],{},"{{total}} is map[string]interface {}, not a scalar",[1185,2227,2228,2231,2232,2235,2236,1171,2239,2242],{},[1241,2229,2230],{},"Floats and booleans print",", because JSON and YAML decode to them: a float in its shortest form (",[215,2233,2234],{},"42.5","), a boolean as ",[215,2237,2238],{},"true",[215,2240,2241],{},"false",". Typed data still refuses them.",[1185,2244,2245,2248,2249,1171,2251,2253,2254,2256],{},[1241,2246,2247],{},"Only the empty interface is untyped."," A ",[215,2250,1620],{},[215,2252,1802],{}," field inside a typed struct is read the same way, from that field on. A field of a non-empty interface type, such as ",[215,2255,1532],{},", stays typed and is checked at compile time.",[1185,2258,2259,2262,2263,417],{},[1241,2260,2261],{},"Bindings still need their exact type",", so untyped data cannot fill one: ",[215,2264,2265],{},"receipt: :order is untyped data (order), want quiet.Receipt",[211,2267,2268,2271,2272,2275],{},[215,2269,2270],{},"Meta().Tags"," reports an untyped tag's type as ",[215,2273,2274],{},"interface {}",". Typed structs remain the recommended path: with a map, a typo in a path surfaces only when a message renders. Test every template that takes untyped data by rendering it.",[1162,2277,2279],{"id":2278},"bind-structured-values","Bind structured values",[211,2281,2282,2283,2285],{},"A binding, ",[215,2284,225],{},", passes a value to a component instead of printing it:",[232,2287,2290],{"className":1581,"code":2288,"filename":2289,"language":1584,"meta":238,"style":238},"::invoice{:invoice=\"invoice\"}\n::\n","tutorial\u002Ftemplates\u002Finvoice.md#L12-L13",[215,2291,2292,2297],{"__ignoreMap":238},[242,2293,2294],{"class":244,"line":245},[242,2295,2296],{"class":269},"::invoice{:invoice=\"invoice\"}\n",[242,2298,2299],{"class":244,"line":256},[242,2300,722],{"class":269},[211,2302,2303,2304,2307,2308,2311,2312,2315,2316,2319,2320,2323,2324,2327,2328,2331,2332,2335],{},"It resolves with the same path rules and the same scope as a merge tag, but it must resolve to ",[1241,2305,2306],{},"exactly"," the Go type the component's schema names, as registered by the kit with ",[215,2309,2310],{},"kit.Types",". A pointer on the path is followed, so a ",[215,2313,2314],{},"*Invoice"," field binds an ",[215,2317,2318],{},"Invoice",". Any other type is a compile error naming both, such as ",[215,2321,2322],{},"receipt: :order is string, want quiet.Receipt",". A named type is a type of its own: Quiet registers ",[215,2325,2326],{},"[]quiet.Product"," as ",[215,2329,2330],{},"Products",", and a field of type ",[215,2333,2334],{},"type Items []quiet.Product"," does not bind to it.",[211,2337,2338,2339,417],{},"The component side is in ",[1148,2340,2342],{"href":2341},"\u002Fauthoring\u002Fcomponents#pass-bindings","Pass bindings",[1162,2344,2346],{"id":2345},"know-how-urls-are-escaped","Know how URLs are escaped",[211,2348,2349,2350,2353,2354,2357],{},"Merge tags in a ",[215,2351,2352],{},"url"," attribute, a link destination or an image source are escaped as URL parts at render time. The rule is about ",[1241,2355,2356],{},"where"," the value sits:",[1182,2359,2360,2370,2386,2423],{},[1185,2361,2362,2365,2366,2369],{},[1241,2363,2364],{},"At the very start",", a value is inserted as is. ",[215,2367,2368],{},"href=\"{{track_url}}\""," passes a whole URL from your data through unchanged, so it can carry its own path and query.",[1185,2371,2372,2375,2376,2379,2380,2382,2383,417],{},[1241,2373,2374],{},"After some literal text, in the path, query or fragment",", a value is escaped. Before a ",[215,2377,2378],{},"?"," it is escaped as a path segment; after a ",[215,2381,2378],{}," it is escaped as a query value, with spaces as ",[215,2384,2385],{},"%20",[1185,2387,2388,2391,2392,2395,2396,1201,2398,1171,2400,2403,2404,2407,2408,1171,2410,2412,2413,2415,2416,2419,2420,417],{},[1241,2389,2390],{},"After some literal text, in the host"," (the URL so far has ",[215,2393,2394],{},"\u002F\u002F"," and no ",[215,2397,429],{},[215,2399,2378],{},[215,2401,2402],{},"#"," after it), a value is not escaped, but it must be a whole DNS label of the host: a single label (ASCII letters, digits and ",[215,2405,2406],{},"-",", not at either end), immediately preceded by literal ",[215,2409,2394],{},[215,2411,417],{},", and immediately followed by literal text starting with ",[215,2414,417],{},", as in ",[215,2417,2418],{},"https:\u002F\u002F{{shop}}.example.com\u002F",". Anything else is a render error at the tag: ",[215,2421,2422],{},"merge value {{shop}} cannot form part of a url host",[1185,2424,2425],{},"A fallback follows the same rule as the value it replaces.",[211,2427,2428,2429,2432,2433,1201,2436,2432,2439,2442,2443,2432,2446,2449],{},"With ",[215,2430,2431],{},"q"," = ",[215,2434,2435],{},"a b&c=d\u002Fe?f#g@h",[215,2437,2438],{},"email",[215,2440,2441],{},"kim@example.com"," and ",[215,2444,2445],{},"shop",[215,2447,2448],{},"shop1",", as rendered into a link:",[1328,2451,2452,2462],{},[1331,2453,2454],{},[1334,2455,2456,2459],{},[1337,2457,2458],{},"Template",[1337,2460,2461],{},"Rendered",[1344,2463,2464,2476,2488,2500,2511,2524,2540],{},[1334,2465,2466,2471],{},[1349,2467,2468],{},[215,2469,2470],{},"https:\u002F\u002Fx.example\u002Fp\u002F{{q}}",[1349,2472,2473],{},[215,2474,2475],{},"https:\u002F\u002Fx.example\u002Fp\u002Fa%20b&c=d%2Fe%3Ff%23g@h",[1334,2477,2478,2483],{},[1349,2479,2480],{},[215,2481,2482],{},"https:\u002F\u002Fx.example\u002Fsearch?q={{q}}",[1349,2484,2485],{},[215,2486,2487],{},"https:\u002F\u002Fx.example\u002Fsearch?q=a%20b%26c%3Dd%2Fe%3Ff%23g%40h",[1334,2489,2490,2495],{},[1349,2491,2492],{},[215,2493,2494],{},"mailto:{{email}}",[1349,2496,2497],{},[215,2498,2499],{},"mailto:kim@example.com",[1334,2501,2502,2506],{},[1349,2503,2504],{},[215,2505,2418],{},[1349,2507,2508],{},[215,2509,2510],{},"https:\u002F\u002Fshop1.example.com\u002F",[1334,2512,2513,2518],{},[1349,2514,2515],{},[215,2516,2517],{},"https:\u002F\u002F{{q}}.example.com\u002F",[1349,2519,2520,2521,2523],{},"render error: ",[215,2522,2431],{}," is not a single DNS label",[1334,2525,2526,2531],{},[1349,2527,2528],{},[215,2529,2530],{},"https:\u002F\u002Faccounts-{{shop}}.example.com\u002F",[1349,2532,2520,2533,2535,2536,1171,2538],{},[215,2534,2445],{}," isn't preceded by ",[215,2537,2394],{},[215,2539,417],{},[1334,2541,2542,2547],{},[1349,2543,2544],{},[215,2545,2546],{},"https:\u002F\u002F{{shop}}\u002Fx",[1349,2548,2549,2550,2552],{},"render error: no literal ",[215,2551,417],{}," follows the tag",[211,2554,2555,2556,2559,2560,2563],{},"A tag that makes up the whole host, such as ",[215,2557,2558],{},"https:\u002F\u002F{{host}}\u002Fx",", always fails, whatever its value. Pass the whole URL as the first part instead: ",[215,2561,2562],{},"href=\"{{shop_url}}\"",". A value can never add a query parameter, change the path or fragment, or move the host.",[211,2565,2566,2567,1171,2570,2573,2574,1171,2577,2580,2581,2584,2585,2588],{},"The result is then checked like every URL. It must use ",[215,2568,2569],{},"https",[215,2571,2572],{},"http"," with a host, or ",[215,2575,2576],{},"mailto",[215,2578,2579],{},"tel"," with an address, and hold no whitespace; anything else is a render error, such as ",[215,2582,2583],{},"url \"javascript:alert(1)\": scheme \"javascript\" not allowed",". Relative URLs are allowed only when ",[215,2586,2587],{},"Config.AllowRelativeURLs"," is set, for previews.",[2590,2591,2592,2593,2595,2596,2599,2600,2603,2604,2606,2607,2610],"tip",{},"If your data holds a complete URL, put it first: ",[215,2594,2368],{},". Writing ",[215,2597,2598],{},"href=\"https:\u002F\u002Fexample.com\u002F{{path}}\""," with a ",[215,2601,2602],{},"path"," that contains ",[215,2605,429],{}," gives ",[215,2608,2609],{},"%2F",", not a nested path.",[1162,2612,2614],{"id":2613},"leave-an-optional-url-empty","Leave an optional URL empty",[211,2616,2617,2618,2620,2621,2624],{},"A ",[215,2619,2352],{}," attribute the schema doesn't require can be left unset: no link, no image. To leave it unset from data, give the tag an ",[1241,2622,2623],{},"explicit empty fallback"," (D52):",[232,2626,2629],{"className":1581,"code":2627,"filename":2628,"language":1584,"meta":238,"style":238},"::image{src=\"{{cover_url}}\" alt=\"Your workspace\" href=\"{{project_url |}}\"}\n::\n","templates\u002Fwelcome.md",[215,2630,2631,2636],{"__ignoreMap":238},[242,2632,2633],{"class":244,"line":245},[242,2634,2635],{"class":269},"::image{src=\"{{cover_url}}\" alt=\"Your workspace\" href=\"{{project_url |}}\"}\n",[242,2637,2638],{"class":244,"line":256},[242,2639,722],{"class":269},[211,2641,2642,2643,2646,2647,2649,2650,2653,2654,2657,2658,2661,2662,2665,2666,2669],{},"With no ",[215,2644,2645],{},"project_url",", the image renders without a link. The ",[215,2648,1200],{}," is what makes it optional: ",[215,2651,2652],{},"href=\"{{project_url}}\""," with no value is still ",[215,2655,2656],{},"no value for {{project_url}}",". And a ",[1241,2659,2660],{},"required"," url that ends up empty is an error either way, reported by the component: ",[215,2663,2664],{},"image: src: url \"\": empty",". Quiet's courier-job example writes its map the same way, ",[215,2667,2668],{},"::map{src=\"{{map_url |}}\" …}",", so a job with no map image shows the map band's ground colour alone.",[1162,2671,2673],{"id":2672},"list-a-templates-tags","List a template's tags",[211,2675,2676,2678,2679,2682,2683,2685,2686,1171,2689,1215,2692,2695],{},[215,2677,1138],{}," is available on every compiled template, as in the first program. For a kit's samples, ",[215,2680,2681],{},"lttr tags"," prints the same list as ",[215,2684,2602],{},", Go type, ",[215,2687,2688],{},"tag",[215,2690,2691],{},"binding",[215,2693,2694],{},"line:col",", separated by tabs:",[232,2697,2702],{"className":2698,"code":2699,"filename":2700,"language":2701,"meta":238,"style":238},"language-bash shiki shiki-themes github-light-high-contrast github-light-high-contrast github-dark","go run .\u002Fcmd\u002Flttr tags -kit quiet -t order.out_for_delivery\n","Terminal","bash",[215,2703,2704],{"__ignoreMap":238},[242,2705,2706,2708,2711,2714,2717,2720,2723,2726],{"class":244,"line":245},[242,2707,237],{"class":252},[242,2709,2710],{"class":276}," run",[242,2712,2713],{"class":276}," .\u002Fcmd\u002Flttr",[242,2715,2716],{"class":276}," tags",[242,2718,2719],{"class":432}," -kit",[242,2721,2722],{"class":276}," quiet",[242,2724,2725],{"class":432}," -t",[242,2727,2728],{"class":276}," order.out_for_delivery\n",[232,2730,2733],{"className":2731,"code":2732,"filename":1130,"language":1131,"meta":238},[1128],"destination string  tag 5:25\neta string  tag 5:44\norder_id    string  tag 9:28\ncourier.first_name  string  tag 12:1\npicked_up_at    string  tag 12:40\ndestination string  tag 13:8\neta string  tag 13:27\ntrack_url   string  tag 15:31\norder   quiet.Receipt   binding 21:1\ndeliver_to.name string  tag 26:1\ndeliver_to.address  string  tag 27:1\ncourier.name    string  tag 30:1\ncourier.rating  string  tag 30:25\ncourier.vehicle string  tag 31:1\n",[215,2734,2732],{"__ignoreMap":238},[211,2736,2737,2738,2740,2741,2743,2744,2746,2747,417],{},"Plain's samples render from untyped YAML data, so every tag there is ",[215,2739,2274],{},". ",[215,2742,2681],{}," knows only the samples of the kit you name; for your own templates, read ",[215,2745,2270],{},". See ",[1148,2748,2749],{"href":140},"CLI",[1162,2751,2753],{"id":2752},"next-steps","Next steps",[1182,2755,2756,2765],{},[1185,2757,2758,2760,2761,2764],{},[1148,2759,58],{"href":59}," for the ",[215,2762,2763],{},"href"," values these URLs go into.",[1185,2766,2767,2769],{},[1148,2768,63],{"href":64}," for every path error in context.",[2771,2772,2773],"style",{},"html pre.shiki code .s1Q0q, html code.shiki .s1Q0q{--shiki-light:#A0111F;--shiki-default:#A0111F;--shiki-dark:#F97583}html pre.shiki code .sSlKG, html code.shiki .sSlKG{--shiki-light:#702C00;--shiki-default:#702C00;--shiki-dark:#B392F0}html pre.shiki code .sihDN, html code.shiki .sihDN{--shiki-light:#0E1116;--shiki-default:#0E1116;--shiki-dark:#E1E4E8}html pre.shiki code .sRBGO, html code.shiki .sRBGO{--shiki-light:#032563;--shiki-default:#032563;--shiki-dark:#9ECBFF}html pre.shiki code .sBq4M, html code.shiki .sBq4M{--shiki-light:#66707B;--shiki-default:#66707B;--shiki-dark:#6A737D}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 .sFaxo, html code.shiki .sFaxo{--shiki-light:#A0111F;--shiki-default:#A0111F;--shiki-dark:#79B8FF}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);}",{"title":238,"searchDepth":256,"depth":256,"links":2775},[2776,2777,2778,2779,2780,2781,2782,2783,2784,2785,2786],{"id":1164,"depth":256,"text":1165},{"id":1231,"depth":256,"text":1232},{"id":1406,"depth":256,"text":1151},{"id":1497,"depth":256,"text":1498},{"id":1559,"depth":256,"text":1560},{"id":1610,"depth":256,"text":1611},{"id":2278,"depth":256,"text":2279},{"id":2345,"depth":256,"text":2346},{"id":2613,"depth":256,"text":2614},{"id":2672,"depth":256,"text":2673},{"id":2752,"depth":256,"text":2753},"How a template reaches into your data — typed structs checked at compile time, untyped maps read at render, fallbacks, bindings and URL escaping.","md",null,{},{"icon":56},{"title":53,"description":2787},"lOqrx_ZOnDHeOX8eGGCfTcrQvbi7enn6lcv-B13p8DY",[2795,2797],{"title":48,"path":49,"stem":50,"description":2796,"icon":51,"children":-1},"How a template uses a kit's components — names and aliases, typed attributes, bindings, content, children, ordering rules and limits.",{"title":58,"path":59,"stem":60,"description":2798,"icon":61,"children":-1},"Buttons, links and styled runs of text — the two built-in inline components, action rows, links in prose and the kit's span classes.",1790467463723]