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.1.tar.gz (291.7 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.1-py3-none-any.whl (39.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mkprof-0.1.1.tar.gz
  • Upload date:
  • Size: 291.7 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.1.tar.gz
Algorithm Hash digest
SHA256 4e5e865b3170024dc1f9b9e7d5fbd5bf59a4927b547974690731c8621d5270dd
MD5 a457301e88eb95642abe8ab2227178a6
BLAKE2b-256 82da3f527e8447cf9a05ebd14774b63ac37bba1a56ac1f6a02d3eba88a367770

See more details on using hashes here.

Provenance

The following attestation bundles were made for mkprof-0.1.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: mkprof-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 39.1 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 87955f2441f8d0392ffd2d8c6db52564ea6bd95237eb860cadeebff23c31d86b
MD5 b2fddca02fc0dbdc953c728adc31ec65
BLAKE2b-256 fd259d9a8423515ccc28913f896a0670455873aee80a5a98bf051793c77b86d9

See more details on using hashes here.

Provenance

The following attestation bundles were made for mkprof-0.1.1-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