Skip to main content

Write Jupyter notebooks in Markdown, render them beautifully

Project description

markbook

A CLI tool that compiles a custom Markdown DSL into styled Jupyter Notebooks (.ipynb). Write in plain Markdown, render beautifully in Jupyter.

Installation

pip install -e .

Usage

Build a notebook

markbook build notebook.md
markbook build notebook.md -o output.ipynb

Watch for changes

markbook watch notebook.md

Recompiles automatically on every save.

DSL Syntax

Frontmatter

YAML block at the top of the file. Renders as a title heading and author name in the first cell.

---
title: "My Notebook"
kernel: python3
author: "Your Name"
---

Headings

Use ##, ### and #### to structure your notebook into chapters and sections. Each heading becomes its own styled markdown cell. Optional anchor IDs enable linking from the table of contents.

## 1. Business Understanding {#chapter1}

### 1.1 Project Context {#chap1_1}

#### 1.1.1 Goals {#chap1_1_1}
Level Rendered Style
## Large (1.6em), accent color #2E86AB, 4px left border
### Medium (1.3em), accent color #2E86AB, 3px left border
#### Small (1.1em), muted color #555, no border

Anchor IDs ({#id}) are optional — if omitted, markbook auto-generates them by slugifying the heading text.

Note: # (h1) is not recognized as a chapter heading. It passes through as regular markdown. Use ## and below.

Table of Contents

Place [TOC] on its own line to auto-generate a linked table of contents from all headings in the document:

[TOC]

This produces a cell like:

## Gliederung

* **[1. Business Understanding](#chapter1)**
    * [1.1 Project Context](#chap1_1)
        * [1.1.1 Goals](#chap1_1_1)
* **[2. Data Loading](#chapter2)**
    * [2.1 Imports](#chap2_1)

## headings become bold top-level entries, ### are indented, #### double-indented. All entries link to their heading's anchor ID.

Code Cells

Fenced code blocks with a recognized language tag become notebook code cells:

```python
import pandas as pd
df = pd.read_csv("data.csv")
```

Supported languages: python, bash, sql, r, julia, sh, javascript, typescript, java, c, cpp, go, rust.

Fenced blocks with other or no language tags become markdown cells.

Section Dividers

A horizontal rule becomes a styled <hr>:

---

Regular Markdown

Everything else (paragraphs, bold, italic, lists, tables, blockquotes) passes through as-is into markdown cells.

Example

See examples/diabetes.md for a full example. Build it with:

markbook build examples/diabetes.md

Dependencies

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

markbook-0.1.0.tar.gz (32.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

markbook-0.1.0-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file markbook-0.1.0.tar.gz.

File metadata

  • Download URL: markbook-0.1.0.tar.gz
  • Upload date:
  • Size: 32.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.2

File hashes

Hashes for markbook-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b4d56ac6b409bff96a025760f9f14e8059b45cfc48fc30e518d1dd602df8642b
MD5 66ebbd3ecb361fae7447163ccb77a7f2
BLAKE2b-256 5b1eccdcc99e9acc697ac8669b66ae4c95de83d041488efd7f71a5419b88a530

See more details on using hashes here.

File details

Details for the file markbook-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: markbook-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.2

File hashes

Hashes for markbook-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5c69314bec8c17922b2f8c747648d44a2913dfcfd8adc5b3326f70c24a83c6ba
MD5 d2c25a1fc46cb55b9ca1343c4e106a87
BLAKE2b-256 f2d0cdadfb521c52c1ed3840ce732d2b27baa84cd4b3aa493326bd7e11dc09c5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page