SelfscribeDownloadOpen the app

Reference

Every word of the rules block on one page. In the app, F1 on any of them opens its entry, with an example to try.

A rule

#
text
WHERE  PATTERN  -> BECOMES  [attributes] [options] [{ css }] [as NAME]
WhereMatches
lineA whole line, after its indentation.
inlineA piece of a line between two marks you type: ==_==.
blockAn opening line, the lines after it, and a closing line: ::: tip ... :::.
wordA word or phrase anywhere outside code, or a sign and one word: @_.

Patterns

#
WriteMeans
_Any text. It becomes the content.
_1 … _9Numbered text, to use in an attribute: href=_2.
_#One or more digits, not kept: _#. _ matches 1. and 10.
_ in a word ruleOne word: letters, digits and _, with - . : / inside.
... In a block pattern, the lines between the opening and the closing line.
\_A backslash makes the next character literal: this is an underscore.
set slot $$ stands for text instead of _ in the rules that follow.

The longer pattern wins, then the later rule. _ counts nothing, so word @ana wins over word @_.

What a rule becomes

#
  • An element, with classes after dots: p, h2, strong, mark, kbd, div.note.
  • A plugin: chart, mermaid, math, view and the others in the Dictionary.
  • hidden leaves the text out. text keeps the words alone, with no element.
  • Attributes: name=value, href=_2, title="was _1".

Options

#
OptionEffect
group XWraps neighbouring matches in one X.
nestPuts more-indented lines inside.
fold, fold NLets the section fold.
split "S" TCuts the line at S into pieces, each a T.
keepKeeps the marks in the output.
boundMatches only at the edges of words.
verbatimApplies no other rules inside, and keeps the spacing.
input=checkbox [checked]Puts a tick box in front.
key SHORTCUTApplies the rule from the keyboard while you write.
as NAMENames the rule, for off NAME and the Inspector.

Lines of the rules block

#
LineDoes
use NAME, use ./file.selfBorrows a rulebook's rules, right there.
off PATTERN, off NAMESwitches off an earlier rule.
palette NAME COLOUR [dark COLOUR]Names a colour. Rules use it as var(--NAME). palette alone takes indented entries.
class NAME { css }Styles every element with that class. A rule's own CSS wins over it.
set KEY VALUEA setting, below, or a value the var plugin shows.
scope NAME … scopeRules that apply only between @scope NAME and @end in the text.
rewrite block PATTERN -> PLUGINA short notation for a plugin's language, with indented line shortcuts.
rule NAMEA rule written as indented key lines: where, match, out, style.
# …A comment. # ---- Part ---- and # region … # endregion fold.

Settings

#
SettingValues
set titleThe document's title.
set styleLook words that add up: paper newspaper academic, dark light, wide compact, serif sans mono justified, numbered dropcap columns.
set font, set heading-fontA typeface: Literata, Inter, or any installed font.
set pageA4 A5 A3 Letter Legal, landscape, margins narrow, normal or wide.
set widthThe reading column: 40em, 70ch or full.
set layoutscroll, pages or slides.
set langThe language: en-GB, fr, de.
set themeA theme for the whole app while the document is open: sepia, nord.
set author, set description, set cover, set dateWhat every export says about the document.
set linebreaks keepEach line ends where you wrote it.
set blanklines keepBlank lines make space.
set rules hideThe rules block starts folded.
set project offLeaves out the folder's rules.
set currency £Money columns show the sign.
set holidays NAMEA table of days that working days skip.
set merge NAMEThe rows of a mail merge.

In preferences.self

#

Your own settings are set lines in preferences.self. Settings writes them.

SettingValues
set key-COMMANDNew keys for a command: set key-view.wrap Alt+Shift+Z, or none.
set vim onVim keys in the editor.
set autocorrect offNo corrections as you type.
set smart-typography onCurly quotes, dashes and the ellipsis as you type.
set style-check onQuiet hints on wordy phrases and long sentences.
set document-themes offA document's set theme never changes the app.

In the text

#
WriteMeans
\*not italic\*A backslash before a mark makes it plain text.
@scope NAME … @endThe lines between use that scope's rules.
maxwidth:800px after a block's nameThe block's size: width, maxwidth, height, maxheight, align.

Palettes and classes

#
Palette entryClass
NameA lower-case letter, then lower-case letters, digits and -.A letter, then letters, digits, - and _.
ValueA CSS colour or value. It may use earlier entries.CSS declarations.
darkA colour for dark pages. Not for gradients.None.
Same name againThe later entry replaces the whole earlier one.The later class replaces the earlier one.

Both come in with use, like rules. Each hex colour also gets --on-NAME, a text colour that reads on it.

The page's colours and fonts

#

Rules may read the page's tokens: --doc-bg, --doc-fg, --doc-muted, --doc-heading, --doc-link, --doc-accent, --doc-border, --doc-code-bg, --doc-mark-bg, --doc-font, --doc-font-heading, --doc-font-ui for labels and badges, and --doc-font-mono for code.

From weakest to strongest, the page is styled by the built-in page, the look and page settings, classes, rules, the folder's selfscribe.css, then the document's style block.

Words

#
WordMeans
Rules blockThe lines between ~~~ selfscribe and ~~~ at the top of a document.
RuleOne line of it: where to look, the pattern, what it becomes, how it looks.
RulebookRules saved under a name, such as markdown or your own, borrowed with use.
LookThe overall style of the page: set style paper.
AppearanceThe app's theme. It never travels with a document.
PluginA part of the app that draws something richer from text.
ProblemSomething Selfscribe could not read as you meant it, said on its line.
FolderA folder of documents, open in the Files panel.
Folder rulesA selfscribe.self at the top of a folder, used by every document in it.
WorkbookDocuments bound in reading order by a workbook.self.
Side panelThe panel beside the text: Files, Outline, Inspector, Help. The rail is the strip of buttons that opens them.
Reading columnThe width of the text on screen: set width 40em.
DraftText you had not saved when the window closed.
VersionA copy kept each time you save.
EngineThe part that reads a document and draws it, the same in the app, on the web and on the command line.

The specification has the exact rules, for people who build on the engine.