Skip to main content

Adds a really simple and naive sentence breaking scheme to mdformat

Project description

mdformat-sentencebreak

An mdformat plugin that adds line wrapping based on sentence completion marks.

Behavior

This input ....

> Long sentences are broken at punctuation marks,
> unless the generated sentence would be extremely small
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna.

> And it will not break sentences if
> they are inside something else ... emphasis for example
**Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna.**

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna.
**Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna.**
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna.

> Sentences are kept separate if they end in punctuation

Some.
Very.
Small.
Series.
of.
Sentences.

> Sentences are combined if they do not end in punctuation.

a
very
sloppy
sentence

Will get this ....

Lorem ipsum dolor sit amet,
consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna.

**Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna.**

Lorem ipsum dolor sit amet,
consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna.
**Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna.**
Lorem ipsum dolor sit amet,
consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna.

Some.
Very.
Small.
Series.
of.
Sentences.

a very sloppy sentence

Installation

pip install mdformat-sentencebreak

Or using pipx

pipx install mdformat
pipx inject mdformat mdformat-sentencebreak

Usage

After installing mdformat and mdformat-sentencebreak, you can format a markdown file by calling:

mdformat {NAME_OF_YOUR_MARKRDOWN_FILE.md}

TODO:

  • Support for ellipsis in a long line
    • (...) gets broken into . ..

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

mdformat-sentencebreak-0.4.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

mdformat_sentencebreak-0.4.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file mdformat-sentencebreak-0.4.0.tar.gz.

File metadata

  • Download URL: mdformat-sentencebreak-0.4.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.0 CPython/3.10.6 Linux/5.15.0-1019-azure

File hashes

Hashes for mdformat-sentencebreak-0.4.0.tar.gz
Algorithm Hash digest
SHA256 a3bf5c28957d9f6c7aa74c663291024131f416d5d2e23339af6fcf408fa6ad31
MD5 227522e03d5b6b642d34134e56c96f04
BLAKE2b-256 7f3b26be2c08a1c210e65218e36980bfb6fe724ea7f1675031749a388864ffbb

See more details on using hashes here.

File details

Details for the file mdformat_sentencebreak-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mdformat_sentencebreak-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 699e876c4e8cf2b0078a9345b3d30b437a74409287457dbafd6da70655fef64d
MD5 28b720ae5d0c9e50ad235af10b2cdd04
BLAKE2b-256 926e4b873a30e00fd6f8fd01162523a0927ef62720d27a6e38cc54ee55eb4dcf

See more details on using hashes here.

Supported by

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