Skip to main content

Replace text for Foliant

Preprocessor for simple search and replace in Markdown sources with support of regular expressions.

Installation

$ pip install foliantcontrib.replace

Config

To enable the preprocessor, add replace to preprocessors section in the project config:

preprocessors:
  - replace

The preprocessor has two options:

preprocessors:
  - replace:
      dictionary:
        Mike: Michael
        Sam: Samuel
        Tim: Timoel
      re_dictionary:
        '!\[\]\((.+?)\)': '![Figure](\1)'

dictionary : YAML mapping where key is string to replace, value is the replacement string.

re_dictionary : YAML mapping where key is Python regular expression pattern, value is the replacement string.

Usage

Fill up the dictionary or/and re_dictionary in preprocessor options and the keys will be replaced with values.

For example, if you wish that all images without title in your Markdown sources were titled "Figure", use the following config:

preprocessors:
  - replace:
      re_dictionary:
        '!\[\]\((.+?)\)': '![Figure](\1)'

Metadata

Release files for foliantcontrib.replace 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for foliantcontrib.replace 2.0.0
File Size Uploaded
foliantcontrib.replace-2.0.0.tar.gz 3.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for foliantcontrib.replace 2.0.0
File Interpreter ABI Platform
foliantcontrib.replace-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.4 kB

Release files / foliantcontrib.replace-2.0.0.tar.gz

Download URL foliantcontrib.replace-2.0.0.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
49e3a8b55e74ef85a43136d35d23b933cb3916635a0aabb85333d984926d54d0
BLAKE2b-256 checksum
How to use checksums
9d547787a697419d9d81f5e33d145091f022e0cdf68e0513e59709c8013ea8a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.9

Release files / foliantcontrib.replace-2.0.0-py3-none-any.whl

Download URL foliantcontrib.replace-2.0.0-py3-none-any.whl
Size 3.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
304329cc5878b43018378d079add4574a50eef7bb0768991f20060760e3160c5
BLAKE2b-256 checksum
How to use checksums
a9438179838b0d1a7bbd04082ecd139623ea0b68e9584d90c28973ad6e3f49a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.9

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page