Documentation from Markdown, rendered by the kernel so both execution modes write the same pages.
Import with use doc. Documentation from Markdown, rendered by the kernel so the interpreter and compiled programs produce the same pages. The Crow Book is built with it (docs/book/site.co).
| Function | Description | Example |
|---|---|---|
markdown[text] | Markdown to HTML: headings get anchor ids, links to .md files point at .html pages, fenced crow blocks are highlighted with Crow's own token rules and tagged data-mode (run, error) | Documentation: use doc |
chapters[summary] | An mdBook-style summary (# Part headings, - [Title](path) items nested by indentation) as a frame with columns title path depth part | Documentation: use doc |
menu[chapters, current] | Navigation markup for the chapters frame: a brand link, parts as headings, collapsible groups for chapters with sub-chapters (open around the current page), the current page marked, links relative to the current page | Documentation: use doc |
pager[chapters, current] | Previous and next chapter links for the current page, in summary order | Documentation: use doc |
plain[text] | The words of a chapter with markup removed and whitespace collapsed — what a search index holds | Documentation: use doc · Web: responses and submodules |
document[title, body] | A complete HTML page: the kernel stylesheet (tokens, elements, responsive rules) plus the documentation rules, then the body | Documentation: use doc · Views: the whole element vocabulary · View Blocks |
markdown, menu and pager make markup, which a view places as markup, so a rendered chapter or a menu can be a child of stack[...] or row[...]; every other string is text and is escaped (§ Views: Text is text). A view's tree handed to document[...] is its markup in both modes.
use web, ui, doc
view chapter[title, body, nav]
return row[stack[nav, width = '240px', hidden_below = 'tablet'],
stack[body, fill = 'true', class = 'doc'], gap = 'xl']
toc = doc.chapters[read['docs/book/src/SUMMARY.md']]
for i in range[len[toc]]
path = toc.path[i]
body = doc.markdown[read['docs/book/src/`path`']]
page = doc.document[toc.title[i], chapter[toc.title[i], body, doc.menu[toc, path]]]
html_path = replace[path, '.md', '.html']
write['docs/book/crow-site/`html_path`', page]
Generated by crow test --docs --write from the language specification, section 11 and 13. Edit the spec, not this page.