From 37ba3383baee98bd26d3b96638db670f0c1014cc Mon Sep 17 00:00:00 2001 From: jostein Date: Thu, 26 Mar 2026 10:15:02 +0100 Subject: [PATCH] Updating iA-writer section --- .../Contents/Info.plist | 52 +++ .../Contents/Resources/document.html | 23 ++ .../Contents/Resources/footer.html | 50 +++ .../Contents/Resources/header.html | 54 +++ .../Contents/Resources/style.css | 227 ++++++++++++ .../Contents/Resources/title.html | 132 +++++++ convertion_templates_iA-Writer/README.md | 328 ++++++++++++++++++ 7 files changed, 866 insertions(+) create mode 100644 convertion_templates_iA-Writer/ExampleTemplate_CleanDoc.iatemplate/Contents/Info.plist create mode 100644 convertion_templates_iA-Writer/ExampleTemplate_CleanDoc.iatemplate/Contents/Resources/document.html create mode 100644 convertion_templates_iA-Writer/ExampleTemplate_CleanDoc.iatemplate/Contents/Resources/footer.html create mode 100644 convertion_templates_iA-Writer/ExampleTemplate_CleanDoc.iatemplate/Contents/Resources/header.html create mode 100644 convertion_templates_iA-Writer/ExampleTemplate_CleanDoc.iatemplate/Contents/Resources/style.css create mode 100644 convertion_templates_iA-Writer/ExampleTemplate_CleanDoc.iatemplate/Contents/Resources/title.html create mode 100644 convertion_templates_iA-Writer/README.md diff --git a/convertion_templates_iA-Writer/ExampleTemplate_CleanDoc.iatemplate/Contents/Info.plist b/convertion_templates_iA-Writer/ExampleTemplate_CleanDoc.iatemplate/Contents/Info.plist new file mode 100644 index 0000000..149fdfc --- /dev/null +++ b/convertion_templates_iA-Writer/ExampleTemplate_CleanDoc.iatemplate/Contents/Info.plist @@ -0,0 +1,52 @@ + + + + + + + CFBundleName + ExampleTemplate CleanDoc + + CFBundleIdentifier + com.cleandoc.exampletemplate.v2 + + + IATemplateDocumentFile + document + + IATemplateTitleFile + title + + IATemplateHeaderFile + header + + IATemplateFooterFile + footer + + + IATemplateHeaderHeight + 60 + + IATemplateFooterHeight + 50 + + + IATemplateTitleUsesHeaderAndFooterHeight + + + IATemplateDescription + Clean Roboto document template for A4 PDF export with title page. + + IATemplateAuthor + ExampleTemplate CleanDoc + + + diff --git a/convertion_templates_iA-Writer/ExampleTemplate_CleanDoc.iatemplate/Contents/Resources/document.html b/convertion_templates_iA-Writer/ExampleTemplate_CleanDoc.iatemplate/Contents/Resources/document.html new file mode 100644 index 0000000..3249c58 --- /dev/null +++ b/convertion_templates_iA-Writer/ExampleTemplate_CleanDoc.iatemplate/Contents/Resources/document.html @@ -0,0 +1,23 @@ + + + + + + <span data-title></span> + + + + +
+ + diff --git a/convertion_templates_iA-Writer/ExampleTemplate_CleanDoc.iatemplate/Contents/Resources/footer.html b/convertion_templates_iA-Writer/ExampleTemplate_CleanDoc.iatemplate/Contents/Resources/footer.html new file mode 100644 index 0000000..4179190 --- /dev/null +++ b/convertion_templates_iA-Writer/ExampleTemplate_CleanDoc.iatemplate/Contents/Resources/footer.html @@ -0,0 +1,50 @@ + + + + + + + + + + + diff --git a/convertion_templates_iA-Writer/ExampleTemplate_CleanDoc.iatemplate/Contents/Resources/header.html b/convertion_templates_iA-Writer/ExampleTemplate_CleanDoc.iatemplate/Contents/Resources/header.html new file mode 100644 index 0000000..c197f87 --- /dev/null +++ b/convertion_templates_iA-Writer/ExampleTemplate_CleanDoc.iatemplate/Contents/Resources/header.html @@ -0,0 +1,54 @@ + + + + + + + + +
+ +
+
+ + diff --git a/convertion_templates_iA-Writer/ExampleTemplate_CleanDoc.iatemplate/Contents/Resources/style.css b/convertion_templates_iA-Writer/ExampleTemplate_CleanDoc.iatemplate/Contents/Resources/style.css new file mode 100644 index 0000000..9f9980b --- /dev/null +++ b/convertion_templates_iA-Writer/ExampleTemplate_CleanDoc.iatemplate/Contents/Resources/style.css @@ -0,0 +1,227 @@ +/* ============================================================ + CleanDoc — Shared Styles + Roboto type system, A4 document layout + ============================================================ */ + +@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,300;0,400;0,500;0,700;1,400;1,700&family=Roboto+Mono:wght@400;500&display=swap'); + +/* --- Design tokens ---------------------------------------- */ +:root { + /* Typefaces */ + --font-body: 'Roboto', -apple-system, sans-serif; + --font-mono: 'Roboto Mono', 'Courier New', monospace; + + /* A4 content column + A4 = 210mm wide. 25mm side margins each = 160mm text width. + At 96dpi: 160mm × (96/25.4) ≈ 605px. + We use 620px — a comfortable line measure for Roboto 10.5pt. */ + --content-width: 620px; + + /* Type scale — Minor Third (1.2×) anchored at 10.5pt + 10.5pt @ 96dpi ≈ 14px */ + --text-xs: 11px; /* captions, footer meta */ + --text-sm: 12px; /* table cells, code */ + --text-base: 14px; /* body — ~10.5pt on A4 */ + --text-md: 16px; /* h4 / lead text */ + --text-lg: 19px; /* h3 */ + --text-xl: 23px; /* h2 */ + --text-2xl: 28px; /* h1 in document */ + --text-3xl: 42px; /* title page title */ + + /* Line heights — Roboto needs slightly tighter lh than serifs */ + --lh-tight: 1.25; + --lh-snug: 1.45; + --lh-base: 1.65; /* body text */ + --lh-loose: 1.80; + + /* Colour palette */ + --c-ink: #1c1c1e; + --c-mid: #48484a; + --c-muted: #8e8e93; + --c-rule: #d1d1d6; + --c-tint: #f2f2f7; + --c-accent: #0a5cf5; /* single accent — deep blue */ + --c-white: #ffffff; + + /* Spacing unit: 4px grid */ + --sp-1: 4px; + --sp-2: 8px; + --sp-3: 12px; + --sp-4: 16px; + --sp-6: 24px; + --sp-8: 32px; + --sp-10: 40px; + --sp-12: 48px; + --sp-16: 64px; + --sp-20: 80px; +} + +/* --- Reset ------------------------------------------------ */ +*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; } + +/* --- Base ------------------------------------------------- */ +html { + font-family: var(--font-body); + font-size: var(--text-base); + line-height: var(--lh-base); + color: var(--c-ink); + background-color: var(--c-white); + -webkit-font-smoothing: antialiased; + text-rendering: optimizeLegibility; +} + +/* --- Content column --------------------------------------- */ +body { + max-width: var(--content-width); + margin: 0 auto; + /* No top/bottom padding here — controlled by IATemplateHeaderHeight */ +} + +/* --- Headings --------------------------------------------- */ +h1, h2, h3, h4, h5, h6 { + font-family: var(--font-body); + color: var(--c-ink); + font-weight: 700; + line-height: var(--lh-tight); + margin-top: var(--sp-10); + margin-bottom: var(--sp-3); +} + +/* First heading in a document should not add top margin */ +.document > h1:first-child, +.document > h2:first-child, +.document > h3:first-child { + margin-top: 0; +} + +h1 { font-size: var(--text-2xl); letter-spacing: -0.02em; font-weight: 300; } +h2 { font-size: var(--text-xl); font-weight: 500; border-bottom: 1.5px solid var(--c-rule); padding-bottom: var(--sp-2); } +h3 { font-size: var(--text-lg); font-weight: 500; } +h4 { font-size: var(--text-md); font-weight: 700; color: var(--c-mid); } +h5 { font-size: var(--text-base); font-weight: 700; color: var(--c-mid); } +h6 { font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--c-muted); } + +/* Keep heading with following paragraph */ +h1 + p, h2 + p, h3 + p, h4 + p { margin-top: var(--sp-2); } + +/* --- Body text -------------------------------------------- */ +p { margin-bottom: var(--sp-4); } +p:last-child { margin-bottom: 0; } + +strong { font-weight: 700; } +em { font-style: italic; } + +a { + color: var(--c-accent); + text-decoration: underline; + text-underline-offset: 2px; + text-decoration-thickness: 1px; +} + +/* --- Lists ------------------------------------------------ */ +ul, ol { + padding-left: var(--sp-6); + margin-bottom: var(--sp-4); +} +li { margin-bottom: var(--sp-1); line-height: var(--lh-snug); } +li > ul, li > ol { margin-top: var(--sp-1); margin-bottom: 0; } + +/* --- Blockquote ------------------------------------------- */ +blockquote { + margin: var(--sp-8) 0; + padding: var(--sp-4) var(--sp-6); + border-left: 3px solid var(--c-accent); + background: var(--c-tint); + font-weight: 300; + font-size: var(--text-md); + line-height: var(--lh-snug); + color: var(--c-mid); +} +blockquote p:last-child { margin-bottom: 0; } + +/* --- Code ------------------------------------------------- */ +code { + font-family: var(--font-mono); + font-size: 0.875em; + font-weight: 500; + background: var(--c-tint); + padding: 0.1em 0.35em; + border-radius: 3px; + border: 1px solid var(--c-rule); +} + +pre { + font-family: var(--font-mono); + font-size: var(--text-sm); + line-height: 1.6; + background: var(--c-tint); + border: 1px solid var(--c-rule); + border-radius: 4px; + padding: var(--sp-4) var(--sp-6); + margin: var(--sp-6) 0; + overflow-x: auto; +} +pre code { background: none; border: none; padding: 0; font-size: inherit; } + +/* --- Tables ----------------------------------------------- */ +table { + width: 100%; + border-collapse: collapse; + margin: var(--sp-6) 0; + font-size: var(--text-sm); +} +thead { + border-bottom: 2px solid var(--c-ink); +} +th { + text-align: left; + font-weight: 700; + padding: var(--sp-2) var(--sp-3); + font-size: var(--text-xs); + text-transform: uppercase; + letter-spacing: 0.06em; + color: var(--c-mid); +} +td { + padding: var(--sp-2) var(--sp-3); + border-bottom: 1px solid var(--c-rule); + vertical-align: top; + line-height: var(--lh-snug); +} +tr:last-child td { border-bottom: none; } +tbody tr:nth-child(even) td { background: var(--c-tint); } + +/* --- HR --------------------------------------------------- */ +hr { + border: none; + border-top: 1px solid var(--c-rule); + margin: var(--sp-10) 0; +} + +/* --- Images ----------------------------------------------- */ +img { + max-width: 100%; + height: auto; + display: block; + margin: var(--sp-6) auto; +} +figcaption { + text-align: center; + font-size: var(--text-xs); + color: var(--c-muted); + margin-top: var(--sp-2); + font-style: italic; +} + +/* ============================================================ + Night mode + ============================================================ */ +html.night-mode { + --c-ink: #f2f2f7; + --c-mid: #aeaeb2; + --c-muted: #636366; + --c-rule: #38383a; + --c-tint: #1c1c1e; + --c-accent: #4a9eff; + --c-white: #000000; +} diff --git a/convertion_templates_iA-Writer/ExampleTemplate_CleanDoc.iatemplate/Contents/Resources/title.html b/convertion_templates_iA-Writer/ExampleTemplate_CleanDoc.iatemplate/Contents/Resources/title.html new file mode 100644 index 0000000..4d0232f --- /dev/null +++ b/convertion_templates_iA-Writer/ExampleTemplate_CleanDoc.iatemplate/Contents/Resources/title.html @@ -0,0 +1,132 @@ + + + + + + + + + +
+ +
+

Document

+

+
+
+ + +
+
+ + + + diff --git a/convertion_templates_iA-Writer/README.md b/convertion_templates_iA-Writer/README.md new file mode 100644 index 0000000..1676dd5 --- /dev/null +++ b/convertion_templates_iA-Writer/README.md @@ -0,0 +1,328 @@ +# iA Writer Templates — A Practical Guide + +## What is iA Writer? + +iA Writer is a focused writing application for macOS, iOS, iPadOS, and Windows, developed by the Swiss studio [Information Architects (iA)](https://ia.net). It strips away the visual clutter of traditional word processors to offer a distraction-free environment centred entirely on the text itself. + +Its signature features include: + +- **Focus Mode** — dims everything except the sentence or paragraph you are writing +- **Syntax Highlighting** — optionally colours adjectives, nouns, verbs, and adverbs to reveal writing patterns +- **Content Blocks** — embed and transclude other files directly into a document +- **MultiMarkdown support** — a superset of standard Markdown including tables, footnotes, and metadata +- **Templates** — export any document to a beautifully typeset PDF or printed page using custom HTML/CSS templates + +iA Writer saves documents as plain `.md` or `.txt` files, which means your writing is never locked into a proprietary format. + +--- + +## Relevant Documentation + +| Resource | URL | +|---|---| +| Official template guide | https://ia.net/writer/templates | +| Template GitHub repository (iainc) | https://github.com/iainc/iA-Writer-Templates | +| MultiMarkdown syntax reference | https://fletcher.github.io/MultiMarkdown-6 | +| iA Writer support | https://ia.net/writer/support | +| Apple Bundle structure reference | https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html | + +--- + +## How Templates Work + +iA Writer templates are **macOS/iOS bundles** — a directory with a specific internal structure that the operating system treats as a single file. The bundle contains HTML, CSS, and a property list (`Info.plist`) that tells iA Writer which pages exist and how tall the header and footer are. + +When you export a document, iA Writer renders each HTML page in a headless WebKit view and composes the result into a PDF. You have full control over typography, layout, and colour through standard HTML and CSS. + +--- + +## Bundle Structure + +``` +MyTemplate.iatemplate/ +└── Contents/ + ├── Info.plist ← Required. Declares all pages and settings. + └── Resources/ + ├── document.html ← Required. Lays out the document body text. + ├── title.html ← Optional. Cover/title page. + ├── header.html ← Optional. Repeating page header. + ├── footer.html ← Optional. Repeating page footer. + └── style.css ← Your stylesheet (shared across all pages). +``` + +The HTML filenames can be anything you like — you declare them in `Info.plist`. The file extensions must be `.html`; in `Info.plist` you reference them **without** the extension. + +--- + +## Info.plist Reference + +`Info.plist` is an Apple XML property list. Every key-value pair is wrapped in `` and its corresponding type tag. Here is a complete annotated example: + +```xml + + + + + + + + + CFBundleName + My Template + + + CFBundleIdentifier + com.yourname.mytemplate + + + IATemplateDocumentFile + document + + + + + IATemplateTitleFile + title + + + IATemplateHeaderFile + header + IATemplateHeaderHeight + 60 + + + IATemplateFooterFile + footer + IATemplateFooterHeight + 50 + + + IATemplateTitleUsesHeaderAndFooterHeight + + + + IATemplateDescription + A clean document template. + IATemplateAuthor + Your Name + IATemplateAuthorURL + https://yourwebsite.com + + + IATemplateSuportsSmartTables + + + + IATemplateSupportsMath + + + + +``` + +> **Important:** The `CFBundleIdentifier` must be unique. If two installed templates share the same identifier, iA Writer will associate documents with whichever was installed last. Always change the identifier when forking a template. + +--- + +## Content Injection — `data-*` Attributes + +iA Writer populates your HTML pages by setting `innerHTML` on elements that carry specific `data` attributes. It dispatches an `ia-writer-change` event to each element after updating it. + +### Available on all pages + +| Attribute | Content | +|---|---| +| `data-title` | Document title (taken from the filename) | +| `data-author` | Author name set in iA Writer Preferences | +| `data-date` | Current date. Accepts a format string: `data-date="d MMMM yyyy"` | + +### Document page only + +| Attribute | Content | +|---|---| +| `data-document` | The full document body rendered as HTML | + +### Header, footer, and title page + +| Attribute | Content | +|---|---| +| `data-page-number` | Current page number (not available on title page) | +| `data-page-count` | Total page count | + +### Usage in HTML + +```html + +

+ + +
+ + + / + + + +``` + +--- + +## Margin Model + +This is the most important thing to understand before writing CSS, and the most common source of confusion. + +**Left and right margins** are controlled purely by CSS — typically via `max-width` on the `body` or a container `div`, combined with `margin: 0 auto`. + +**Top and bottom margins** on body pages are controlled by `IATemplateHeaderHeight` and `IATemplateFooterHeight` in `Info.plist`. CSS top/bottom padding on the `body` element of `document.html` does **not** create print margins in the same way — the header and footer zones sit above and below the document body zone, and their heights are what determines white space at the top and bottom of each page. + +### A4 margin calculation + +| Margin | Value | CSS pixels (96 dpi) | +|---|---|---| +| Top (= header height) | 25 mm | ~94 px | +| Bottom (= footer height) | 20 mm | ~75 px | +| Left/Right | 25 mm each | max-width ≈ 605–640 px | + +A common working formula for A4 with 25mm margins: + +``` +A4 width = 210mm +Side margins = 25mm × 2 = 50mm +Text column = 160mm = 160 × (96 ÷ 25.4) ≈ 605px +``` + +```xml +IATemplateHeaderHeight +94 + +IATemplateFooterHeight +75 +``` + +```css +body { + max-width: 620px; + margin: 0 auto; +} +``` + +--- + +## The Five HTML Pages + +### `document.html` (required) + +This page renders the Markdown body text. Keep it minimal — just import your stylesheet and place a single `data-document` element. + +```html + + + + + + + +
+ + +``` + +### `title.html` (optional) + +The cover page, only rendered on export. Because `IATemplateTitleUsesHeaderAndFooterHeight` can be set to `false`, this page can go full-bleed. Use `min-height: 100vh` and flexbox to fill the page. + +```html + +

+

+

+ +``` + +### `header.html` and `footer.html` (optional) + +These repeat on every body page. Their viewport height equals the value you set in `Info.plist`. Use flexbox to align content to the inner edge (the edge closest to the body text): + +- **Header:** `align-items: flex-end` to pin content to the bottom of the header zone +- **Footer:** `align-items: flex-start` to pin content to the top of the footer zone + +```html + + + / + +``` + +--- + +## Night Mode & iOS Support + +iA Writer adds CSS classes to the `` element to signal the current environment. Use these to adapt your template: + +```css +/* Dark mode */ +html.night-mode { + background: #1c1c1e; + color: #f2f2f7; +} + +/* Platform targeting */ +html.mac { /* macOS-specific overrides */ } +html.ios { /* iOS/iPadOS overrides */ } +``` + +iOS also supports Dynamic Type. iA Writer adds a content-size class to ``: + +```css +html.content-size-s { font-size: 14px; } +html.content-size-l { font-size: 17px; } /* default */ +html.content-size-xl { font-size: 20px; } +``` + +--- + +## Installing a Template + +### macOS +Double-click the `.iatemplate` bundle in Finder, or drag it onto the iA Writer icon in the Dock. You can also go to **Preferences → Templates → +**. + +To inspect or edit an installed template: right-click it in Preferences and choose **Show in Finder**, then right-click the bundle and choose **Show Package Contents**. + +### iOS / iPadOS +Send the `.iatemplate` file (or a `.zip` containing one template) via AirDrop, or use **Open in iA Writer** from Files, Mail, or Safari. + +### Windows +Go to **File → Install Template** and select the `.iatemplate.zip` file. + +--- + +## Development Workflow + +1. Install the template in iA Writer once via Preferences. +2. Right-click it in Preferences → **Show in Finder** to locate the installed copy. +3. Edit the HTML/CSS files directly inside the installed bundle. +4. Press **⇧⌘R** in iA Writer's Preview pane to force-reload the template. +5. Enable Web Inspector for deeper debugging: + +```bash +defaults write pro.writer.mac WebKitDeveloperExtras -bool true +``` + +Then right-click inside the Preview pane and choose **Inspect Element**. + +--- + +## About ExampleTemplate_CleanDoc + +`ExampleTemplate_CleanDoc` is the template included alongside this README. It demonstrates all five template pages with a Roboto type system, calibrated A4 margins, a structured title page, running header/footer with page numbers, and full night mode support. + +| File | Purpose | +|---|---| +| `Info.plist` | Declares all five pages, sets header (60px) and footer (50px) heights | +| `style.css` | Shared design tokens, Roboto type scale, component styles, night mode | +| `document.html` | Body text page | +| `title.html` | Full-bleed cover page with accent bar, title, author, date | +| `header.html` | Running title + accent dot | +| `footer.html` | Author name (left) + page N / total (right) |