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 that converts Jupyter notebooks into blog posts.

If mkdocs is a table saw, mkprof is the crosscut sled — it makes a specific set of operations safer, more repeatable, and faster. It handles the awkward parts of the notebook-to-blog workflow so you can focus on writing.

Why is it called mkprof? Well, who makes the thing that makes the docs? In any event, this is a tool for making a personal site for a me, and I'm a professor, so... look, I had to name it something.

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.0.tar.gz (41.5 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.0-py3-none-any.whl (35.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mkprof-0.1.0.tar.gz
  • Upload date:
  • Size: 41.5 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.0.tar.gz
Algorithm Hash digest
SHA256 ca0b8716ce8dec6d51a67290edeefd96e7c4e229facd4a88194a2fbdbc2b7a33
MD5 bed13e3831be6b8b3a6d326898bdfea0
BLAKE2b-256 f411d7cd0e52e41ea4bdd75042cd99029b7b90bc7c9bcc2799a69aca682917a8

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: mkprof-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 35.5 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c3bfc4c17b90bc8889de55a3755d3f1c70f1798b7e5c516ccf93d381f015a885
MD5 2626e5277ffb6f4cb9f94ad7a091189e
BLAKE2b-256 4de9405e3291c3ca330628b411e820ed4ad8b1da9151057232d2bee31d4d3cfd

See more details on using hashes here.

Provenance

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