# mkdocs-strings-replacement
[![PyPI][pypi-version-badge-link]][pypi-link]
[![License][license-image]][license-link]
Mkdocs Markdown strings replacement plugin.
## Installation
```bash
pip install mkdocs-strings-replacement
```
## Documentation
### Setup
Enable the plugin in your `mkdocs.yml`:
```yaml
plugins:
- mkdocs-strings-replacement:
strings_replacements:
- old_value: "This string will be replaced"
new_value: "with this string"
```
Note:
- You can replace how many strings as you want. `strings_replacements` is an array of pairs of the `old_value`'s of the strings you want to replace with `new_value`'s of the strings you want to put there in exchange.
- If you add more then one `old_value` and `new_value` pairs then the replacement will occur from the top to the bottom of the pairs you have passed.
- Replacement will happen for any strings in the markdown, that is also for the content of your markdown file as well as in the titles.
- Replacement will happen before rendering your pages.
#### Example
```yaml
plugins:
- mkdocs-strings-replacement:
strings_replacements:
- old_value: "[[_TOSP_]]"
new_value: ""
- old_value: "[[_TOC_]]"
new_value: ""
```
In the given example:
- First your occurance of `[[_TOSP_]]` will be replaced with nothing, which will results in erasing `[[_TOSP_]]` from your pages.
- Then from the results `[[_TOC_]]` will be replaced with empty string as well.
## Development setup
To install the dependencies for the plugin, run:
```sh
pip install .
```
To set up the development environment, including dependencies for running tests, run:
```sh
pip install -e .[dev]
```
To run the tests, use:
```sh
pytest
```
[pypi-link]: https://pypi.org/project/mkdocs-strings-replacement
[pypi-version-badge-link]: https://img.shields.io/pypi/v/mkdocs-strings-replacement?logo=pypi&logoColor=white
[license-image]: https://img.shields.io/pypi/l/mkdocs-strings-replacement?color=light-green&logo=apache&logoColor=white
[license-link]: https://github.com/innersource-nn/midgard-mkdocs-plugins/blob/main/mkdocs-strings-replacement-plugin/LICENSE
Raw data
{
"_id": null,
"home_page": null,
"name": "mkdocs-strings-replacement",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "markdown, mkdocs, plugin, replacement",
"author": null,
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/94/10/447073376775c33e56b471dc610a770bf879d16eadc9f3dd284cd981d3f6/mkdocs_strings_replacement-0.1.0.tar.gz",
"platform": null,
"description": "# mkdocs-strings-replacement\n\n[![PyPI][pypi-version-badge-link]][pypi-link]\n[![License][license-image]][license-link]\n\nMkdocs Markdown strings replacement plugin.\n\n## Installation\n\n```bash\npip install mkdocs-strings-replacement\n```\n\n## Documentation\n\n### Setup\n\nEnable the plugin in your `mkdocs.yml`:\n\n```yaml\nplugins:\n - mkdocs-strings-replacement:\n strings_replacements:\n - old_value: \"This string will be replaced\"\n new_value: \"with this string\"\n```\n\nNote:\n- You can replace how many strings as you want. `strings_replacements` is an array of pairs of the `old_value`'s of the strings you want to replace with `new_value`'s of the strings you want to put there in exchange.\n- If you add more then one `old_value` and `new_value` pairs then the replacement will occur from the top to the bottom of the pairs you have passed.\n- Replacement will happen for any strings in the markdown, that is also for the content of your markdown file as well as in the titles.\n- Replacement will happen before rendering your pages.\n\n#### Example\n```yaml\nplugins:\n - mkdocs-strings-replacement:\n strings_replacements:\n - old_value: \"[[_TOSP_]]\"\n new_value: \"\"\n - old_value: \"[[_TOC_]]\"\n new_value: \"\"\n```\nIn the given example:\n- First your occurance of `[[_TOSP_]]` will be replaced with nothing, which will results in erasing `[[_TOSP_]]` from your pages.\n- Then from the results `[[_TOC_]]` will be replaced with empty string as well.\n\n## Development setup\nTo install the dependencies for the plugin, run:\n```sh\npip install .\n```\n\nTo set up the development environment, including dependencies for running tests, run:\n```sh\npip install -e .[dev]\n```\n\nTo run the tests, use:\n```sh\npytest\n```\n\n[pypi-link]: https://pypi.org/project/mkdocs-strings-replacement\n[pypi-version-badge-link]: https://img.shields.io/pypi/v/mkdocs-strings-replacement?logo=pypi&logoColor=white\n[license-image]: https://img.shields.io/pypi/l/mkdocs-strings-replacement?color=light-green&logo=apache&logoColor=white\n[license-link]: https://github.com/innersource-nn/midgard-mkdocs-plugins/blob/main/mkdocs-strings-replacement-plugin/LICENSE",
"bugtrack_url": null,
"license": null,
"summary": "Mkdocs strings replacement.",
"version": "0.1.0",
"project_urls": null,
"split_keywords": [
"markdown",
" mkdocs",
" plugin",
" replacement"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7f39340c1bfd1d6f2a21452cf3bc91c595b7c8ccb60a2cc3f98ded65fa33a793",
"md5": "559fdd5c6117a576cdee5d08f265f37e",
"sha256": "2003457920ac06ed9711832adf1b1af270bba38b5d18726467379b0d62d36a01"
},
"downloads": -1,
"filename": "mkdocs_strings_replacement-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "559fdd5c6117a576cdee5d08f265f37e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 4932,
"upload_time": "2024-10-01T12:42:54",
"upload_time_iso_8601": "2024-10-01T12:42:54.726846Z",
"url": "https://files.pythonhosted.org/packages/7f/39/340c1bfd1d6f2a21452cf3bc91c595b7c8ccb60a2cc3f98ded65fa33a793/mkdocs_strings_replacement-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9410447073376775c33e56b471dc610a770bf879d16eadc9f3dd284cd981d3f6",
"md5": "4fb5862a1d59abb63788ec5a100389fc",
"sha256": "73f976220b30062a69172de846e5674696f30685b67443380c9cf65bbbf78bb6"
},
"downloads": -1,
"filename": "mkdocs_strings_replacement-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "4fb5862a1d59abb63788ec5a100389fc",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 5583,
"upload_time": "2024-10-01T12:42:55",
"upload_time_iso_8601": "2024-10-01T12:42:55.981646Z",
"url": "https://files.pythonhosted.org/packages/94/10/447073376775c33e56b471dc610a770bf879d16eadc9f3dd284cd981d3f6/mkdocs_strings_replacement-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-01 12:42:55",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "mkdocs-strings-replacement"
}