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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

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