# Alias and diff books

An alias points to content instead of copying it; a diff adds a layer of
changes on top of it. Both work on bits by their IDs, so they stay valid when
the original is updated.

## Alias books and bits

An alias book shows another book under its own properties: its own title,
publisher or theme. A white-label edition or a co-published version needs no
copy, and every update to the original reaches the alias.

```bitmark
[.book-alias]
[#Electrical installations — training edition]
[@publisher: Example Training Centre ]
[@theme: training ]
[@bookAlias: iec-60364-ed3 ]
```

An alias bit places a single bit of another book here, by its ID:

```bitmark
[.bit-alias][►p_4_1]
```

## Diff books

A diff book is a layer of changes on a base book. Each change is a
`[.bit-diff]` that names its target bit and the hash of that bit as it was
when the change was written. If the base has changed since, applying the
change raises a warning instead of silently writing over new content.

```bitmark
[.book-diff]
[#Swiss deviations]
[@bookDiff: iec-60364-ed3 ]

[.bit-diff]
[@diffRef: p_4_1 ]
[@diffBase: 7c21a9f0d2d0a206 ]
In Switzerland the limit is 0.2 seconds.
==== patch ====
[@diffOp:substitute][@diffAt:body][@diffFind:0.4 seconds]
--
0.2 seconds
```

- `@diffRef` is the target bit, `@diffBase` the hash it had.
- The body explains the change to a person.
- Each `==== patch ====` card is one operation: `test`, `replace`, `remove`,
  `add` or `substitute`, at a path inside the bit (`@diffAt`).

Typical layers:

- national deviations on an international norm;
- a training layer on a norm, with explanations and videos;
- a customer's annotations;
- translations;
- amendments.
