Changelog

0.7

Docs and code

Code blocks, a search index, a sitemap, 404 pages and a flag for page scripts, found while building this website.

Building Verso's own documentation meant writing about code, so rich text had to hold code properly. A docs site needs search, a sitemap and a real 404 page, and an interactive page needs to know when it is being edited.

Code in rich text

  • A new rich text tool, code, adds code blocks and inline code. Type three backticks, a language and a space to start a block. Whitespace is kept exactly, and the language is saved as data-lang.
  • Inline code: press ⌘E or wrap words in backticks. Inside a block, Tab inserts two spaces and ⌘Enter leaves the block.
  • Ordered lists come with the lists tool.
{{ body:rich:headings:lists:links:code }}

For page scripts

  • In the editor, <html> carries data-verso-editing. A script can check for it and leave editable fields alone, so highlighting or reflowing never fights the person typing.
const editing = document.documentElement.hasAttribute('data-verso-editing');
if (!editing) highlightCode();

Order, search and the rest

  • {{ each:docs:order }} sorts pages by the order set in the site view. Pages without an order come last, by title.
  • With "index": true in verso.json, the build writes pages.json. It lists every live page with its title, description, headings and text, ready for search.
  • With "url" set, the build writes sitemap.xml.
  • content/404/ also becomes dist/404.html, which most hosts show for missing pages.