# mkdocs-remove-sections-plugin
Remove marked sections from pages.
For example to remove private information from a public version of a web site.
## Installation
You can install it with `pip`:
```bash
pip install mkdocs-remove-sections-plugin
```
## Usage
Add the plugin to your `mkdocs.yml`:
```yaml
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:
```yaml
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:
```markdown
## 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.1.0
- Added removing sections by title
### Version 0.0.1
- Initial version
Raw data
{
"_id": null,
"home_page": "https://github.com/six-two/mkdocs-remove-sections-plugin",
"name": "mkdocs-remove-sections-plugin",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": null,
"author": "six-two",
"author_email": "pip@six-two.dev",
"download_url": "https://files.pythonhosted.org/packages/21/07/9df297a013b4c263c143425be9ff06b2f78346ccedffda8141187d10429a/mkdocs_remove_sections_plugin-0.1.0.tar.gz",
"platform": null,
"description": "# mkdocs-remove-sections-plugin\n\nRemove marked sections from pages.\nFor example to remove private information from a public version of a web site.\n\n## Installation\n\nYou can install it with `pip`:\n```bash\npip install mkdocs-remove-sections-plugin\n```\n\n## Usage\n\nAdd the plugin to your `mkdocs.yml`:\n```yaml\nplugins:\n- search\n- remove_sections\n```\n\nTo remove a section and its subsections, you can begin its title with `Private:` like `## Private: My section`.\n\nIf you need a more precise removal, you can also manually set start and end points for the removal.\nAny 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`.\nIf 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.\nIn addition a warning is shown during the build.\n\n## Configuration\n\nYou can configure the plugin with the following options.\nThe information shown below shows the default values:\n```yaml\nplugins:\n- search\n- remove_sections:\n section_start_pattern: \"<!--\\\\s*remove:start\\\\s*-->\"\n section_end_pattern: \"<!--\\\\s*remove:end\\\\s*-->\"\n section_heading_pattern: \"^Private: \"\n section_replace_with: \"\\n\\n> Some content has been redacted in this version.\\n\\n\"\n regex_case_sensitive: false\n```\n\n### section_start_pattern\n\nRegular expression pattern that marks the start of a section that should be removed.\n\n### section_end_pattern\n\nRegular expression pattern that marks the end of a section that should be removed.\n\n### section_heading_pattern\n\nRegular expression for a section heading (`h1` through `h6`) that marks a section to be removed.\nAny subsections are removed as well.\nYou can use it like this:\n```markdown\n## Private: Section to remove\n```\n\n### section_replace_with\n\nThe removed content will be replaced with this text.\nYou can set an empty string to remove it entirely.\nBy default a placeholder is shown, so that you see that something was removed.\n\n### regex_case_sensitive\n\nThis controls, whether the patterns you defined with the other options should be case sensitive or insensitive.\nIt defaults to case insensitive.\n\n## Notable changes\n\n### Version 0.1.0\n\n- Added removing sections by title\n\n### Version 0.0.1\n\n- Initial version\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "Remove marked sections from pages",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/six-two/mkdocs-remove-sections-plugin"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "31ff31d9c2e6ebc6b8f237d5babbc1c45134071b634ee0c8e9219697ab68071a",
"md5": "a863320d56a59771993fcf5f2cf501c8",
"sha256": "3d12176be26dfc4c6e87827ae5a4eca14c7e2b758f9b64c3bd6fb90c68026d91"
},
"downloads": -1,
"filename": "mkdocs_remove_sections_plugin-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a863320d56a59771993fcf5f2cf501c8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 5453,
"upload_time": "2024-11-09T14:35:23",
"upload_time_iso_8601": "2024-11-09T14:35:23.041428Z",
"url": "https://files.pythonhosted.org/packages/31/ff/31d9c2e6ebc6b8f237d5babbc1c45134071b634ee0c8e9219697ab68071a/mkdocs_remove_sections_plugin-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "21079df297a013b4c263c143425be9ff06b2f78346ccedffda8141187d10429a",
"md5": "db3c90b8303a866ae70231260524a4a5",
"sha256": "5f30c1aaeb9be406e4ab04b29bfa79c0bff0d1eb547071e3fa181f72dc9b2348"
},
"downloads": -1,
"filename": "mkdocs_remove_sections_plugin-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "db3c90b8303a866ae70231260524a4a5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 4880,
"upload_time": "2024-11-09T14:35:24",
"upload_time_iso_8601": "2024-11-09T14:35:24.614650Z",
"url": "https://files.pythonhosted.org/packages/21/07/9df297a013b4c263c143425be9ff06b2f78346ccedffda8141187d10429a/mkdocs_remove_sections_plugin-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-09 14:35:24",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "six-two",
"github_project": "mkdocs-remove-sections-plugin",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "mkdocs-remove-sections-plugin"
}