Skip to main content

Extension of nbdev for generating documentation using Material for Mkdocs instead of Quarto

Project description

Getting Started

PyPI Downloads PyPI - Python Version

GitHub Workflow Status CodeQL Dependency Review

GitHub


Material for nbdev is a nbdev extension that allows you to use Material for MkDocs to generate documentation for nbdev projects.

Workflow

Here’s a quick comparison of Quarto and Material for nbdev development workflows:

Quarto workflow Material for nbdev workflow

Install:

$ pip install notebook nbdev
$ nbdev_install_quarto

Install:

$ pip install notebook nbdev
$ nbdev_install_quarto
$ pip install nbdev-mkdocs

Setup:

$ nbdev_new
$ nbdev_install_hooks
$ vi settings.ini
$ pip install -e '.[dev]'

Setup:

$ nbdev_new
$ nbdev_install_hooks
$ vi settings.ini
$ pip install -e '.[dev]'
$ nbdev_mkdocs new
$ vi mkdocs/mkdocs.yml

Development:

# Edit files
$ nbdev_preview

Development:

# Edit files
$ nbdev_mkdocs preview

Commit changes:

$ nbdev_prepare
$ git commit -am “Commit message”
$ git push

Commit changes:

$ nbdev_mkdocs prepare
$ git commit -am “Commit message”
$ git push

Quick start

The following quick start guide will walk you through installing and configuring nbdev-mkdocs for an existing nbdev project. It also assumes you’ve already initialized your project with nbdev and installed all of the required libraries.

For detailed installation instructions and configuration options, please see the End-To-End Walkthrough.

Install

nbdev-mkdocs is published as a Python package and can be installed with pip:

pip install nbdev-mkdocs

Note that nbdev-mkdocs must be installed in the same Python environment as nbdev.

If the installation was successful, you should now have the nbdev-mkdocs installed on your system. Run the below command from the terminal to see the full list of available commands:

nbdev_mkdocs --help
 Usage: nbdev_mkdocs [OPTIONS] COMMAND [ARGS]...                                

╭─ Options ────────────────────────────────────────────────────────────────────╮
│ --install-completion          Install completion for the current shell.      │
│ --show-completion             Show completion for the current shell, to copy │
│                               it or customize the installation.              │
│ --help                        Show this message and exit.                    │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────────────╮
│ docs                   Prepares files in **mkdocs/docs** and then runs       │
│                        **mkdocs build** command on them                      │
│ generate-social-image  Generate a custom social share image                  │
│ new                    Creates files in **mkdocs** subdirectory needed for   │
│                        other **nbdev_mkdocs** subcommands                    │
│ prepare                Runs tests and prepares files in **mkdocs/docs** and  │
│                        then runs **mkdocs build** command on them            │
│ preview                Prepares files in **mkdocs/docs** and then runs       │
│                        **mkdocs serve** command on them                      │
╰──────────────────────────────────────────────────────────────────────────────╯

Setup

After installing nbdev-mkdocs, bootstrap your project documentation by executing the following command from the project’s root directory:

nbdev_mkdocs new

Using information from the project’s settings.ini file, the above command creates files and directories required to build the documentation and saves it in the mkdocs subdirectory.

Note: You should only run the nbdev_mkdocs new command once for the project to initialise the files required for building Material for MkDocs documentation.

Preview changes

nbdev_mkdocs lets you preview your changes as you write your documentation. Execute the following command from the project root directory to start a local server, and preview your documentation:

Note: If you haven’t already installed your library locally, run pip install -e '.[dev]' command before running the nbdev_mkdocs prepare command.

nbdev_mkdocs preview

Prepare changes

We recommend running the nbdev_mkdocs prepare command in the terminal before committing to Git, which exports the library, tests and cleans notebooks, and generates the README file if necessary.

nbdev_mkdocs prepare

Finally, double-check your settings.ini file to ensure that it has all of the correct information. Then commit and push your additions to GitHub:

git commit -am'Commit Message'
git push

Copyright

Copyright © 2022 onwards airt technologies ltd, Inc.

License

This project is licensed under the terms of the Apache License 2.0

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

nbdev-mkdocs-0.0.2rc0.tar.gz (141.2 kB view hashes)

Uploaded Source

Built Distribution

nbdev_mkdocs-0.0.2rc0-py3-none-any.whl (140.4 kB view hashes)

Uploaded Python 3

Supported by

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