MkDocs Remove Sections Plugin
Remove marked sections from pages. For example to remove private information from a public version of a web site.
Note on Zensical, MkDocs 1.x, ProperDocs, etc
To make it easy to keep it up to date for all my plugins, I hosted my intentions of what platforms to support on my website.
Installation
You can install it with pip:
pip install mkdocs-remove-sections-plugin
Usage
Add the plugin to your mkdocs.yml:
plugins:
- search
- remove_sections
To remove a section and its subsections, you can begin its title with Private: like ## Private: My section.
If you need a more precise removal, you can also manually set start and end points for the removal.
Any content on pages between <!-- remove:start --> and <!-- remove:end --> is replaced by the plugin with the text Some content has been redacted in this version.
If there are uncertanities (start and end tags do not propperly match up), then this plugin will default to cutting too much rather than too little.
In addition a warning is shown during the build.
Configuration
You can configure the plugin with the following options. The information shown below shows the default values:
plugins:
- search
- remove_sections:
section_start_pattern: "<!--\\s*remove:start\\s*-->"
section_end_pattern: "<!--\\s*remove:end\\s*-->"
section_heading_pattern: "^Private: "
section_replace_with: "\n\n> Some content has been redacted in this version.\n\n"
regex_case_sensitive: false
section_start_pattern
Regular expression pattern that marks the start of a section that should be removed.
section_end_pattern
Regular expression pattern that marks the end of a section that should be removed.
section_heading_pattern
Regular expression for a section heading (h1 through h6) that marks a section to be removed.
Any subsections are removed as well.
You can use it like this:
## Private: Section to remove
section_replace_with
The removed content will be replaced with this text. You can set an empty string to remove it entirely. By default a placeholder is shown, so that you see that something was removed.
regex_case_sensitive
This controls, whether the patterns you defined with the other options should be case sensitive or insensitive. It defaults to case insensitive.
Notable changes
Version 0.2.0
- Removed dependency declaration of
mkdocs
Version 0.1.0
- Added removing sections by title
Version 0.0.1
- Initial version
Metadata
Release files for mkdocs-remove-sections-plugin 0.2.0
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_remove_sections_plugin-0.2.0.tar.gz | 5.1 kB | Without provenance | Details for mkdocs_remove_sections_plugin-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mkdocs_remove_sections_plugin-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for mkdocs_remove_sections_plugin-0.2.0-py3-none-any.whl |
Total release size: 10.8 kB
Release files / mkdocs_remove_sections_plugin-0.2.0.tar.gz
| Download URL | mkdocs_remove_sections_plugin-0.2.0.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
88b12788024d9e764630b102c69d3535689edccb5cad939c10a102c222e0cb9c
|
|
BLAKE2b-256 checksum How to use checksums |
21855f01bd329150ad19b6c4e7433c26ce61b9a15323bc6b7bea3fe2cbdb9253
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.0
|
Release files / mkdocs_remove_sections_plugin-0.2.0-py3-none-any.whl
| Download URL | mkdocs_remove_sections_plugin-0.2.0-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d9a094d500829839706baeb66c6b5d0d5a08b49bb9060b6521eb3fcbc9d8b694
|
|
BLAKE2b-256 checksum How to use checksums |
95c2560ce5c9669582c24d23b233c9a02a8dc91d243e00397ee9a3db497cc2d3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.0
|
Security for mkdocs-remove-sections-plugin 0.2.0
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.