text-region-parser
Parse regions in your Markdown/text files!
You can dynamically parse and update regions in your Markdown/text files like this:
Description of the project
<!-- region:name argument=value -->
This is a region with autogenerated content
<!-- endregion:name -->
End of the file
Installation
pip install text-region-parser
# or
uv add text-region-parser
# or
poetry add text-region-parser
Usage
from pathlib import Path
from typing import TypedDict
from text_region_parser import RegionConstructor
class ScopeOptions(TypedDict):
name: str
level: str
constructor = RegionConstructor()
@constructor.add_parser("scope", options_type=ScopeOptions)
def create_scope_content(options: ScopeOptions) -> str:
"""Create region `scope` with options."""
return f"Scope: {options['name']} with level {options['level']}"
# Parse the content.
file_path = Path("README.md")
constructor.update_files_data(file_path)
print(file_path.read_text())
License
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
text_region_parser-0.1.2.tar.gz
(10.3 MB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file text_region_parser-0.1.2.tar.gz.
File metadata
- Download URL: text_region_parser-0.1.2.tar.gz
- Upload date:
- Size: 10.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c9392700e72be71a8e37553d73cf3a9ddf8d50ccf92b34212f32de2d1a41ea56
|
|
| MD5 |
7acc858199d5422362c7943b27c35a2e
|
|
| BLAKE2b-256 |
8a9ba885790dc91122a868aebce2cfb7719c10dc188da3b225b2776f75ae33ca
|
File details
Details for the file text_region_parser-0.1.2-py3-none-any.whl.
File metadata
- Download URL: text_region_parser-0.1.2-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e9dc510d1ab525fca744c13bb1cb056a07ab13d442fb9329b4576139670ebc8
|
|
| MD5 |
851afedbaa05bd2934a333d996202e59
|
|
| BLAKE2b-256 |
70a91858e6114644964f1310292c924ab145268964c5455014dda38f955ceb3c
|