Expand description
lindisfarner — a digital scriptorium.
Turn plain text or source code into an “illuminated” page: a large ASCII-art initial opens the text, chosen words are rubricated, marginal drolleries and pilcrows adorn it, and the whole is set inside a decorative border.
§Illuminating prose
render takes the source and a Config and returns the finished page as
a String:
use lindisfarner::{render, Config};
let page = render("Hail and well met, traveller.", &Config::default());
assert!(page.contains('❦')); // the ornate frame's flourishSet Config::corrupt to let a careless scribe introduce transcription
errors, varied deterministically by Config::seed.
§Illuminating code
Set Config::code to treat the input as source rather than prose: lines are
kept verbatim, the language’s keywords are rubricated, and comments are lifted
into the margin as glosses. Name the language with Config::language, or
derive it from a path with detect_language.
use lindisfarner::{render, Config};
let cfg = Config { code: true, language: Some("rust".into()), ..Config::default() };
let page = render("fn main() {} // the entry point\n", &cfg);
assert!(page.contains("the entry point")); // the comment becomes a glossrender_glossed lays out explicit (code, gloss) rows — each line of code
beside a note in the margin — for building commentary pages directly.
§Searching code, and the magnifica modes
With the cli feature (on by default), two further modules back the
command-line tool:
search— run a Semgrep pattern or rule set over a path and gloss the matches (the--findand--scanmodes).magnifica— an art project that finds where a codebase uses AI and writes the words of the encyclical Magnifica Humanitas into those files, annotating or breaking them (the--magnificamodes).
Both pull in extra dependencies; drop them with default-features = false.
Modules§
- magnifica
- The magnifica art-project modes, behind the
clifeature. Powers--magnifica. The magnifica modes — an art project on the use of AI tools, named for the encyclical Magnifica Humanitas. - search
- Semgrep-backed code search, behind the
clifeature. Powers--findand--scan. The Semgrep bridge.
Structs§
- Config
- Everything that controls how a page is rendered. Construct via
Config::defaultand adjust the fields you care about.
Enums§
- Border
- The frame drawn around the page.
- DropCap
- Which paragraphs receive an illuminated initial.
- Font
- The typeface for the illuminated initials.
- Theme
- The colour palette for the illuminated “pigments”.
Constants§
- MIN_
WIDTH - The narrowest a body column is allowed to get, so the page stays readable.
Functions§
- detect_
language - The canonical language name for a filename’s extension, if recognised (e.g.
"main.rs"→Some("rust")). Used to auto-enable code mode. - render
- Render
sourceinto a finished, illuminated page. - render_
glossed - Render explicit
(code, gloss)rows as an illuminated commentary page: each code line rubricated, its gloss set in the margin, the whole framed. Used to present--findmatches (the gloss is each match’sfile:line).