Skip to main content

A corpus-statutes YAML formatter with smart wrapping rules

Project description

YAML Lex Formatter

yaml-lex is a Python tool for reformatting YAML files with specific wrapping rules.

It is designed to make YAML files more readable and maintainable, particularly for content-heavy nodes like content, caption, and title.

Features

✅ Wraps long strings at a configurable line width ✅ Preserves blank lines and paragraph breaks ✅ Converts long text into block scalars (|-) for YAML readability ✅ Special rules for common keys: - content → always block scalar unless it contains a Markdown table - caption / title → flattened into single line, then wrapped if too long - Other long strings → wrapped into block scalars ✅ Detects and preserves Markdown tables (avoids breaking table formatting) ✅ Works on a single file or recursively on a folder of YAML files ✅ In-place editing or output to a new file

Notes

  • Rich logging using rich.
  • Fully compatible with doctest-style examples for testing.
  • Supports CI/CD workflows with testing, linting, pre-commit hooks, and docs building.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yaml_lex-0.2.2.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yaml_lex-0.2.2-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file yaml_lex-0.2.2.tar.gz.

File metadata

  • Download URL: yaml_lex-0.2.2.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.22

File hashes

Hashes for yaml_lex-0.2.2.tar.gz
Algorithm Hash digest
SHA256 eea7cd2d16f44642391b6b4ce19e4f8a8a7e69043a5a6104433e7ef7b379cf0f
MD5 65e014c2e98368730a4290782bc7bd95
BLAKE2b-256 826083593f460753c4297b9e5f44248cfa75723a219d3ff3135a8c4053aa0d17

See more details on using hashes here.

File details

Details for the file yaml_lex-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: yaml_lex-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.22

File hashes

Hashes for yaml_lex-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a721574f263dd4c8fdb9b195255c72702f5216591577405049c6f131e87900dd
MD5 ce742c5b3477a17e94b091b39662cc7e
BLAKE2b-256 ce87f3d5d0ac427ac76bb2c8a270ab6d5dbc8d8f1fedd550abb673731ce0d8d7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page