1-- A documentation page: a sidebar built from data, prose in htmlang and in
2-- Markdown, code samples, a table, and a component with scoped styles.
3-- `@h2:` and `@td:` style every heading and cell inside an element, the
4-- ones Markdown writes included.
5@page [lang=en, color var(--ink)] Getting started · htmlang docs
13-- The page this file renders, used to highlight it in the sidebar
17 {"title": "Introduction", "pages": [
18 {"id": "overview", "label": "Overview"},
19 {"id": "install", "label": "Getting started"},
20 {"id": "first-page", "label": "Your first page"}
22 {"title": "Guides", "pages": [
23 {"id": "layout", "label": "Layout"},
24 {"id": "styling", "label": "Styling"},
25 {"id": "functions", "label": "Functions"},
26 {"id": "data", "label": "Data and loops"}
30-- Code samples: the lines under @code are shown exactly as written, @ and all
32 @pre [padding 16, background var(--code-bg), border-radius 8, font-size 14, line-height 1.5, overflow-x auto]
35-- A callout with its own stylesheet. The @style rules are scoped to the
36-- function's root element; & is the root itself.
37@let @callout [kind Note]
39 & { border-inline-start: 4px solid var(--accent); }
40 .label { font-weight: 700; color: var(--accent); }
41 @aside [padding 12 16, spacing 4, background #eff6ff, border-radius 6]
42 @text [class=label] $kind
53 border-right 1 solid var(--line),
57 @link [font-weight 800, font-size 18] / htmlang
59 @each $section in $sections
61 @text [font-size 12, font-weight 700, color var(--muted), text-transform uppercase, letter-spacing 1] $section.title
62 @each $item in $section.pages
66 hover:background var(--code-bg),
67 if($item.id == $current, [background var(--code-bg), font-weight 600, aria-current=page])
68 ] /docs/$item.id $item.label
71 @main [width fill, padding 48 24, md:padding 48 56]
72 @article [max-width 760, spacing 20, line-height 1.7, @h2:[font-size 24, margin-block-start 16]]
74 @text [font-size 14, color var(--muted)] Introduction
75 @h1 [font-size 40, line-height 1.2] Getting started
77 @paragraph [font-size 18]
78 htmlang is a small layout language that compiles to static HTML. This
79 guide takes about five minutes: install the compiler, write a page,
80 and see it in the browser.
82 @h2 [id=install] Install
84 cargo install --path .
86 @h2 [id=first-page] Your first page
88 Create a file called {@code hello.hl}:
91 @el [padding 40, spacing 16]
96 Then start the dev server and open the page. It recompiles and reloads
97 whenever you save; press {@kbd [padding 1 6, border 1 solid var(--line), border-radius 4, font-size 14] Ctrl+C} to stop it.
103 The output is one {@code .html} file with its CSS inside and no
104 JavaScript, so you can open it straight from disk.
108 border-collapse collapse,
111 @th:[padding 8, text-align left],
113 @tr:border-bottom 1 solid var(--line),
114 @tr:last-child:border-bottom none
117 @tr [border-bottom 2 solid var(--line)]
123 @td Compile one file to page.html
126 @td Serve a folder with live reload
128 @td htmlang build src -o dist
129 @td Compile a whole site
131 @td htmlang check page.hl
132 @td Report problems without writing output
134 -- Longer prose can be Markdown, styled by the element around it
135 @section [@code:[padding 1 4, background var(--code-bg), border-radius 4], @li:margin-block 4]
139 - Read about **layout**: `@row`, `@el`, `spacing` and `width fill`.
140 - Style anything with CSS properties: `[padding 20, color navy]`.
141 - Turn repeated markup into functions with `@let @name`.
143 @row [spacing 12, padding-block-start 24, border-top 1 solid var(--line), font-weight 600, @link:color var(--accent)]
144 @link /docs/overview ← Overview
146 @link /docs/first-page Your first page →
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list