Skip to main content

A mkdocs plugin that lets you conditionally include files or trees.

Project description

File exclude plugin for mkdocs

mkdocs-exclude is a mkdocs plugin that allows you to conditionally include files from your input using regular expressions (regexes).

This will only include the following files in your mkdocs:

  • file location does not have the specified prefix
  • file is in the specified prefix, and matches any of the specified regexes

The big advantage of this is, that you can include your closed-source repositories into a mkdocs monorepo, and explicitly ONLY include your documentation sub-folders in the mkdocs artifacts.

Quick start

  1. Install the module using pip: pip3 install mkdocs-conditional-include
  2. In your project, add a plugin configuration to mkdocs.yml:
plugins:
  - conditional_include:
      rules:
        - prefix: my-docs
          regex:
            - '.*\/docs\/.*'
            - '.*\/docs-assets\/.*'
        - prefix: my-docs-2
          regex:
            - '.*\/docs\/.*'

Not specifying any prefix will run the particular rule over all files, thus filtering everything.

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

mkdocs-conditional-include-0.0.1.tar.gz (7.0 kB view hashes)

Uploaded Source

Built Distribution

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