SelfscribeDownloadOpen the app

Contract that checks itself

Clauses number themselves and obligations stand out as you draft.

Document · Advanced · uses print, markup

Edit it in the playgroundRead the file

What it shows

Make a formal document check its own drafting as you write.

What you learn

Word rules that colour duties and conditions, classes that several words share, defined terms, clause numbers from CSS counters, a schedule and signature boxes from split lines, a style check that marks -ing words, long sentences, the passive and repeated words.

Try this

  • Write MUST NOT in a clause, then change forbid in the palette, and every prohibition takes the new colour.
  • Change long 35 in the style check to long 25, and more sentences are marked as too long.
examples/formal-check.self · 158 lines
~~~ selfscribe
# Lesson: Make a formal document check its own drafting as you write.
# You learn: word rules that colour duties and conditions, classes that several words share, defined terms, clause numbers from CSS counters, a schedule and signature boxes from split lines, a style check that marks -ing words, long sentences, the passive and repeated words.
# Try this: write MUST NOT in a clause, then change `forbid` in the palette, and every prohibition takes the new colour.
# Try this: change `long 35` in the style check to `long 25`, and more sentences are marked as too long.
# summary: Clauses number themselves and obligations stand out as you draft.
# category: writing
# tags: document, advanced, work
# uses: print, markup
use markdown
set title Contract that checks itself
set style paper
set font EB Garamond

# ---- ```lint ... ```: the drafting check; each line names one thing to mark in the text ----
block  ``` lint ... ```   -> lint   verbatim
# ---- ```style ... ```: CSS for this page only: the article and clause numbers --------------
block  ``` style ... ```  -> style  verbatim

# ---- The head: "title …" and "subtitle …", centred -------------------------------------------
line   title _          -> div.fc-title     { text-align: center; font: 600 1.75em/1.2 var(--doc-font); letter-spacing: 0.16em; text-transform: uppercase }  as fc-title
line   subtitle _       -> div.fc-subtitle  { margin: 0.5em 0 2em; padding-bottom: 1.4em; border-bottom: 1px solid var(--rule); text-align: center; font-style: italic; opacity: 0.75 }  as fc-subtitle

# ---- "key Label | value": a line of the schedule, label on the left -------------------------
line   key _            -> div.fc-key       split "|" span  group div.fc-schedule  { display: grid; grid-template-columns: 7.5em 1fr; gap: 1em; padding: 0.45em 0; border-bottom: 1px solid var(--rule) }  as fc-key
class  fc-schedule  { margin: 1.2em 0 0.4em; border-top: 2px solid currentColor }
class  fc-key > span:first-child  { font-variant: small-caps; letter-spacing: 0.06em; opacity: 0.7 }

# ---- "§ text" is a clause, "§§ text" a sub-clause; the style block numbers them --------------
line   § _              -> div.clause       { position: relative; margin: 0.55em 0; padding-left: 2.8em }  as fc-clause
line   §§ _             -> div.subclause    { position: relative; margin: 0.3em 0; padding-left: 4.6em; font-size: 0.97em }  as fc-subclause

# ---- ("Tenant") defines a term, [Tenant] refers to it; both in small capitals ----------------
inline ("_")            -> dfn.term         keep  { font-style: normal; font-weight: 700; font-variant: small-caps; letter-spacing: 0.04em }  as fc-define
inline [_]              -> span.term        bound  { font-variant: small-caps; letter-spacing: 0.04em; border-bottom: 1px dotted currentColor }  as fc-term

# ---- "sign Name | role": a box to sign in; the boxes sit side by side ------------------------
line   sign _           -> div.fc-sign      split "|" span  group div.fc-signs  { display: flex; flex-direction: column; padding-top: 3.4em }  as fc-sign
class  fc-signs  { display: grid; grid-template-columns: repeat(auto-fit, minmax(12em, 1fr)); gap: 0 3em; margin: 2.4em 0 1.6em }
class  fc-sign > span:first-child  { padding-top: 0.4em; border-top: 1px solid currentColor; font-weight: 600 }
class  fc-sign > span:last-child  { font-variant: small-caps; letter-spacing: 0.05em; opacity: 0.7 }

# ---- SHALL, MUST, SHOULD, MAY, IF, UNLESS, AND, OR, NOT: coloured wherever they appear -------
# The obligation words follow RFC 2119; each colour has its shade for dark pages.
palette
  forbid   #c92a2a  dark #ff8787
  duty     #c2410c  dark #ff8a4c
  advice   #a15c07  dark #ffc078
  allow    #2f7d3a  dark #69db7c
  cond     #1864ab  dark #74c0fc
  logic    #6741d9  dark #b197fc
  rule     color-mix(in srgb, currentColor 18%, transparent)
# Each kind is a class; its words only name it, so UNLESS and PROVIDED THAT are blue like IF.
class  must-not  { color: var(--forbid); font-weight: 800 }
class  must      { color: var(--duty); font-weight: 800 }
class  should    { color: var(--advice); font-weight: 700 }
class  may       { color: var(--allow); font-weight: 700 }
class  cond      { color: var(--cond); font-weight: 800; letter-spacing: 0.02em }
class  logic     { color: var(--logic); font-weight: 800 }
word   SHALL NOT        -> span.must-not
word   MUST NOT         -> span.must-not
word   SHALL            -> span.must
word   MUST             -> span.must
word   SHOULD           -> span.should
word   MAY              -> span.may
word   IF               -> span.cond
word   UNLESS           -> span.cond
word   PROVIDED THAT    -> span.cond
word   AND              -> span.logic
word   OR               -> span.logic
word   NOT              -> span.logic

# ---- "::: notes … :::": notes for the reader of this example, set apart from the agreement ---
block  ::: notes ... :::  -> aside.notes    { margin-top: 3em; padding: 1.2em 1.4em 0.4em; border-radius: 10px; background: color-mix(in srgb, currentColor 5%, transparent) }  as fc-notes
~~~
title Tenancy agreement
subtitle An assured shorthold tenancy · draft for comment, 2 February 2026

This agreement is made between Elm Row Lettings Ltd of 3 Park Square, Leeds ("Landlord") and Ana Sousa ("Tenant") for the home described in the schedule ("Property"). Words in small capitals mean what they are defined to mean.

key Property | Flat 2, 14 Elm Row, Leeds LS6 2AB
key Term | twelve months from 1 March 2026
key Rent | £950 a month, by bank transfer
key Deposit | £1,096, protected with the Deposit Protection Service

## Rent

§ The [Tenant] SHALL pay the rent on the first day of each month, to the account named by the [Landlord].
§ IF the rent is more than fourteen days late, the [Landlord] MAY charge interest at 3% above the base rate, PROVIDED THAT a written reminder was sent first.
§§ Interest is calculated daily AND is added to the next month's rent.
§§ No interest is charged IF the delay is caused by the bank.

## Deposit

§ The [Tenant] SHALL pay the deposit before the start of the term.
§ The [Landlord] MUST protect the deposit within thirty days AND give the [Tenant] the scheme's details in writing.

## Use of the Property

§ The [Tenant] MUST NOT sublet the [Property] OR any part of it UNLESS the [Landlord] agrees in writing.
§ The [Tenant] SHOULD tell the [Landlord] about any repairs needed, including dripping taps, failing heaters and anything else that is getting worse over time, as soon as reasonably possible, so that small problems are fixed before they become large and expensive problems for both parties.
§ Pets MAY be kept IF they are small, quiet AND NOT a nuisance to the the neighbours.

## Repairs

§ The [Landlord] SHALL keep the structure, the heating AND the hot water in good repair.
§ Repairs that are reported in writing will be carried out within fourteen days.

## Ending the tenancy

§ Either party MAY end this agreement by giving two months' notice in writing.
§ The deposit SHALL be returned within ten days, less any costs that were agreed OR were decided by the deposit scheme.

sign Elm Row Lettings Ltd | for the Landlord
sign Ana Sousa | the Tenant

```lint
# Drafting check
exact SHALL MUST MAY SHOULD     as Obligations  colour
ending ing                      as -ing words   underline
long 35
passive
repeats
```

::: notes
## How it's made

The agreement is plain text with a drafting check on top. Word rules colour the duties and conditions: SHALL and MUST in orange, MAY in green, IF and UNLESS in blue. The colours come from classes, so several words share each one.

Each `§` line is a clause and each `§§` line a sub-clause. The style block at the end numbers the headings and the clauses, 1.1, 1.2 and 1.2.1, starting again under each heading.

The `lint` block above these notes checks the whole agreement. It marks the long sentence and its -ing words in clause 3.2, the passive in 4.2 and the doubled word in 3.3.

## Try it yourself

1. Add a clause under Use of the Property: `§ The [Tenant] MUST NOT smoke in the [Property].` It is numbered 3.4, and MUST NOT turns red.
2. In the palette, change `forbid` to #862e9c. Every prohibition turns purple.
3. Delete the doubled word in clause 3.3. The mark on it goes.
4. In the style check, change `long 35` to `long 25`. More sentences are marked as too long.

Next: *Tracked changes* marks edits for review; *Letter to a list* writes one letter to many people.
:::

```style
/* Article and clause numbers: 1, then 1.1, 1.2 … starting again at every article, and 1.2.1 for
   sub-clauses. The counters live on the page, so they count across the blocks the editor draws
   separately. The notes at the end are left out. */
.self-doc { counter-reset: article clause subclause; }
h2 { counter-increment: article; counter-set: clause 0; margin: 1.9em 0 0.6em; font-size: 1em; letter-spacing: 0.12em; text-transform: uppercase; }
h2::before { content: counter(article) "."; display: inline-block; min-width: 2.2em; }
.clause { counter-increment: clause; counter-set: subclause 0; }
.clause::before { content: counter(article) "." counter(clause); position: absolute; left: 0; opacity: 0.6; }
.subclause { counter-increment: subclause; }
.subclause::before { content: counter(article) "." counter(clause) "." counter(subclause); position: absolute; left: 1.4em; opacity: 0.55; }
.notes h2 { counter-increment: none; font-size: 1.15em; letter-spacing: 0; text-transform: none; }
.notes h2::before { content: none; }
```