Parse regions in your Markdown/text files!
Project description
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
Project details
Release history Release notifications | RSS feed
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.1.tar.gz
(38.3 kB
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.1.tar.gz.
File metadata
- Download URL: text_region_parser-0.1.1.tar.gz
- Upload date:
- Size: 38.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.24
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7a1f0a6cbe851f37c94552cf41ce011621c1a62623e7215c02624cce05b8436
|
|
| MD5 |
c5b2f1c4fb3cb743587c3b6b2e56a6c4
|
|
| BLAKE2b-256 |
2ad67fce2ff3010edf1ffb7fb3684d2f28146c00f7c209ec9525b6068d98dc4a
|
File details
Details for the file text_region_parser-0.1.1-py3-none-any.whl.
File metadata
- Download URL: text_region_parser-0.1.1-py3-none-any.whl
- Upload date:
- Size: 9.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.24
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
79107987d6c4ffd3b432d612c276c5965c2af9d770088a8437ca4456de548f76
|
|
| MD5 |
616b94db4c0d4725fb3d0c3a49b110bd
|
|
| BLAKE2b-256 |
bde67069a798b671ba87fdc0a2bc8c376396cfe17907fa956882d7ba713e0023
|