A tiny, hookable reStructuredText-to-text converter
Project description
nanorst
nanorst converts a deliberately small subset of reStructuredText (rST) into readable
plain text. A state hook can be used to convert inline formatting to other forms, such as
terminal escapes or HTML.
from nanorst import rst_to_text, rst_to_terminal
assert rst_to_text("This is **important**.") == "This is important."
print(rst_to_terminal("This is **important**."))
Supported constructs include emphasis, strong emphasis, inline literals, references supplied by the caller, simple directives, and indented literal blocks. This module is intentionally a loose converter, not a standards-complete reStructuredText implementation.
Development
Create a virtual environment, then install the project and its test dependencies:
python -m pip install -e '.[test]'
pytest
Build both distribution formats and validate their metadata with:
python -m pip install '.[build]'
python -m build
twine check dist/*
Releases are published by the release.yml GitHub Actions workflow when a
version tag such as v0.1.0 is pushed. Configure a PyPI Trusted Publisher for
the enkore/nanorst repository, workflow release.yml, and environment pypi.
Users
borgbackup has been using nanorst since borg 1.1.0 as a lightweight rST terminal
formatter for --help and borg help TOPIC. The same rST sources are also rendered
using sphinx-doc for the manual.
License
BSD-3-Clause. See 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
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 nanorst-1.0.1.tar.gz.
File metadata
- Download URL: nanorst-1.0.1.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f4e8d36cadf59d4d953cb40a9e588e0314112c5520bc9fe3a50ba1c0adfbf2a1
|
|
| MD5 |
3a5577c94fcbbbe5382e7849bc2ad3e0
|
|
| BLAKE2b-256 |
e0270b50200fab6086c962f2de509467af1b0b444c9fb69a23ebdcd6025a41f4
|
Provenance
The following attestation bundles were made for nanorst-1.0.1.tar.gz:
Publisher:
release.yml on enkore/nanorst
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nanorst-1.0.1.tar.gz -
Subject digest:
f4e8d36cadf59d4d953cb40a9e588e0314112c5520bc9fe3a50ba1c0adfbf2a1 - Sigstore transparency entry: 2190582419
- Sigstore integration time:
-
Permalink:
enkore/nanorst@fac3dc89a3045b7acb546748eda77526ed609fbe -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/enkore
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@fac3dc89a3045b7acb546748eda77526ed609fbe -
Trigger Event:
push
-
Statement type:
File details
Details for the file nanorst-1.0.1-py3-none-any.whl.
File metadata
- Download URL: nanorst-1.0.1-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b5039a5975d0f443e451b8e75bec7856a76869c4ac640480ee929233dd00edb0
|
|
| MD5 |
02971dca3178e5569544b8f15a98300b
|
|
| BLAKE2b-256 |
d6d15a6bc2a6d4b402fd2a31ef85151f4b3582dd39211262e2d813dc93aa980c
|
Provenance
The following attestation bundles were made for nanorst-1.0.1-py3-none-any.whl:
Publisher:
release.yml on enkore/nanorst
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nanorst-1.0.1-py3-none-any.whl -
Subject digest:
b5039a5975d0f443e451b8e75bec7856a76869c4ac640480ee929233dd00edb0 - Sigstore transparency entry: 2190582439
- Sigstore integration time:
-
Permalink:
enkore/nanorst@fac3dc89a3045b7acb546748eda77526ed609fbe -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/enkore
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@fac3dc89a3045b7acb546748eda77526ed609fbe -
Trigger Event:
push
-
Statement type: