[{"data":1,"prerenderedAt":559,"buildId":560},["ShallowReactive",2],{"docs:\u002F":3},{"page":4,"section":10,"document":18,"credits":10,"prev":10,"next":10},{"id":5,"path":6,"file":7,"title":8,"sourceTitle":8,"description":9,"tagline":9,"eyebrow":10,"credits":10,"keywords":11,"icon":10,"layout":12,"seo":13,"sidebar":15,"toc":16,"kind":10,"group":10,"navigation":15,"order":17},"index","\u002F","index.md","whoasks","Answers each request in the form its reader can use. HTML for people, Markdown for agents, JSON for programs.",null,[],"home",{"title":14},"whoasks · The form each reader can use",true,false,9007199254740991,{"nodes":19,"toc":553},[20,151,159,162,337,348,363,369,386,392,489,501,507,522,533,539,546],[21,22,23,28,32,88,111],"whoasks-hero",{},[24,25,27],"h1",{"id":26},"one-url-the-form-each-reader-can-use","One URL, the form each reader can use",[29,30,31],"p",{},"whoasks looks at each request and answers with HTML, Markdown or JSON. People keep their pages, agents get Markdown, and programs get JSON from the same route.",[33,34,36,39],"template",{"name":35},"people",[10,37,38],{}," prettier-ignore ",[40,41,44],"pre",{"language":42,"class":43,"wrap":15},"html","shiki shiki-themes github-light-default github-dark-default dark:github-dark-default",[45,46,48],"code",{"class":47},"language-html",[49,50,53,57,61,64,66,69,71,73,75,78,80,83,85],"span",{"class":51,"style":52},"line","display: inline",[49,54,56],{"style":55},"color:#1F2328;--shiki-dark:#E6EDF3","\u003C",[49,58,60],{"style":59},"color:#116329;--shiki-dark:#7EE787","main",[49,62,63],{"style":55},">\u003C",[49,65,24],{"style":59},[49,67,68],{"style":55},">Guide\u003C\u002F",[49,70,24],{"style":59},[49,72,63],{"style":55},[49,74,29],{"style":59},[49,76,77],{"style":55},">Hello\u003C\u002F",[49,79,29],{"style":59},[49,81,82],{"style":55},">\u003C\u002F",[49,84,60],{"style":59},[49,86,87],{"style":55},">",[33,89,91],{"name":90},"agents",[40,92,94],{"language":93,"class":43,"wrap":15},"md",[45,95,97,103,104,103,106],{"class":96},"language-md",[49,98,99],{"class":51,"style":52},[49,100,102],{"style":101},"color:#0550AE;--shiki-light-font-weight:bold;--shiki-dark:#79C0FF;--shiki-dark-font-weight:bold","# Guide","\n",[49,105],{"class":51,"style":52},[49,107,108],{"class":51,"style":52},[49,109,110],{"style":55},"Hello",[33,112,114,116],{"name":113},"programs",[10,115,38],{},[40,117,119],{"language":118,"class":43,"wrap":15},"json",[45,120,122],{"class":121},"language-json",[49,123,124,127,130,133,137,140,143,145,148],{"class":51,"style":52},[49,125,126],{"style":55},"{",[49,128,129],{"style":59},"\"title\"",[49,131,132],{"style":55},":",[49,134,136],{"style":135},"color:#0A3069;--shiki-dark:#A5D6FF","\"Guide\"",[49,138,139],{"style":55},",",[49,141,142],{"style":59},"\"body\"",[49,144,132],{"style":55},[49,146,147],{"style":135},"\"Hello\"",[49,149,150],{"style":55},"}",[152,153,158],"h2",{"id":154,"anchor":155},"the-route-behind-those-answers",{"label":156,"icon":157},"Section titled \"The route behind those answers\"","#","The route behind those answers",[29,160,161],{},"This route gives the three answers above.",[40,163,166],{"language":164,"filename":165,"class":43,"wrap":15},"ts","route.ts",[45,167,169,103,187,103,189,103,208,103,230,103,232,103,271,103,285,103,323,103,328,103,333],{"class":168},"language-ts",[49,170,171,175,178,181,184],{"class":51,"style":52},[49,172,174],{"style":173},"color:#CF222E;--shiki-dark:#FF7B72","import",[49,176,177],{"style":55}," { whoasks } ",[49,179,180],{"style":173},"from",[49,182,183],{"style":135}," \"whoasks\"",[49,185,186],{"style":55},";",[49,188],{"class":51,"style":52},[49,190,191,194,198,201,205],{"class":51,"style":52},[49,192,193],{"style":173},"const",[49,195,197],{"style":196},"color:#0550AE;--shiki-dark:#79C0FF"," site",[49,199,200],{"style":173}," =",[49,202,204],{"style":203},"color:#8250DF;--shiki-dark:#D2A8FF"," whoasks",[49,206,207],{"style":55},"();",[49,209,210,212,215,217,220,222,225,227],{"class":51,"style":52},[49,211,193],{"style":173},[49,213,214],{"style":196}," guide",[49,216,200],{"style":173},[49,218,219],{"style":55}," { title: ",[49,221,136],{"style":135},[49,223,224],{"style":55},", body: ",[49,226,147],{"style":135},[49,228,229],{"style":55}," };",[49,231],{"class":51,"style":52},[49,233,234,237,240,243,246,250,252,255,258,260,263,265,268],{"class":51,"style":52},[49,235,236],{"style":173},"export",[49,238,239],{"style":173}," function",[49,241,242],{"style":203}," route",[49,244,245],{"style":55},"(",[49,247,249],{"style":248},"color:#953800;--shiki-dark:#FFA657","request",[49,251,132],{"style":173},[49,253,254],{"style":248}," Request",[49,256,257],{"style":55},")",[49,259,132],{"style":173},[49,261,262],{"style":248}," Promise",[49,264,56],{"style":55},[49,266,267],{"style":248},"Response",[49,269,270],{"style":55},"> {",[49,272,273,276,279,282],{"class":51,"style":52},[49,274,275],{"style":173},"  return",[49,277,278],{"style":55}," site.",[49,280,281],{"style":203},"respond",[49,283,284],{"style":55},"(request, {",[49,286,287,290,293,296,299,302,305,308,311,313,315,318,321],{"class":51,"style":52},[49,288,289],{"style":203},"    html",[49,291,292],{"style":55},": () ",[49,294,295],{"style":173},"=>",[49,297,298],{"style":135}," `\u003Cmain>\u003Ch1>${",[49,300,301],{"style":55},"guide",[49,303,304],{"style":135},".",[49,306,307],{"style":55},"title",[49,309,310],{"style":135},"}\u003C\u002Fh1>\u003Cp>${",[49,312,301],{"style":55},[49,314,304],{"style":135},[49,316,317],{"style":55},"body",[49,319,320],{"style":135},"}\u003C\u002Fp>\u003C\u002Fmain>`",[49,322,139],{"style":55},[49,324,325],{"class":51,"style":52},[49,326,327],{"style":55},"    json: guide,",[49,329,330],{"class":51,"style":52},[49,331,332],{"style":55},"  });",[49,334,335],{"class":51,"style":52},[49,336,150],{"style":55},[29,338,339,340,343,344,347],{},"The keys are the forms the route offers. The first key is the default, so a request that states no preference (",[45,341,342],{},"curl"," sends ",[45,345,346],{},"Accept: *\u002F*",") gets HTML.",[29,349,350,351,354,355,360,361,304],{},"There is no ",[45,352,353],{},"markdown"," key. whoasks makes the Markdown from the HTML with mdream. Read ",[356,357,359],"a",{"href":358},"\u002Fguide\u002Fapi-routes","API routes"," to write routes with ",[45,362,281],{},[152,364,368],{"id":365,"anchor":366},"a-whole-site-at-once",{"label":367,"icon":157},"Section titled \"A whole site at once\"","A whole site at once",[29,370,371,374,375,378,379,382,383,304],{},[45,372,373],{},"site.handle(request, next)"," goes in front of an app. Every HTML page then also answers as Markdown, at the same URL with ",[45,376,377],{},"Accept: text\u002Fmarkdown",", at the twin URL ",[45,380,381],{},"\u002Fdocs\u002Fguide.md",", and at ",[45,384,385],{},"\u002Fdocs\u002Fguide?format=md",[29,387,388,389,391],{},"A browser and a plain ",[45,390,342],{}," still get HTML.",[40,393,395],{"language":164,"filename":394,"class":43,"wrap":15},"app.ts",[45,396,397,103,411,103,423,103,437,103,439,103,451,103,453],{"class":168},[49,398,399,401,404,406,409],{"class":51,"style":52},[49,400,174],{"style":173},[49,402,403],{"style":55}," { H3 } ",[49,405,180],{"style":173},[49,407,408],{"style":135}," \"h3\"",[49,410,186],{"style":55},[49,412,413,415,417,419,421],{"class":51,"style":52},[49,414,174],{"style":173},[49,416,177],{"style":55},[49,418,180],{"style":173},[49,420,183],{"style":135},[49,422,186],{"style":55},[49,424,425,427,430,432,435],{"class":51,"style":52},[49,426,174],{"style":173},[49,428,429],{"style":55}," { middleware } ",[49,431,180],{"style":173},[49,433,434],{"style":135}," \"whoasks\u002Fh3\"",[49,436,186],{"style":55},[49,438],{"class":51,"style":52},[49,440,441,443,445,447,449],{"class":51,"style":52},[49,442,193],{"style":173},[49,444,197],{"style":196},[49,446,200],{"style":173},[49,448,204],{"style":203},[49,450,207],{"style":55},[49,452],{"class":51,"style":52},[49,454,455,457,460,463,465,468,470,473,475,478,481,483,486],{"class":51,"style":52},[49,456,236],{"style":173},[49,458,459],{"style":173}," const",[49,461,462],{"style":196}," app",[49,464,132],{"style":173},[49,466,467],{"style":248}," H3",[49,469,200],{"style":173},[49,471,472],{"style":173}," new",[49,474,467],{"style":203},[49,476,477],{"style":55},"().",[49,479,480],{"style":203},"use",[49,482,245],{"style":55},[49,484,485],{"style":203},"middleware",[49,487,488],{"style":55},"(site));",[29,490,491,492,496,497,304],{},"See ",[356,493,495],{"href":494},"\u002Fguide\u002Finstallation","Installation"," for h3, Nitro, Hono and Cloudflare Workers, then ",[356,498,500],{"href":499},"\u002Fguide\u002Fpages","Pages",[152,502,506],{"id":503,"anchor":504},"the-request-decides",{"label":505,"icon":157},"Section titled \"The request decides\"","The request decides",[29,508,509,510,513,514,517,518,521],{},"whoasks reads three things in this order: a twin URL, ",[45,511,512],{},"?format=",", then the ",[45,515,516],{},"Accept"," header. It does not read the ",[45,519,520],{},"User-Agent"," header, though a layer can.",[29,523,524,525,529,530,532],{},"Read ",[356,526,528],{"href":527},"\u002Fguide\u002Fnegotiation","Negotiation"," for the rules and for what Claude Code, Cursor, Codex and ",[45,531,342],{}," get.",[152,534,538],{"id":535,"anchor":536},"made-to-be-built-on",{"label":537,"icon":157},"Section titled \"Made to be built on\"","Made to be built on",[29,540,541,542,545],{},"A layer is a plain object passed to ",[45,543,544],{},"whoasks()",". It adds a form such as YAML, answers with the Markdown a page was written in, changes the pick, or swaps the converter.",[29,547,524,548,552],{},[356,549,551],{"href":550},"\u002Fguide\u002Flayers","Layers"," to write your own layers.",[554,556,557,558],{"id":154,"depth":555,"text":158},2,{"id":365,"depth":555,"text":368},{"id":503,"depth":555,"text":506},{"id":535,"depth":555,"text":538},1796579199947,"78c9ee36-381e-45a5-bdf8-02819f0a7eb0"]