Skip to main content

A companion tool for mkdocs-material that converts Jupyter notebooks into blog posts

Project description

mkprof

A companion tool for mkdocs-material for building and running a blog that natively supports Jupyter notebooks as articles.

If you think of of mkdocs as something like a table saw, then mkprof is a table saw jig, like a cross-cut sled. It is a doohicky you add to a general purpose tool that makes a specific set of operations safer, more repeatable, and faster.

Why is it called mkprof? Well, professors mentor doctoral candidates, and if mkdocs makes docs, then... look, naming things is hard and I was tired.

mkprof metadata TUI — adding frontmatter to a notebook post

What it does

  • Converts .ipynb notebooks in your posts directory to mkdocs-compatible Markdown, extracting figures, handling asset paths, and adding a notebook download link
  • Provides an interactive TUI that prompts for any missing blog frontmatter (title, date, description, tags, authors) with content-aware pre-filling
  • Lints and auto-formats Markdown posts (mdformat, spell check, MathJax compatibility checks)
  • Skips conversion when the generated .md is already newer than its source notebook
  • mkprof init scaffolds a complete, opinionated site: hooks.py with nav injection and recent-posts support, MathJax, dark/light palette toggle, tags, Blog section open by default in the sidebar (via a small script that sets Material's accordion checkbox, not navigation.expand), and a CSS file with stubs for figures, photographs, tables, DataFrames, code blocks, and the recent-posts admonition — structural rules with color placeholders so you start with a working layout and make your own color decisions

mkprof is a pre-processor: it runs before mkdocs build, transforming notebooks into Markdown that mkdocs-material already knows how to handle.

Requirements

Installation

pip install mkprof

Quick start

Fresh site

mkprof init mysite
cd mysite
mkprof serve

mkprof init scaffolds a ready-to-use mkdocs-material site with the blog plugin and mkprof pre-configured. Drop .ipynb notebooks into docs/blog/posts/ and run mkprof to convert and build.

Existing mkdocs-material site

pip install mkprof
# run from your site root (the directory containing mkdocs.yml)
mkprof

mkprof reads your existing mkdocs.yml to locate docs_dir and your blog posts directory. No extra config file is required for a standard layout.

For non-standard layouts or per-site overrides, add an extra.mkprof section to your mkdocs.yml:

extra:
  mkprof:
    posts_dir: docs/content/posts   # default: derived from blog plugin config
    drafts_dir: _drafts             # default: drafts
    default_author: yourslug        # default: inferred from authors.yml

Commands

mkprof              TUI: convert notebooks + prompt to build or serve
mkprof serve        TUI: convert notebooks + start mkdocs dev server
mkprof build        TUI: convert notebooks + run mkdocs build
mkprof convert      headless: convert notebooks only (CI-safe, no prompts)
mkprof init [DIR]   scaffold a new site (default: current directory)

mkprof, mkprof serve, and mkprof build launch a Textual TUI that prompts interactively for any missing blog frontmatter and lets you move incomplete posts to drafts.

mkprof convert is non-interactive: it logs to stdout, skips notebooks that are missing metadata without prompting, and exits non-zero on conversion errors. Use it in CI:

- run: mkprof convert && mkdocs build

How it fits with mkdocs

mkprof is intentionally not a mkdocs plugin. It runs as a separate step before mkdocs build, generating standard Markdown that mkdocs-material handles natively. This keeps the conversion logic decoupled from mkdocs internals and makes it straightforward to adapt when Zensical matures.

License

MIT

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

mkprof-0.1.2.tar.gz (297.1 kB view details)

Uploaded Source

Built Distribution

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

mkprof-0.1.2-py3-none-any.whl (41.8 kB view details)

Uploaded Python 3

File details

Details for the file mkprof-0.1.2.tar.gz.

File metadata

  • Download URL: mkprof-0.1.2.tar.gz
  • Upload date:
  • Size: 297.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for mkprof-0.1.2.tar.gz
Algorithm Hash digest
SHA256 17363a164749d8b46d4d6d77947da82d42dfb000591860c09d1a8494a4e56d66
MD5 b18184ab03dea20a7fa445fa76cd2166
BLAKE2b-256 0dfc66f76f8dbfd2c518cf81b39fcdf2a295ef2c34bb91fd5c482b1a646f22a7

See more details on using hashes here.

Provenance

The following attestation bundles were made for mkprof-0.1.2.tar.gz:

Publisher: publish.yml on ryneches/mkprof

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mkprof-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: mkprof-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 41.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for mkprof-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c0c0db1ef282532d3ceddf5bbe09c668c7f1f230ac60d2618599ea023fcf2db6
MD5 6f1c774fa4b78fc3686c597625f2f352
BLAKE2b-256 0e0423ab0affb5480a7617186dc84faf5d474b9034f931b131d2018b0cf3344c

See more details on using hashes here.

Provenance

The following attestation bundles were made for mkprof-0.1.2-py3-none-any.whl:

Publisher: publish.yml on ryneches/mkprof

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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