Skip to main content

Import a diff file as MkDocs code block

Project description

mkdocs-diff-file-import MkDocs Plugin

Overview

The mkdocs-diff-file-import plugin for MkDocs allows you to dynamically replace custom code blocks in your Markdown files with the content of specified files. This plugin is particularly useful for managing and displaying differences between imported code files within your documentation.

Features

  • Configurable code block name to identify sections to be replaced.
  • Automatically replaces matching code blocks with the content of specified files during the build process.
  • Easy integration with existing MkDocs projects.

Installation

To install the plugin, you can use pip:

pip install mkdocs-diff-file-import

Configuration

To use the mkdocs-diff-file-import plugin, add it to your mkdocs.yml configuration file:

plugins:
  - search
  - diff-file-import:
      codeblock_name: import-diff-file  # Optional, default is 'import-diff-file'

Usage

In your Markdown files, define code blocks with the specified code block name to be replaced by the plugin. For example:

```
import-diff-file file=example.txt
```

During the MkDocs build process, these code blocks will be replaced by the content of the specified file.

Example

Given the following content in a Markdown file:

```import-diff-file file=example.diff```

The mkdocs-diff-file-import plugin will replace this block with the content of example.diff inside a diff code block:

```diff
[edit routing-instances l3vpn-test]
-    vrf-table-label;
[edit protocols bgp]
+    bgp-error-tolerance {
+        malformed-route-limit 0;
+    }
```

Contributing

Contributions are welcome! Please fork the repository and submit a pull request with your changes. Ensure that your code adheres to the project's coding standards and includes appropriate tests.

  1. Fork the repository
  2. Create a new feature branch (git checkout -b feature/YourFeature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin feature/YourFeature)
  5. Create a new Pull Request

License

This project is licensed under the Apache 2.0 License. See the LICENSE file for more details.

Contact

If you have any questions, issues, or suggestions, please open an issue in the GitHub repository.

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_diff_file_import-0.1.6.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mkdocs_diff_file_import-0.1.6-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file mkdocs_diff_file_import-0.1.6.tar.gz.

File metadata

  • Download URL: mkdocs_diff_file_import-0.1.6.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for mkdocs_diff_file_import-0.1.6.tar.gz
Algorithm Hash digest
SHA256 ed912990899958e245a5ef8d7a940050dbe2cf0da419337660737339b5ddba4a
MD5 2d69df4c00407c2c57b58738c1a54d53
BLAKE2b-256 b1fac2429c145f9a7bf3b7f5fa47b394d3790ad8880ff3825526a051820f9e20

See more details on using hashes here.

File details

Details for the file mkdocs_diff_file_import-0.1.6-py3-none-any.whl.

File metadata

File hashes

Hashes for mkdocs_diff_file_import-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 e3ca1540e52ab53d6650b91af7a79573945865a99c59556995a87d0e43b3449e
MD5 2a051f355421e22006dc666cb8ebe377
BLAKE2b-256 e1808b400f3e93a7982a3732a5ca6c5ccb7ab708666ad70eac658c33c6340c79

See more details on using hashes here.

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