jellycell.render.manuscript

Manuscript rendering for the live viewer.

Renders any .md file under manuscripts/ as a standalone HTML page using the project’s template stack. Used by /manuscripts/<path> and /journal in :mod:jellycell.server.app.

Authored files at the root and auto-generated tearsheets under tearsheets/ are treated identically at the render layer — the split is a human / tooling convention, not a rendering one. The

func:

discover_manuscripts helper surfaces both groups plus the optional journal entry so sidebars and index pages can link them.

No disk writes: this module is server-only. Static jellycell render leaves manuscripts alone on purpose — GitHub renders them natively, and the tearsheet subfolder is designed for that.

Module Contents

Classes

ManuscriptLink

A single manuscript entry for sidebars and index pages.

ManuscriptCatalog

Organized view of every .md under manuscripts/.

Functions

discover_manuscripts

Walk manuscripts/ and classify each .md file.

render_manuscript_page

Render manuscripts/<md_rel> (plus sidebar + chrome) into an HTML string.

render_manuscripts_index

Render the /manuscripts/ landing page listing every manuscript.

API

A single manuscript entry for sidebars and index pages.

rel: str

None

Path relative to manuscripts/ (e.g. paper.md).

href: str

None

Server URL for the rendered page (e.g. /manuscripts/paper.md).

title: str

None

Display label — stem with underscores + hyphens humanized.

kind: str

None

One of authored, tearsheet, journal.

current: bool

False

True when this link points to the manuscript currently being viewed.

class jellycell.render.manuscript.ManuscriptCatalog

Organized view of every .md under manuscripts/.

authored: list[jellycell.render.manuscript.ManuscriptLink]

‘field(…)’

Root-level hand-authored manuscripts (paper.md, findings.md, etc.).

tearsheets: list[jellycell.render.manuscript.ManuscriptLink]

‘field(…)’

Auto-generated tearsheets under manuscripts/tearsheets/.

journal: jellycell.render.manuscript.ManuscriptLink | None

None

The journal entry, if one exists (journal.md or custom path).

property has_any: bool

True when the project has any manuscript worth linking.

jellycell.render.manuscript.discover_manuscripts(project: jellycell.paths.Project, *, current_rel: str | None = None) jellycell.render.manuscript.ManuscriptCatalog

Walk manuscripts/ and classify each .md file.

Classification rules:

  • A file at tearsheets/*.md is a tearsheet.

  • The file matching [journal] path (default journal.md) is the journal — surfaced separately regardless of location.

  • Everything else at the root (or in other subfolders) is authored.

The README.md is intentionally treated as authored — it’s a human-written index for the folder.

jellycell.render.manuscript.render_manuscript_page(project: jellycell.paths.Project, md_rel: str, *, env: jinja2.Environment, pygments_css: str) str

Render manuscripts/<md_rel> (plus sidebar + chrome) into an HTML string.

Args: project: Current project — used to read the file + build catalog. md_rel: Path relative to manuscripts/ (e.g. tearsheets/analysis.md). env: Jinja environment from the renderer (reuses loader + filters). pygments_css: Pre-rendered pygments styles so fenced code blocks pick up the site theme when the markdown includes them.

Raises: FileNotFoundError: If <manuscripts>/<md_rel> doesn’t exist.

jellycell.render.manuscript.render_manuscripts_index(project: jellycell.paths.Project, *, env: jinja2.Environment, pygments_css: str) str

Render the /manuscripts/ landing page listing every manuscript.