jellycell.render.renderer¶
Notebook + manifests → self-contained HTML.
Spec §2.6 pipeline:
Parse notebook (format.parse).
Match cells to cached manifests.
Render each cell via jinja partial; outputs via :mod:
jellycell.render.outputs.Assemble via :file:
templates/page.html.j2.Write to
<reports>/<notebook-stem>.html.
--standalone mode base64-inlines image blobs instead of writing
external assets.
Module Contents¶
Classes¶
Outcome of rendering a single notebook. |
|
Outcome of rendering the project index page. |
|
A single table-of-contents entry for the notebook sidebar. |
|
Adjacent-notebook link data for cross-navigation. |
|
Shared long-lived state for the rendering pipeline. |
|
Converts notebooks + cached manifests into a browsable HTML catalogue. |
API¶
- class jellycell.render.renderer.RenderedNotebook¶
Outcome of rendering a single notebook.
- output_path: pathlib.Path¶
None
Path where the HTML would be / was written.
When
write_pages=Falsethe file is not actually created; the path is still reported so callers know where the canonical artifact would live in a static render. The HTML text is in :attr:html.
- class jellycell.render.renderer.RenderedIndex¶
Outcome of rendering the project index page.
Mirrors :class:
RenderedNotebookso the server can fetch the HTML string directly (write_pages=False) without touching disk.- output_path: pathlib.Path¶
None
- class jellycell.render.renderer.TocItem¶
A single table-of-contents entry for the notebook sidebar.
- class jellycell.render.renderer.SiblingNotebook¶
Adjacent-notebook link data for cross-navigation.
- class jellycell.render.renderer.RendererEnv¶
Shared long-lived state for the rendering pipeline.
The Jinja environment (with compiled templates) and the Pygments CSS are expensive to build and completely stateless across requests — perfect to keep alive for the life of a server process. The
CacheStoreandCacheIndexare deliberately not here; those are opened per-render for simple SQLite thread safety.assets_diris captured at env-build time so the live server points at.jellycell/cache/assets/while staticjellycell renderstays withsite/_assets/.- jinja: jinja2.Environment¶
None
- assets_dir: pathlib.Path¶
None
- classmethod for_static(project: jellycell.paths.Project) jellycell.render.renderer.RendererEnv¶
Env for
jellycell render— assets undersite/_assets/.
- classmethod for_server(project: jellycell.paths.Project) jellycell.render.renderer.RendererEnv¶
Env for
jellycell view— assets under.jellycell/cache/assets/(served by the/_assets/static mount). Live server is disk-write-free for HTML pages; assets still land on disk as content-hashed blobs so the static mount has something to serve.
- class jellycell.render.renderer.Renderer(project: jellycell.paths.Project, *, standalone: bool = False, env: jellycell.render.renderer.RendererEnv | None = None, write_pages: bool = True)¶
Converts notebooks + cached manifests into a browsable HTML catalogue.
Pass
write_pages=Falseto skip writing HTML files to disk (the live server uses this mode and returns the HTML string directly via- Attr:
RenderedNotebook.html).
Pass
env=RendererEnv.for_server(project)in the server to reuse a long-lived Jinja environment across requests; the default builds a fresh env which is appropriate for the one-shot CLI path.Initialization
- render_notebook(notebook_path: pathlib.Path) jellycell.render.renderer.RenderedNotebook¶
Render a single notebook to
site/<stem>.html. Returns the result.With
write_pages=True(the default) the HTML is written tosite/<stem>.htmland :attr:RenderedNotebook.htmlisNone. Withwrite_pages=False(server path) disk is untouched and the rendered string is returned via :attr:RenderedNotebook.html.
- render_index() jellycell.render.renderer.RenderedIndex¶
Render a project-level index listing every notebook + recent cache entries.
Returns a :class:
RenderedIndex.write_pages=True(default) writessite/index.htmlto disk;write_pages=Falsestashes the HTML in :attr:RenderedIndex.htmlwithout touching disk.
- render_all() list[jellycell.render.renderer.RenderedNotebook]¶
Render every notebook in the project plus the index.