mkdocs-lex
A native Lex parser and integration for MkDocs.
This plugin allows MkDocs to seamlessly parse and render .lex files as part of your documentation site. It acts as a transparent adapter—MkDocs treats your .lex files as native Markdown pages, meaning all of your favorite MkDocs features, themes, and plugins will continue to work perfectly!
Installation
Install the package via pip:
pip install mkdocs-lex-plugin
Usage
To enable the plugin, add lex to the plugins section of your mkdocs.yml:
site_name: My Documentation
plugins:
- search
- lex
Configuration Options
| Option | Default | Description |
|---|---|---|
download_if_missing |
true |
When lexd isn't on PATH, fetch the latest matching binary from the lex-fmt/lex GitHub releases and cache it under .mkdocs_lex_cache/. Set to false to require a pre-installed lexd and error out if it's missing. |
plugins:
- search
- lex:
download_if_missing: false # require pre-installed lexd
Navigation Configuration
Because the plugin tricks MkDocs into treating your .lex files as Markdown, your mkdocs.yml navigation must point to .md extensions, even though the files on disk are .lex.
For example, if you have docs/getting-started.lex and docs/index.lex:
nav:
- Home: index.md
- Getting Started: getting-started.md
Deployment
To publish a mkdocs-lex site:
- GitHub Pages via GitHub Actions — the recommended path. See
docs/deployment/github-pages.md. - Read the Docs — choose this when you want versioned docs or PR previews. See
docs/deployment/read-the-docs.md. - CI build verification only — when you deploy from elsewhere but want CI to fail on broken docs. See
docs/deployment/ci-verification.md.
Full overview and trade-offs: docs/deployment/.
Development Setup
If you want to contribute or test this plugin locally:
- Clone the repository:
git clone https://github.com/lex-fmt/mkdocs-lex - Run the development setup script:
bash scripts/setup-dev-env.sh - Activate the virtual environment:
source .venv/bin/activate - Run integration tests:
pytest tests/
How it works
MkDocs is fundamentally a Markdown engine. This plugin integrates cleanly by:
- Identifying
.lexfiles in yourdocs/folder. - Tricking MkDocs' internal engine into believing they are
.mdpages. - Intercepting the file-read hook (
on_page_read_source) to perform a just-in-time conversion of Lex to Markdown using thelexd convertcapability.
This means no temporary .md files clutter your repo, and live-reloading (mkdocs serve) works natively when you edit a .lex file!
Metadata
Release files for mkdocs-lex-plugin 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mkdocs_lex_plugin-0.2.1.tar.gz | 6.8 kB | Without provenance | Details for mkdocs_lex_plugin-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mkdocs_lex_plugin-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for mkdocs_lex_plugin-0.2.1-py3-none-any.whl |
Total release size: 14.1 kB
Release files / mkdocs_lex_plugin-0.2.1.tar.gz
| Download URL | mkdocs_lex_plugin-0.2.1.tar.gz |
|---|---|
| Size | 6.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6b800b9eaf54ced57cead1c74d57fd546044e75ba278babf64510f69a3be34f6
|
|
BLAKE2b-256 checksum How to use checksums |
c63d6f2db386d46c211a98c5e55e359dee2e591c9139a0a45970da999d01e7ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / mkdocs_lex_plugin-0.2.1-py3-none-any.whl
| Download URL | mkdocs_lex_plugin-0.2.1-py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dd452470957925048ee187aab4cac78d81663dd2600b3c5093bb6d1c115c24cc
|
|
BLAKE2b-256 checksum How to use checksums |
f907cf62f781dbd2a26564224dbccce4827da743aa97c265c734840f389ac298
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for mkdocs-lex-plugin 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.