Skip to the article
Senu 日本語

What you built, and where to go next

About 4 min read

You started a Rust program, read its pages in a browser, wrote notes in Markdown, met Senu's rules through its messages, and rebuilt one of its functions test first. Every step used the same small program.

What to remember

Honest limits

The program you ran is the demo of the Senu library, not a product. This site reads the notes only when it is built, and it has no accounts, no database and no way to edit a note from the browser. It has been tested on Linux only. The library behind it is what services are built with; the library guide starts there.

Where to go next

Exercise

Write one more note in your own words about something you learned here. Give it the number 53, and link to it from your first note.

Solution. Any file named like content/en/53-what-i-learned.md whose first line is a title works. Link to it from content/en/51-my-first-note.md with a line such as Read [what I learned](/what-i-learned)., restart Senu, and follow the link.

Optional: change the look

Senu's pages get their look from Tailwind CSS, small classes such as bg-white (a white background) in templates/*.html. Tailwind writes a CSS rule only for the classes it finds there, into assets/ui.generated.css, and Cargo builds that committed file into Senu, so nothing else was needed so far. Changing a class needs Node.js 24 with its npm, once; install it from its website, then check:

node --version

Stop Senu with Ctrl+C. Open templates/site_base.html in your editor and find the line <header class="border-b border-gray-200 bg-white">. On that line, replace bg-white with bg-rose-100, then save the file. This gives the top bar a light rose background; no template uses rose yet. The skip link just above also uses bg-white; leave it as it is. The box below shows the same change as a diff: the line that starts with - is the old line, the line that starts with + is the new one, and the lines that start with a space are unchanged context that shows where. You do not type the -, the + or the leading space:

--- a/templates/site_base.html
+++ b/templates/site_base.html
@@ -11,3 +11,3 @@
 <a href="#main" class="absolute -top-16 left-2 z-10 border-2 border-blue-700 bg-white px-3 py-2 text-blue-700 underline focus:top-2"><%= frame.labels.skip %></a>
-<header class="border-b border-gray-200 bg-white">
+<header class="border-b border-gray-200 bg-rose-100">
 <div class="mx-auto flex max-w-6xl flex-wrap items-baseline justify-between gap-x-6 gap-y-2 px-5 py-3">

The stylesheet has no rule for the new class yet, so grep -c, which counts matching lines, prints 0 and exits 1:

grep -c bg-rose-100 assets/ui.generated.css
0

npm ci installs, once, the exact tools that package-lock.json lists, and --silent hides its report. npm run css rebuilds the stylesheet after each change of a class:

npm ci --silent
npm run css

> css
> tailwindcss -i assets/ui.css -o assets/ui.generated.css --minify

≈ tailwindcss v4.3.3

Done in 0ms

grep -o prints only the matching part, here the new rule:

grep -o '\.bg-rose-100{[^}]*}' assets/ui.generated.css
.bg-rose-100{background-color:var(--color-rose-100)}

Start Senu again and reload http://127.0.0.1:3000/ to see the rose top bar:

cargo run --quiet -- site
senu: listening on http://127.0.0.1:3000

Commit the template together with assets/ui.generated.css, so that readers without Node see the same look. To change the fonts or colours of every page instead, edit the @theme block in assets/ui.css and run npm run css again. Links inside articles are the exception: Typography keeps its own colours there, so @theme does not change their colour; a prose-a: class on <main> in templates/site_base.html does.