Skip to main content

trimgmi

Opinionated parsing of gemtext.

Usage

See "convert", "command" and "sample" modules for examples.

FIXME: Document this in more detail.

Description

Gemtext (GMI) is a lightweight, line-oriented markup language designed for the Gemini internet protocol. This module parses gemtext, ignoring extraneous whitespace. Text after closing ``` marks is also ignored.

The resulting objects can be rendered line-by-line without further parsing logic.

Also included are:

  • round-trip render back to GMI with minimal whitespace
  • simple render to CommonMark
  • opinionated render to HTML
  • primitive command line tools for the above

Read more about gemtext:

Implementation

This module has no external dependencies.

This implementation is deliberately verbose so that a developer can confirm by reading that the parser follows the gemtext specification. Optimising the core module is out-of-scope.

Testing

The following commands should run without changing the target files:

trimgmi test_search
# example.gmi remains tidy
# example.txt remains untidy
# *.license remain unchanged

convertgmi gmi README test_output/README.gmi  # identical
convertgmi md README test_output/README.md  # readable
convertgmi html README test_output/README.html  # readable

FIXME: Implement and document a comprehensive round-trip test harness.

Build

python setup.py sdist bdist_wheel

If everything works as expected you should end up with the files:

dist/trimgmi-<version>-py3-none-any.whl
dist/trimgmi-<version>.tar.gz

You can now optionally upload to PyPI:

twine upload dist/*

Sharing and contributions

trimgmi
https://gitlab.com/lofidevops/trimgmi
Copyright 2022 David Seaward and contributors
SPDX-License-Identifier: GPL-3.0-or-later

Shared under GPL-3.0-or-later. We adhere to the Contributor Covenant 2.0 without modification, and certify origin per DCO 1.1 with a signed-off-by line (git -s). Contributions under the same terms are welcome.

For details see COPYING, CODE_OF_CONDUCT.md (report via private ticket) and CONTRIBUTING.DCO.txt.

Metadata

Release files for trimgmi 0.3.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 trimgmi 0.3.0
File Size Uploaded Provenance Actions
trimgmi-0.3.0.tar.gz 6.6 kB Without provenance Details for trimgmi-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for trimgmi 0.3.0
File Interpreter ABI Platform Actions
trimgmi-0.3.0-py3-none-any.whl Python 3 none any Details for trimgmi-0.3.0-py3-none-any.whl

Total release size: 25.1 kB

Release files / trimgmi-0.3.0.tar.gz

Download URL trimgmi-0.3.0.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
22f50e5e1691a6d4e13811e5136dc8eb6936da3be15a9a3d415f84c998b65a35
BLAKE2b-256 checksum
How to use checksums
f3811c4c1cbf449df2f80374ed725559f55fa2dd70e513633b250404cfbbc0fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.8.10

Release files / trimgmi-0.3.0-py3-none-any.whl

Download URL trimgmi-0.3.0-py3-none-any.whl
Size 18.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8fc836ec28c3a4c0e68b94f654f0279ec2185f365555b1974c4e725d0e5208fe
BLAKE2b-256 checksum
How to use checksums
fd8681cf08a276733221f4bcc5a40b494640f892d99097aecf3e8fcd5935dfbf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.8.10

Security for trimgmi 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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