Skip to content

Commit e240da1

Browse files
Merge pull request #27 from DimwitLabs/development
refactor!: Enhance pagination with handling specific markdown elements
2 parents 994a04a + 5b467f9 commit e240da1

25 files changed

Lines changed: 510 additions & 236 deletions

CHANGELOG.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,24 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [1.4.6] - 2026-03-06
8+
## [1.5.0] - 2026-03-06
99

1010
### Added
1111

12-
- Configurable characters per page in reader mode via `reader.charsPerPage` in `config.yaml`. Users may not need to change this at all. But the idea is to keep it configurable in case there are some visual artifacts in the reader mode. This is responsible for splitting the pages for the reader mode.
12+
- Configurable pagination parameters via `reader.pagination` in `config.yaml` with `columnWidth`, `columnHeight`, `lineHeight`, `avgCharWidth`, and `safetyMargin` options.
13+
14+
### Changed
15+
16+
- **Breaking**: Rewrote pagination algorithm from line-based to character-based for more accurate page breaks.
17+
- CSS columns now allow content to break inside blocks (`break-inside: auto`) for natural text flow.
18+
- Theme scale overrides (`ui.theme.overrides.font.scale`) now affect pagination calculations.
1319

1420
### Fixed
1521

16-
- Reader mode now correctly paginates lists, code blocks, and blockquotes instead of truncating them mid-element.
17-
- Body of Work page now appears on first deploy when using a custom slug; reliably.
22+
- Theme config path now correctly reads `ui.theme.preset` instead of top-level `theme`.
23+
- Reader mode no longer overflows or cuts off content at column boundaries.
24+
- Blockquotes and lists split mid-content when needed instead of jumping entirely to next column.
25+
- Body of Work page now appears on first deploy when using a custom slug.
1826

1927
## [1.4.5] - 2026-03-05
2028

README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
> An ode to those who love the craft, an ode to the old internet, an ode to a time before numbers and figures dominated writing, an ode to a time where readers remembered their favourite writers, and an ode to the hope that all of it is still present, somewhere.
66
7-
Ode is for writers who want to publish in an aesthetically pleasing website, who ignore the bells and whistles of the modern internet, and who want to create a better experience for their readers. It is opinionated, minimal, and easy to use, guided by its own [ethos](https://github.com/DeepanshKhurana/ode/blob/main/ETHOS.md).
7+
Ode is for writers who want to publish in an aesthetically pleasing website, who ignore the bells and whistles of the modern internet, and who want to create a better experience for their readers. It is opinionated, minimal, and easy to use, guided by its own [ethos](https://github.com/DeepanshKhurana/ode/blob/main/docs/ETHOS.md).
88

99
## Inspiration
1010

@@ -22,16 +22,17 @@ You can find a live demo of the app [here](https://demo.ode.dimwit.me/).
2222
## Documentation
2323

2424
- **[README.md](https://github.com/DeepanshKhurana/ode/blob/main/README.md)**: Overview, features, and getting started
25-
- **[ETHOS.md](https://github.com/DeepanshKhurana/ode/blob/main/ETHOS.md)**: Core principles and philosophy behind Ode
26-
- **[WRITING.md](https://github.com/DeepanshKhurana/ode/blob/main/WRITING.md)**: Content repository, auto-deployment, and GitHub Actions
27-
- **[THEMING.md](https://github.com/DeepanshKhurana/ode/blob/main/THEMING.md)**: Theme presets, customization, local fonts, and visual examples
25+
- **[CONFIGURATION.md](https://github.com/DeepanshKhurana/ode/blob/main/docs/CONFIGURATION.md)**: Full config.yaml reference
26+
- **[ETHOS.md](https://github.com/DeepanshKhurana/ode/blob/main/docs/ETHOS.md)**: Core principles and philosophy behind Ode
27+
- **[WRITING.md](https://github.com/DeepanshKhurana/ode/blob/main/docs/WRITING.md)**: Content repository, auto-deployment, and GitHub Actions
28+
- **[THEMING.md](https://github.com/DeepanshKhurana/ode/blob/main/docs/THEMING.md)**: Theme presets, customization, local fonts, and visual examples
2829
- **[CHANGELOG.md](https://github.com/DeepanshKhurana/ode/blob/main/CHANGELOG.md)**: Version history and release notes
29-
- **[REFERENCES.md](https://github.com/DeepanshKhurana/ode/blob/main/REFERENCES.md)**: Credits and inspirations
30+
- **[REFERENCES.md](https://github.com/DeepanshKhurana/ode/blob/main/docs/REFERENCES.md)**: Credits and inspirations
3031

3132
## Screenshots
3233

3334
> [!NOTE]
34-
> For theme-specific screenshots, see [THEMING.md](https://github.com/DeepanshKhurana/ode/blob/main/THEMING.md)
35+
> For theme-specific screenshots, see [THEMING.md](https://github.com/DeepanshKhurana/ode/blob/main/docs/THEMING.md)
3536
3637
### Homepage
3738
![Homepage - Light Mode](.github/media/homepage_light.png)
@@ -70,7 +71,7 @@ https://github.com/user-attachments/assets/222af674-11f0-4b5a-8232-a31aca8a61b1
7071
## Getting Started
7172

7273
> [!TIP]
73-
> For detailed notes on how to setup a **content repository** with sync, look into the [WRITING.md](https://github.com/DeepanshKhurana/ode/blob/main/WRITING.md)
74+
> For detailed notes on how to setup a **content repository** with sync, look into the [WRITING.md](https://github.com/DeepanshKhurana/ode/blob/main/docs/WRITING.md)
7475
7576
### Docker Compose (Recommended)
7677

@@ -141,7 +142,7 @@ If you are coming from WordPress, you can use the awesome [lonekorean/wordpress-
141142
## Writing Content
142143

143144
> [!TIP]
144-
> A longer guide is in [WRITING.md](https://github.com/DeepanshKhurana/ode/blob/main/WRITING.md)
145+
> A longer guide is in [WRITING.md](https://github.com/DeepanshKhurana/ode/blob/main/docs/WRITING.md)
145146

146147
### Pieces
147148

@@ -177,7 +178,7 @@ Tell everyone everything!
177178
## Theming
178179

179180
> [!NOTE]
180-
> For complete theming documentation, including all available presets, customization options, and local font support, see [THEMING.md](https://github.com/DeepanshKhurana/ode/blob/main/THEMING.md)
181+
> For complete theming documentation, including all available presets, customization options, and local font support, see [THEMING.md](https://github.com/DeepanshKhurana/ode/blob/main/docs/THEMING.md)
181182

182183
Ode comes with 10 built-in themes that you can use and customize. Switch between presets, override colors and fonts, or build your own theme from scratch.
183184

build/defaults/config.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,13 @@ exclude:
3434
pieces:
3535
-
3636
reader:
37-
charsPerPage: 2200
37+
columns: 2
38+
pagination:
39+
columnWidth: 330
40+
columnHeight: 540
41+
lineHeight: 24
42+
avgCharWidth: 8
43+
safetyMargin: 0.85
3844
order:
3945
default: descending
4046
rss:

build/paginate-pieces.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import fs from 'fs';
22
import path from 'path';
33
import fm from "front-matter";
44
import yaml from 'js-yaml';
5-
import { chunkContent } from './utils/markdown-chunker';
5+
import { chunkContent, getCharsPerPage, PaginationConfig } from './utils/markdown-chunker';
6+
import { loadTheme } from './utils/theme-loader';
67

78
const publicDir = path.join(__dirname, '..', 'public');
89
const piecesPath = path.join(publicDir, 'content', 'pieces');
@@ -12,7 +13,20 @@ const configPath = path.join(publicDir, 'config.yaml');
1213

1314
const configRaw = fs.readFileSync(configPath, 'utf-8');
1415
const config = yaml.load(configRaw) as any;
15-
const CHARS_PER_PAGE = config?.reader?.charsPerPage ?? 2200;
16+
17+
const themeName = config?.ui?.theme?.preset || config?.theme || 'journal';
18+
const theme = loadTheme(themeName);
19+
const themeScaleOverride = config?.ui?.theme?.overrides?.font?.scale;
20+
const themeScale = themeScaleOverride ?? theme?.font?.scale ?? 1;
21+
22+
const paginationConfig: PaginationConfig = {
23+
columns: config?.reader?.columns ?? 2,
24+
pagination: config?.reader?.pagination,
25+
};
26+
27+
const CHARS_PER_PAGE = getCharsPerPage(paginationConfig, themeScale);
28+
29+
console.log(`[pagination]: theme=${themeName}, scale=${themeScale}, charsPerPage=${CHARS_PER_PAGE}`);
1630

1731
type PiecePage = {
1832
pieceSlug: string;

0 commit comments

Comments
 (0)