on master help sign in
Udon (#621)
b43cd53rmariani
using/sail-and-udon.md+46−348
@@ -8,81 +8,54 @@ Sail is Hoon markup that’s used to render a web page with XML. But what makes
8
8
9Udon is a way to write content for the web. It's a minimalist markup language for creating and rendering text documents, with a Markdown-inspired syntax. It's integrated with our Hoon programming language, allowing it to be used as standalone prose in its own file or embedded inside a Hoon source file, in which case it will be parsed into a tree of HTML nodes using Sail.
9Udon is a way to write content for the web. It's a minimalist markup language for creating and rendering text documents, with a Markdown-inspired syntax. It's integrated with our Hoon programming language, allowing it to be used as standalone prose in its own file or embedded inside a Hoon source file, in which case it will be parsed into a tree of HTML nodes using Sail.
10
10
11−This document will be divided into two main sections: the Sail guide and the Udon guide. The Udon guide has two sub-sections that each walk you through a practical example. Also, you're encouraged to read the Getting Started section below, which applies to both Udon and Sail.
11+This document will be divided into two main sections: the Sail guide and the Udon guide. Also, you should read the Getting Started section below, which applies to both Udon and Sail.
12
12
13## Table of Contents
13## Table of Contents
14
14
15+- [Getting Started](#getting-started)
16+
15- [Sail: A Guide](#sail)
17- [Sail: A Guide](#sail)
16
18
17- [Udon: A Guide](#udon)
19- [Udon: A Guide](#udon)
18
20
19−- [Udon: A Simple Blog](#blog)
20−
21−- [Udon: A Static Site](#static)
22−
23−## Getting Started
21+## Getting Started {#getting-started}
24
22
25Before starting with either Sail or Udon, make sure that your ship is
23Before starting with either Sail or Udon, make sure that your ship is
26−[mounted to Unix](https://urbit.org/docs/using/setup/)
24+[mounted to Unix](/docs/getting-started/booting-a-ship)
27
25
28−To host that output, your ship also has a web-server, called
26+To host that output, your ship also has a web-server that can be found at
29−[Eyre](https://urbit.org/docs/using/web/), that can be found at
30−`http://localhost:8080/` if it’s your first ship that’s running on the
27+`localhost` (default port 80) if it’s your first ship that’s running on the
31machine, `http://localhost:8081/` if it’s the second ship on that same machine,
28machine, `http://localhost:8081/` if it’s the second ship on that same machine,
32and so on. In the startup messages, a ship will tell you which HTTP port it's
29and so on. In the startup messages, a ship will tell you which HTTP port it's
33using.
30using.
34
31
35−The `/web` directory of the `%home` desk is served by default. You can change
32+Udon and Sail files are often run as independent files (`.udon` and `.hoon`
36−which desk you're serving by using the command `|serve` in the Dojo. If you
33+respectively), but for the purpose of this guide, we will run them out of the
37−have already created and mounted a desk named `%sandbox`, for example, you can
34+`frontpage.hoon` file located in the `/gen` directory. The default content of
38−switch to serving it with this command:
35+`frontpage.hoon` is Sail code.
39−
40−```
41−|serve %sandbox
42−```
43
36
44−The first time you serve a desk, `/web` will be included as default. After that,
37+To use `frontpage.hoon`, we use a `|serve` command like this one in your ship's
45−you will need to explicitly append `/web` to the desk you're switching to --
38+Dojo:
46−otherwise, you'll need to write `http://localhost:8080/web` every time you
47−navigate to your web-server. Newly served desks not automatically having `/web`
48−as their root directory is a bug.
49−
50−To switch back to your `%home` desk and set `/web` as your root directory, run:
51
39
52```
40```
53−|serve %/web
41+|serve /test %home /gen/frontpage/hoon
54```
42```
55
43
56−We'll be serving the `%home` desk for the examples in this tutorial.
44+This command has three arguments:
57−
45+- The first is the URL we want to bind our site to. We chose `/test`, so the URL
58−### Rendering
46+we will find our site at is `localhost/test`.
47+- The second is the desk we want to serve. We will be serving from `%home` in
48+this tutorial.
49+- The third is the file that we want to serve. In this tutorial, we will be
50+using `/gen/frontpage/hoon`, which refers to `frontpage.hoon`.
59
51
60−That server has access to source files located in `/<your-urbit>/home/web` and
52+Run the command `|serve /test %home /gen/frontpage/hoon`. Now navigate to
61−any sub-folders thereof. For the purposes of this tutorial, we will only be
53+`localhost/test` (or `localhost:8081/test` if your ship is on that port) in your
62−using files that are located in the `/<your-urbit>/home/web/pages` path.
54+browser, and you should see the rendered Sail.
63
55
64−There is an important distinction between these two paths. According to
56+**Note:** Important to remember that every time you edit a file in your ship's
65−`/ren/urb.hoon`, any file inside of `/web` or any of its sub-directories
57+pier (Unix directory), including `frontpage.hoon`, you need to run `|commit %home`
66−is put through a tree of renderers specified at `/ren/urb/tree.hoon`
58+to copy those changes to Urbit.
67−-- _except_ for files inside of `/web/pages`. All of the files in `/web` and
68−its non-`/pages` children directories have various operations on files, such as
69−wrapping your Sail the `html`, `head`, and `body` nodes. This rendering tool,
70−called simply **Tree**, also adds certain formatting polish, such as a sidebar
71−that lists sibling files in the same directory.
72−
73−The `/web/pages` sub-directory is a unique case with its own rendering rules.
74−The Tree is not used when rendering files in this path. The existence of no tag
75−is inferred, and no special formatting is applied. Such simplicity is ideal for
76−introducing the basics of Sail. Any source file located in `/web/pages` must
77−produce a complete HTML node with "head" and "body" nodes as children.
78−
79−Understanding the details of the rendering pipeline is not necessary to complete
80−this tutorial. But, if you are curious, you might find it illuminating to
81−explore the contents of the `/ren` directory.
82−
83−So, if a Sail source file named `sailtest.hoon` is saved in your `/web/pages`
84−folder on your only running urbit process, you can view that source rendered
85−into a web-page at `localhost:8080/pages/sailtest/`.
86
59
87## <a name="sail"></a>Sail: A Guide
60## <a name="sail"></a>Sail: A Guide
88
61
@@ -122,14 +95,13 @@ It’s easy to see how Sail can directly translate to HTML:
122</html>
95</html>
123```
96```
124
97
125−Save the above Sail code in `/home/web/pages/firstsail.hoon`, and the above
98+You can test above Sail code by placing it
126−HTML code in `/home/web/pages/firsth.html`. Access the resulting pages by
99+under `^- manx` in your `frontpage.hoon` file, and then running `|commit %home`
127−navigating to `http://localhost:8080/pages/firstsail` and
100+in the Dojo. If you've already run the `|serve` command code from the first
128−`http://localhost:8080/pages/firsth.html`, respectively, in your browser. The
101+section, the new content should appear at `localhost/test`.
129−resulting pages should be identical!
130
102
131−It shouldn't be hard to see the similarities here. So let's go into more
103+It shouldn't be hard to see the similarities between Sail and HTML. So let's go
132−detail about what the differences are.
104+into more detail about what the differences are.
133
105
134### Tags and Closing
106### Tags and Closing
135
107
@@ -701,25 +673,30 @@ allowing it to be used as standalone prose in its own file or embedded inside a
701Hoon source file, in which case it will be parsed into a tree of HTML nodes
673Hoon source file, in which case it will be parsed into a tree of HTML nodes
702using Hoon's XML-templating syntax, Sail.
674using Hoon's XML-templating syntax, Sail.
703
675
704−This document is itself written in Udon, and its source file is of the
705−Udon `.udon` extension. As such, we use some `formatted text` to make
706−it clear what is and isn't code, and to display that code to you instead of
707−actually using its semantics for formatting.
708−
709There are quite a few similarities between Udon and the
676There are quite a few similarities between Udon and the
710CommonMark standard, but there are enough differences that you shouldn't rely on
677CommonMark standard, but there are enough differences that you shouldn't rely on
711existing knowledge of the latter. Udon generally supports only one
678existing knowledge of the latter. Udon generally supports only one
712syntax for each type of HTML node it emits. Udon is also stricter than
679syntax for each type of HTML node it emits. Udon is also stricter than
713Markdown: some syntax errors will prevent the file from being parsed at all.
680Markdown: some syntax errors will prevent the file from being parsed at all.
714
681
715−We provide a few simple examples [here](#examples) of how to publish
682+## Testing Udon
716−Udon files using our web interface.
683+
684+Udon files use the `.udon` file extension, but for this entry-level guide, we
685+will use the `frontpage.hoon` method that we are already familiar with.
686+
687+To test out Udon, put a `;>` under the `^- manx` in your `frontpage.hoon` file,
688+and then put all your Udon code under that `;>`. Then run `|commit %home`
689+in the Dojo. If you've already run the `|serve` command code from the first
690+section, the new content should appear at `localhost/test`.
717
691
718## Udon Syntax
692## Udon Syntax
719
693
720### Front Matter
694### Front Matter
721
695
696+> Note: The Front Matter section only applies to .udon files, and not the
697+frontpage.hoon testing method.
698+
722−The first thing on your file is a chunk of code called the front matter. It
699+The first thing on a `.udon` file is a chunk of code called the front matter. It
723contains metadata about your page, such as date, title, and position relative
700contains metadata about your page, such as date, title, and position relative
724to sibling pages.
701to sibling pages.
725
702
@@ -1255,282 +1232,3 @@ Produces:
1255 <br>
1232 <br>
1256 <small>[reactive publishing intensifies]</small>
1233 <small>[reactive publishing intensifies]</small>
1257</p>
1234</p>
1258−
1259−
1260−## <a name="blog"></a>A Simple Udon Blog
1261−
1262−Publishing using Udon is really easy. It uses the file extension `.udon`. Here we'll create a very simple blog and publish our first posts.
1263−
1264−First, let's setup a desk to serve our posts from:
1265−
1266−```
1267−|merge %site ~your-urbit %home
1268−```
1269−
1270−Then let's mount that desk to unix:
1271−
1272−```
1273−|mount /=site=
1274−```
1275−
1276−You should now be able to find a `/site` folder inside of your pier
1277−directory (either `comet/` or `your-urbit/`).
1278−
1279−To begin serving files from this new desk use `|serve`:
1280−
1281−```
1282−|serve %site
1283−```
1284−
1285−First let's create the landing page for our blog. Create the file
1286−`site/web/blog.udon`:
1287−
1288−```
1289−:- :~ anchor/'none'
1290− ==
1291−;>
1292−
1293−# Hello
1294−
1295−This is a simple blog I built on Urbit.
1296−
1297−;list(dataType "post");
1298−```
1299−
1300−Try viewing this file at `http://localhost:8080`. Note that `8080` might be
1301−`8081`, `8082`, and so on, depending if those ports were being used when you
1302−started your urbit.
1303−
1304−The only special thing about this page is the `anchor/'none'` front-matter
1305−which simply turns off the Tree navigation. Normally Tree gives navigation
1306−controls for walking around the filesystem, but taking them away makes
1307−the page seem more like a landing page.
1308−
1309−The page looks pretty boring now. Let's add our first post. From
1310−unix run `mkdir your-urbit/site/web/blog; touch
1311−your-urbit/site/web/blog/post-1.udon`. (Currently [there's a
1312−bug](https://github.com/urbit/urbit/issues/321) that prevents empty
1313−directories from getting created, so we have to `touch` a file inside
1314−them first.) In `blog/post-1.udon` let's add some filler content:
1315−
1316−```
1317−:- :~ navhome/'/blog'
1318− type/'post'
1319− date/'~2016.6.20'
1320− title/'My first post!'
1321− ==
1322−;>
1323−
1324−Is this a decentralized Medium? Let's find out.
1325−
1326−But first, how about a long quote from Paramenides:
1327−
1328−> True, he said; and therefore when ideas are what they are in
1329− relation to one another, their essence is determined by a relation
1330− among themselves, and has nothing to do with the resemblances, or
1331− whatever they are to be termed, which are in our sphere, and from
1332− which we receive this or that name when we partake of them. And
1333− the things which are within our sphere and have the same names
1334− with them, are likewise only relative to one another, and not to
1335− the ideas which have the same names with them, but belong to
1336− themselves and not to them.
1337−
1338−Good to get that out of the way.
1339−```
1340−
1341−You should be able to view this file at:
1342−`http://localhost:8080/blog/post-1.udon`.
1343−
1344−You'll also notice that
1345−now the list of posts here: `http://localhost:8080/blog` has
1346−updated.
1347−
1348−Here we use two pieces of front-matter worth noting: `type` and `navhome`.
1349−
1350−- `type` implies that the page has some special handling by Tree. When `type` is
1351− `post` we automatically put in the `date`, `title` and `author` when they're
1352− specified and add some styles.
1353−
1354−- `navhome` sets the path used by the home button (the circle in the top left).
1355− Since we want to send people back to the root of our blog, we set this to `/blog`
1356−
1357−Adding posts is as easy as dropping Udon files into the `blog/`
1358−directory. Pretty easy!
1359−
1360−### Blog comments
1361−
1362−Now let's enable comments on a blog post.
1363−
1364−First, turn comments on by editing the frontmatter in `post-1.udon`. Your
1365−frontmatter should look like this:
1366−
1367−```
1368−:- :~ navhome/'/blog'
1369− type/'post'
1370− date/'~2018.6.20'
1371− title/'Blog comments'
1372− comments/'true'
1373− ==
1374−;>
1375−```
1376−
1377−Now try loading your post here: `http://localhost:8080/blog/post-1.udon`.
1378−You should see a comments box at the bottom of the page.
1379−
1380−Try posting a comment! When you do you should see the following in
1381−your console:
1382−
1383−```
1384−+ /~your-urbit/home/55/web/blog/post-1/comments/~2016.6.20..23.20.54..0b88/md
1385−------------[0]
1386−~your-urbit[tree]: receiving comments, ;join %comments for details
1387−```
1388−
1389−Comments are written into the filesystem in the `comments/` folder
1390−relative to the page they're enabled on. When a new comment is posted
1391−a notification is also posted to the `/comments` `:talk` channel.
1392−
1393−Use `;join` to keep up with comments as they get posted:
1394−
1395−```
1396−;join ~your-urbit/comments
1397−```
1398−
1399−That's it! Easy.
1400−
1401−## <a name="static"></a>A Static Site
1402−
1403−Hosting a static tree of content is easy. Let's put together a really
1404−simple site for an imaginary Urbit meetup group.
1405−
1406−We assume you have at least followed the beginning of [our first
1407−examples](#blog) and created a desk called `site` and mounted it to
1408−unix.
1409−
1410−Note: below we use Urbit's implementation of Markdown, [Udon](#udon).
1411−This markup language allows you to use snippets of Hoon code but not HTML.
1412−In particular, we use Sail, a subset of Hoon. This Sail is rendered as HTML
1413−when the file is served to a client. To learn about Sail, head over to
1414−the [Sail](/docs/learn/arvo/arvo-internals/sail) section of the docs.
1415−
1416−In `site/web/meet.udon` put:
1417−
1418−```
1419−:- :~ navhome/'/meet'
1420− navdpad/'false'
1421− navpath/'/meet'
1422− navmode/'navbar'
1423− ==
1424−;>
1425−
1426−# Neo-Tokyo Urbit meetup
1427−
1428−![](https://ofheroesandcliches.files.wordpress.com/2014/06/neo-tokyo.png)
1429−
1430−Hi there! We meet once a week at The Chat to work on Urbit projects
1431−together.
1432−
1433−You can find out more about the group on the [about](about) page and
1434−follow our projects in [projects](projects).
1435−```
1436−
1437−This is our landing page. Here we're using a few new bits of frontmatter:
1438−`navdpad`, `navmode` and `navpath`. `navdpad` just turns off the nav
1439−arrows. `navmode` can be set to 'navbar' to switch to a horizontal top
1440−nav instead of a left bar. `navpath` sets the path to load the nav
1441−items from.
1442−
1443−Let's create `about.udon` and `projects.udon`. From Unix use the
1444−technique from before to create a new directory: `mkdir
1445−your-urbit/site/web/meet/; touch your-urbit/site/web/meet/about.udon`.
1446−Then put the following in `site/web/about.udon`:
1447−
1448−```
1449−:- :~ navhome/'/meet'
1450− navdpad/'false'
1451− navpath/'/meet'
1452− navmode/'navbar'
1453− title/'About'
1454− ==
1455−;>
1456−
1457−# About
1458−
1459−## Mission statement
1460−
1461−The existing framework cannot subdue the new human force that is increasing day
1462−by day alongside the irresistible development of technology and the
1463−dissatisfaction of its possible uses in our senseless social life.
1464−
1465−## Members
1466−
1467−Membership is open to anyone. Just send a message to `~talsur-todres`.
1468−
1469−- Shōtarō Kaneda
1470−- Motoko Kusanagi
1471−- Ishikawa
1472−- Faye Valentine
1473−- Spike Spiegel
1474−```
1475−
1476−And `site/web/projects.udon`:
1477−
1478−```
1479−:- :~ navhome/'/meet'
1480− navdpad/'false'
1481− navpath/'/meet'
1482− navmode/'navbar'
1483− title/'Projects'
1484− ==
1485−;>
1486−
1487−# Projects
1488−
1489−## Active
1490−
1491−;list;
1492−
1493−## Discussion
1494−
1495−;div(class "mini-module")
1496− ;script(src "/~/at/lib/js/urb.js");
1497− ;script(src "https://cdn.rawgit.com/seatgeek/react-infinite/0.8.0/dist/react-infinite.js");
1498− ;script(src "https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.11.2/moment-with-locales.js");
1499− ;script(src "https://cdnjs.cloudflare.com/ajax/libs/moment-timezone/0.5.1/moment-timezone.js");
1500− ;script(src "/talk/main.js");
1501− ;link(href "/talk/main.css", rel "stylesheet");
1502− ;talk(readonly "", chrono="reverse", station="comments");
1503−==
1504−```
1505−
1506−This page introduces a new thing: the `:talk` module. Inside of the
1507−`mini-module` div we load the scripts needed by the `;talk`
1508−component. The `;talk` component is a static component for
1509−displaying a feed from a talk channel inline. Here we're going to
1510−display the discussion from our active projects inline.
1511−
1512−We'll need a few active projects though. From unix: `mkdir
1513−your-urbit/site/web/meet/projects; touch
1514−your-urbit/site/web/meet/projects/bike.udon`.
1515−
1516−In `site/web/meet/projects/bike.udon`:
1517−
1518−```
1519−:- :~ navhome/'/meet'
1520− navdpad/'false'
1521− navpath/'/meet'
1522− navmode/'navbar'
1523− title/'Kaneda's Bike'
1524− comments/'true'
1525− ==
1526−;>
1527−
1528−# Urbit on a Motorcycle
1529−
1530−Discussion on getting urbit to power Kaneda's motorcycle.
1531−```
1532−
1533−Here we just use the `comments` frontmatter to enable comments on the page.
1534−Adding other imaginary projects is left to the reader.
1535−
1536−Building a static site takes only a few minutes and a few Udon files. Have fun!
using/shell.md+30−30
@@ -14,7 +14,7 @@ data in Urbit.
14You can use the Dojo to run arbitrary Hoon code, as well as non-Hoon system
14You can use the Dojo to run arbitrary Hoon code, as well as non-Hoon system
15commands.
15commands.
16
16
17−##### Math
17+### Math
18
18
19Evaluate a Hoon expression (whitespace matters):
19Evaluate a Hoon expression (whitespace matters):
20
20
@@ -44,7 +44,7 @@ Use `=var` to save faces to the Dojo subject.
44Note, however, that `=var` is Dojo syntax, not Hoon syntax. You cannot bind a
44Note, however, that `=var` is Dojo syntax, not Hoon syntax. You cannot bind a
45face in a `.hoon` file in this way.
45face in a `.hoon` file in this way.
46
46
47−##### System Commands
47+### System Commands
48
48
49Use `=dir` to set the current working directory:
49Use `=dir` to set the current working directory:
50
50
@@ -73,13 +73,13 @@ Run system commands from `:hood`, like `reload`, using `|`:
73~your-urbit:dojo> |reload %eyre
73~your-urbit:dojo> |reload %eyre
74```
74```
75
75
76−### Generators
76+## Generators
77
77
78Generators are short Hoon scripts, saved as `.hoon` files in the `/gen`
78Generators are short Hoon scripts, saved as `.hoon` files in the `/gen`
79directory. Many Dojo commands exist in the form of generators. The syntax for
79directory. Many Dojo commands exist in the form of generators. The syntax for
80running a generator is `+genname` for a generator saved as `genname.hoon`.
80running a generator is `+genname` for a generator saved as `genname.hoon`.
81
81
82−##### +cat
82+### +cat
83
83
84Accepts a path and displays the file. Similar to Unix `cat`.
84Accepts a path and displays the file. Similar to Unix `cat`.
85
85
@@ -87,7 +87,7 @@ Accepts a path and displays the file. Similar to Unix `cat`.
87~your-urbit:dojo> +cat %/gen/curl/hoon
87~your-urbit:dojo> +cat %/gen/curl/hoon
88```
88```
89
89
90−##### +code
90+### +code
91
91
92Generates a code that is used to remotely log into your ship. No
92Generates a code that is used to remotely log into your ship. No
93arguments.
93arguments.
@@ -96,7 +96,7 @@ arguments.
96~your-urbit:dojo> +code
96~your-urbit:dojo> +code
97```
97```
98
98
99−##### +curl
99+### +curl
100
100
101Retrives data from a URL. Accepts a `tape`. Similar to Unix `curl`.
101Retrives data from a URL. Accepts a `tape`. Similar to Unix `curl`.
102
102
@@ -104,7 +104,7 @@ Retrives data from a URL. Accepts a `tape`. Similar to Unix `curl`.
104~your-urbit:dojo> +curl "http://nyt.com"
104~your-urbit:dojo> +curl "http://nyt.com"
105```
105```
106
106
107−##### +hello
107+### +hello
108
108
109Just prints the argument. Accepts a `@ta`.
109Just prints the argument. Accepts a `@ta`.
110
110
@@ -112,7 +112,7 @@ Just prints the argument. Accepts a `@ta`.
112~your-urbit:dojo> +hello 'mars'
112~your-urbit:dojo> +hello 'mars'
113```
113```
114
114
115−##### +ls
115+### +ls
116
116
117Similar to Unix `ls`. Accepts a path.
117Similar to Unix `ls`. Accepts a path.
118
118
@@ -121,7 +121,7 @@ Similar to Unix `ls`. Accepts a path.
121~your-urbit:dojo> +ls /~talsur-todres/home/2/web/notes
121~your-urbit:dojo> +ls /~talsur-todres/home/2/web/notes
122```
122```
123
123
124−##### +moon
124+### +moon
125
125
126Generates a random moon from a planet. No arguments.
126Generates a random moon from a planet. No arguments.
127
127
@@ -129,7 +129,7 @@ Generates a random moon from a planet. No arguments.
129~your-urbit:dojo> +moon
129~your-urbit:dojo> +moon
130```
130```
131
131
132−##### +solid
132+### +solid
133
133
134Compile the current state of the kernel and output a
134Compile the current state of the kernel and output a
135noun. Usually downloaded to a file in unix. No arguments.
135noun. Usually downloaded to a file in unix. No arguments.
@@ -138,7 +138,7 @@ noun. Usually downloaded to a file in unix. No arguments.
138~your-urbit:dojo> .urbit/pill +solid
138~your-urbit:dojo> .urbit/pill +solid
139```
139```
140
140
141−##### +test
141+### +test
142
142
143Testrunner. Can test multiple generators at once, conventionally ones
143Testrunner. Can test multiple generators at once, conventionally ones
144in the `/test` folder. Takes a path.
144in the `/test` folder. Takes a path.
@@ -147,7 +147,7 @@ in the `/test` folder. Takes a path.
147~your-urbit:dojo> +test /lib
147~your-urbit:dojo> +test /lib
148```
148```
149
149
150−##### +ticket
150+### +ticket
151
151
152Generate a ticket for an urbit ship. Takes an urbit name (`@p`).
152Generate a ticket for an urbit ship. Takes an urbit name (`@p`).
153
153
@@ -156,7 +156,7 @@ Generate a ticket for an urbit ship. Takes an urbit name (`@p`).
156~your-urbit:dojo> +ticket ~talsur-todres-your-urbit
156~your-urbit:dojo> +ticket ~talsur-todres-your-urbit
157```
157```
158
158
159−##### +tree
159+### +tree
160
160
161Generate a recursive directory listing. Takes a path.
161Generate a recursive directory listing. Takes a path.
162
162
@@ -164,7 +164,7 @@ Generate a recursive directory listing. Takes a path.
164~your-urbit:dojo> +tree %/web
164~your-urbit:dojo> +tree %/web
165```
165```
166
166
167−### Hood
167+## Hood
168
168
169The hood is the system daemon. See `gen/hood` and `app/hood`.
169The hood is the system daemon. See `gen/hood` and `app/hood`.
170
170
@@ -212,7 +212,7 @@ number of vane names.
212
212
213## Manual
213## Manual
214
214
215−### Sources and sinks
215+## Sources and sinks
216
216
217A Dojo command is either a **source** or a **sink**. A source is just something
217A Dojo command is either a **source** or a **sink**. A source is just something
218that can be printed to your console or the result of some computation. A
218that can be printed to your console or the result of some computation. A
@@ -224,7 +224,7 @@ command.
224
224
225### Sinks
225### Sinks
226
226
227−##### `=` - Set variable
227+#### `=` - Set variable
228
228
229Set any environment variable:
229Set any environment variable:
230
230
@@ -238,11 +238,11 @@ Set any environment variable:
238Make sure to note that `=var` is Dojo syntax, not Hoon syntax. You cannot bind a
238Make sure to note that `=var` is Dojo syntax, not Hoon syntax. You cannot bind a
239variable in a `.hoon` file in this way.
239variable in a `.hoon` file in this way.
240
240
241−##### Special Variables
241+#### Special Variables
242
242
243There are a few special variables that the Dojo maintains.
243There are a few special variables that the Dojo maintains.
244
244
245−##### `:` - Send to app
245+#### `:` - Send to app
246
246
247`:app` goes to a local `app`, `:~ship/app` goes to the `app` on `~ship`.
247`:app` goes to a local `app`, `:~ship/app` goes to the `app` on `~ship`.
248
248
@@ -254,7 +254,7 @@ Send a `helm-hi` message to `hood`:
254
254
255Apps usually expect marked data, so `&` is often used here.
255Apps usually expect marked data, so `&` is often used here.
256
256
257−##### `*` - Save in `%clay`
257+#### `*` - Save in `%clay`
258
258
259Save a new `.udon` ([Udon](@/docs/using/sail-and-udon.md)) file in `web`:
259Save a new `.udon` ([Udon](@/docs/using/sail-and-udon.md)) file in `web`:
260
260
@@ -265,7 +265,7 @@ Save a new `.udon` ([Udon](@/docs/using/sail-and-udon.md)) file in `web`:
265The last component of the path is expected to be the mark (or mime
265The last component of the path is expected to be the mark (or mime
266type).
266type).
267
267
268−##### `.` - Export to Unix
268+#### `.` - Export to Unix
269
269
270Export a noun to Unix with `.`:
270Export a noun to Unix with `.`:
271
271
@@ -285,7 +285,7 @@ Which outputs a new `urbit.pill` to `pier/.urb/put/urbit.pill`
285
285
286### Sources
286### Sources
287
287
288−##### `&` - Mark conversion
288+#### `&` - Mark conversion
289
289
290Convert between marks using `&`, with the destination mark first. You can stack multiple mark conversions together, and some marks can only be converted to specific other marks. In this example, [Udon](@/docs/using/sail-and-udon.md#udon) is converted to `&hymn` (a mark which supplies the `html`, `head`, `body` and closing tags) first, before being converted to HTML:
290Convert between marks using `&`, with the destination mark first. You can stack multiple mark conversions together, and some marks can only be converted to specific other marks. In this example, [Udon](@/docs/using/sail-and-udon.md#udon) is converted to `&hymn` (a mark which supplies the `html`, `head`, `body` and closing tags) first, before being converted to HTML:
291
291
@@ -308,7 +308,7 @@ As does converting straight from Udon to HTML:
308';h1#hello: hello'
308';h1#hello: hello'
309```
309```
310
310
311−##### `_` - Run a function
311+#### `_` - Run a function
312
312
313Use `_` to run a gate (or function):
313Use `_` to run a gate (or function):
314
314
@@ -326,7 +326,7 @@ Use a function to get the status code from an http request:
326301
326301
327```
327```
328
328
329−##### `+` `-` - HTTP requests
329+#### `+` `-` - HTTP requests
330
330
331`+http[s]://example.com` - sends a GET request
331`+http[s]://example.com` - sends a GET request
332
332
@@ -338,7 +338,7 @@ JSON `"hi"` in the body.
338
338
339Note that the first of these is a source while the last two are sinks.
339Note that the first of these is a source while the last two are sinks.
340
340
341−##### `+` - Generators
341+#### `+` - Generators
342
342
343Generators are simple Hoon scripts loaded from the filesystem. They live
343Generators are simple Hoon scripts loaded from the filesystem. They live
344in `gen/`.
344in `gen/`.
@@ -356,7 +356,7 @@ fintyr-haldet-fassev-solhex
356You can use `=` to set an environment variable in Dojo, but there are
356You can use `=` to set an environment variable in Dojo, but there are
357a few reserved names that have special uses.
357a few reserved names that have special uses.
358
358
359−##### dir
359+#### dir
360
360
361Current working `%clay` desk and revision. Read / write.
361Current working `%clay` desk and revision. Read / write.
362
362
@@ -368,7 +368,7 @@ Current working `%clay` desk and revision. Read / write.
368404/hoon docs/ dojo/hoon lib/ listen/hoon md static/udon talk/ testing/udon tree/main/ unmark/ womb/
368404/hoon docs/ dojo/hoon lib/ listen/hoon md static/udon talk/ testing/udon tree/main/ unmark/ womb/
369```
369```
370
370
371−##### lib
371+#### lib
372
372
373Current set of libraries (`/lib`) in your environment. Can be set
373Current set of libraries (`/lib`) in your environment. Can be set
374with `/+`. Read / write.
374with `/+`. Read / write.
@@ -383,7 +383,7 @@ Now we can use arms from lib/number-to-words.hoon
383~your-urbit:dojo> (to-words:eng-us:number-to-words 123.456)
383~your-urbit:dojo> (to-words:eng-us:number-to-words 123.456)
384```
384```
385
385
386−##### sur
386+#### sur
387
387
388Current set of structures (`/sur`) in your environment. Can be set
388Current set of structures (`/sur`) in your environment. Can be set
389with `/-`. Read / write.
389with `/-`. Read / write.
@@ -398,7 +398,7 @@ Now we can use arms in sur/sole.hoon.
398~your-urbit:dojo> `sole-effect:sole`[%bel ~]
398~your-urbit:dojo> `sole-effect:sole`[%bel ~]
399```
399```
400
400
401−##### now
401+#### now
402
402
403The current (128-bit `@da`) time. Read-only.
403The current (128-bit `@da`) time. Read-only.
404
404
@@ -409,7 +409,7 @@ The current (128-bit `@da`) time. Read-only.
409~2016.3.21..21.10.57..429a
409~2016.3.21..21.10.57..429a
410```
410```
411
411
412−##### our
412+#### our
413
413
414The current urbit ship. Read-only.
414The current urbit ship. Read-only.
415
415
@@ -420,7 +420,7 @@ The current urbit ship. Read-only.
420~your-urbit
420~your-urbit
421```
421```
422
422
423−##### eny
423+#### eny
424
424
425512 bits of entropy. Read-only.
425512 bits of entropy. Read-only.
426
426