flowmark 0.5.2__tar.gz → 0.5.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. {flowmark-0.5.2 → flowmark-0.5.3}/.copier-answers.yml +1 -1
  2. {flowmark-0.5.2 → flowmark-0.5.3}/.github/workflows/ci.yml +1 -1
  3. {flowmark-0.5.2 → flowmark-0.5.3}/.github/workflows/publish.yml +1 -1
  4. {flowmark-0.5.2 → flowmark-0.5.3}/PKG-INFO +1 -1
  5. {flowmark-0.5.2 → flowmark-0.5.3}/pyproject.toml +1 -1
  6. flowmark-0.5.3/src/flowmark/__init__.py +34 -0
  7. flowmark-0.5.2/src/flowmark/custom_marko.py → flowmark-0.5.3/src/flowmark/formats/flowmark_markdown.py +10 -6
  8. {flowmark-0.5.2/src/flowmark → flowmark-0.5.3/src/flowmark/linewrapping}/line_wrappers.py +7 -3
  9. {flowmark-0.5.2/src/flowmark → flowmark-0.5.3/src/flowmark/linewrapping}/markdown_filling.py +14 -10
  10. {flowmark-0.5.2/src/flowmark → flowmark-0.5.3/src/flowmark/linewrapping}/text_filling.py +1 -1
  11. {flowmark-0.5.2 → flowmark-0.5.3}/src/flowmark/reformat_api.py +3 -3
  12. {flowmark-0.5.2/src/flowmark → flowmark-0.5.3/src/flowmark/transforms}/doc_cleanups.py +1 -1
  13. {flowmark-0.5.2/src/flowmark → flowmark-0.5.3/src/flowmark/transforms}/doc_transforms.py +1 -1
  14. {flowmark-0.5.2 → flowmark-0.5.3}/tests/test_cleanups.py +4 -4
  15. {flowmark-0.5.2 → flowmark-0.5.3}/tests/test_ellipses.py +1 -1
  16. {flowmark-0.5.2 → flowmark-0.5.3}/tests/test_filling.py +4 -1
  17. {flowmark-0.5.2 → flowmark-0.5.3}/tests/test_frontmatter.py +2 -2
  18. {flowmark-0.5.2 → flowmark-0.5.3}/tests/test_list_spacing.py +1 -1
  19. {flowmark-0.5.2 → flowmark-0.5.3}/tests/test_ref_docs.py +1 -1
  20. {flowmark-0.5.2 → flowmark-0.5.3}/tests/test_smartquotes.py +1 -1
  21. {flowmark-0.5.2 → flowmark-0.5.3}/tests/test_wrapping.py +2 -2
  22. flowmark-0.5.3/uv.lock +389 -0
  23. flowmark-0.5.2/src/flowmark/__init__.py +0 -28
  24. flowmark-0.5.2/uv.lock +0 -382
  25. {flowmark-0.5.2 → flowmark-0.5.3}/.cursor/rules/flowmark.mdc +0 -0
  26. {flowmark-0.5.2 → flowmark-0.5.3}/.cursor/rules/general.mdc +0 -0
  27. {flowmark-0.5.2 → flowmark-0.5.3}/.cursor/rules/python.mdc +0 -0
  28. {flowmark-0.5.2 → flowmark-0.5.3}/.gitignore +0 -0
  29. {flowmark-0.5.2 → flowmark-0.5.3}/.vscode/settings.json +0 -0
  30. {flowmark-0.5.2 → flowmark-0.5.3}/LICENSE +0 -0
  31. {flowmark-0.5.2 → flowmark-0.5.3}/Makefile +0 -0
  32. {flowmark-0.5.2 → flowmark-0.5.3}/README.md +0 -0
  33. {flowmark-0.5.2 → flowmark-0.5.3}/development.md +0 -0
  34. {flowmark-0.5.2 → flowmark-0.5.3}/devtools/lint.py +0 -0
  35. {flowmark-0.5.2 → flowmark-0.5.3}/installation.md +0 -0
  36. {flowmark-0.5.2 → flowmark-0.5.3}/poetry.lock +0 -0
  37. {flowmark-0.5.2 → flowmark-0.5.3}/publishing.md +0 -0
  38. {flowmark-0.5.2 → flowmark-0.5.3}/src/flowmark/cli.py +0 -0
  39. {flowmark-0.5.2/src/flowmark → flowmark-0.5.3/src/flowmark/formats}/frontmatter.py +0 -0
  40. {flowmark-0.5.2/src/flowmark → flowmark-0.5.3/src/flowmark/linewrapping}/sentence_split_regex.py +0 -0
  41. {flowmark-0.5.2/src/flowmark → flowmark-0.5.3/src/flowmark/linewrapping}/text_wrapping.py +0 -0
  42. {flowmark-0.5.2 → flowmark-0.5.3}/src/flowmark/py.typed +0 -0
  43. {flowmark-0.5.2/src/flowmark → flowmark-0.5.3/src/flowmark/typography}/ellipses.py +0 -0
  44. {flowmark-0.5.2/src/flowmark → flowmark-0.5.3/src/flowmark/typography}/smartquotes.py +0 -0
  45. {flowmark-0.5.2 → flowmark-0.5.3}/tests/test_sentences.py +0 -0
  46. {flowmark-0.5.2 → flowmark-0.5.3}/tests/test_width_options.py +0 -0
  47. {flowmark-0.5.2 → flowmark-0.5.3}/tests/testdocs/.gitignore +0 -0
  48. {flowmark-0.5.2 → flowmark-0.5.3}/tests/testdocs/testdoc.expected.auto.md +0 -0
  49. {flowmark-0.5.2 → flowmark-0.5.3}/tests/testdocs/testdoc.expected.cleaned.md +0 -0
  50. {flowmark-0.5.2 → flowmark-0.5.3}/tests/testdocs/testdoc.expected.plain.md +0 -0
  51. {flowmark-0.5.2 → flowmark-0.5.3}/tests/testdocs/testdoc.expected.semantic.md +0 -0
  52. {flowmark-0.5.2 → flowmark-0.5.3}/tests/testdocs/testdoc.orig.md +0 -0
@@ -1,5 +1,5 @@
1
1
  # Changes here will be overwritten by Copier. Do not edit manually.
2
- _commit: v0.2.15
2
+ _commit: v0.2.16
3
3
  _src_path: gh:jlevy/simple-modern-uv
4
4
  package_author_email: joshua@cal.berkeley.edu
5
5
  package_author_name: Joshua Levy
@@ -41,7 +41,7 @@ jobs:
41
41
  uses: astral-sh/setup-uv@v5
42
42
  with:
43
43
  # Update this as needed:
44
- version: "0.8.0"
44
+ version: "0.8.4"
45
45
  enable-cache: true
46
46
  python-version: ${{ matrix.python-version }}
47
47
 
@@ -21,7 +21,7 @@ jobs:
21
21
  - name: Install uv (official Astral action)
22
22
  uses: astral-sh/setup-uv@v5
23
23
  with:
24
- version: "0.8.0"
24
+ version: "0.8.4"
25
25
  enable-cache: true
26
26
  python-version: "3.12"
27
27
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flowmark
3
- Version: 0.5.2
3
+ Version: 0.5.3
4
4
  Summary: Better auto-formatting for Markdown and plaintext
5
5
  Project-URL: Repository, https://github.com/jlevy/flowmark
6
6
  Author-email: Joshua Levy <joshua@cal.berkeley.edu>
@@ -49,7 +49,7 @@ dev = [
49
49
  "ruff>=0.11.9",
50
50
  "codespell>=2.4.1",
51
51
  "rich>=14.0.0",
52
- "basedpyright>=1.29.1",
52
+ "basedpyright==1.29.5", # TODO: Upgrade when Cursor supports it.
53
53
  "funlog>=0.2.1",
54
54
  ]
55
55
 
@@ -0,0 +1,34 @@
1
+ __all__ = (
2
+ "fill_text",
3
+ "fill_markdown",
4
+ "first_sentence",
5
+ "first_sentences",
6
+ "flowmark_markdown",
7
+ "html_md_word_splitter",
8
+ "simple_word_splitter",
9
+ "line_wrap_by_sentence",
10
+ "line_wrap_to_width",
11
+ "reformat_file",
12
+ "reformat_text",
13
+ "split_sentences_regex",
14
+ "wrap_paragraph",
15
+ "wrap_paragraph_lines",
16
+ "Wrap",
17
+ )
18
+
19
+ from flowmark.formats.flowmark_markdown import flowmark_markdown
20
+ from flowmark.linewrapping.line_wrappers import line_wrap_by_sentence, line_wrap_to_width
21
+ from flowmark.linewrapping.markdown_filling import fill_markdown
22
+ from flowmark.linewrapping.sentence_split_regex import (
23
+ first_sentence,
24
+ first_sentences,
25
+ split_sentences_regex,
26
+ )
27
+ from flowmark.linewrapping.text_filling import Wrap, fill_text
28
+ from flowmark.linewrapping.text_wrapping import (
29
+ html_md_word_splitter,
30
+ simple_word_splitter,
31
+ wrap_paragraph,
32
+ wrap_paragraph_lines,
33
+ )
34
+ from flowmark.reformat_api import reformat_file, reformat_text
@@ -14,7 +14,7 @@ from marko.parser import Parser
14
14
  from marko.source import Source
15
15
  from typing_extensions import override
16
16
 
17
- from flowmark.line_wrappers import LineWrapper
17
+ from flowmark.linewrapping.line_wrappers import LineWrapper
18
18
 
19
19
 
20
20
  def _normalize_title_quotes(title: str) -> str:
@@ -327,17 +327,21 @@ class MarkdownNormalizer(Renderer):
327
327
  return element.dest
328
328
 
329
329
 
330
- def custom_marko(line_wrapper: LineWrapper) -> Markdown:
330
+ def flowmark_markdown(line_wrapper: LineWrapper) -> Markdown:
331
331
  """
332
- Marko Markdown setup for GFM with minor customizations and a
333
- renderer that normalizes Markdown.
332
+ Marko Markdown setup for GFM with a few customizations for Flowmark and a new
333
+ renderer that normalizes Markdown according to Flowmark's conventions.
334
334
  """
335
335
 
336
336
  class CustomRenderer(MarkdownNormalizer):
337
337
  def __init__(self) -> None:
338
338
  super().__init__(line_wrapper)
339
339
 
340
- class CustomMarkdown(Markdown):
340
+ class FlowmarkMarkdown(Markdown):
341
+ """
342
+ Marko Markdown API with Flowmark customizations.
343
+ """
344
+
341
345
  def __init__(self) -> None: # pyright: ignore[reportMissingSuperCall]
342
346
  pass
343
347
 
@@ -364,4 +368,4 @@ def custom_marko(line_wrapper: LineWrapper) -> Markdown:
364
368
 
365
369
  self._setup_done: bool = True
366
370
 
367
- return CustomMarkdown()
371
+ return FlowmarkMarkdown()
@@ -2,9 +2,13 @@ import re
2
2
  from collections.abc import Callable
3
3
  from typing import Protocol
4
4
 
5
- from flowmark.sentence_split_regex import split_sentences_regex
6
- from flowmark.text_filling import DEFAULT_WRAP_WIDTH
7
- from flowmark.text_wrapping import DEFAULT_LEN_FUNCTION, wrap_paragraph, wrap_paragraph_lines
5
+ from flowmark.linewrapping.sentence_split_regex import split_sentences_regex
6
+ from flowmark.linewrapping.text_filling import DEFAULT_WRAP_WIDTH
7
+ from flowmark.linewrapping.text_wrapping import (
8
+ DEFAULT_LEN_FUNCTION,
9
+ wrap_paragraph,
10
+ wrap_paragraph_lines,
11
+ )
8
12
 
9
13
  DEFAULT_MIN_LINE_LEN = 20
10
14
  """Default minimum line length for sentence breaking."""
@@ -15,15 +15,19 @@ import re
15
15
  from collections.abc import Callable
16
16
  from textwrap import dedent
17
17
 
18
- from flowmark.custom_marko import custom_marko
19
- from flowmark.doc_cleanups import doc_cleanups
20
- from flowmark.doc_transforms import rewrite_text_content
21
- from flowmark.ellipses import ellipses as apply_ellipses
22
- from flowmark.frontmatter import split_frontmatter
23
- from flowmark.line_wrappers import LineWrapper, line_wrap_by_sentence, line_wrap_to_width
24
- from flowmark.sentence_split_regex import split_sentences_regex
25
- from flowmark.smartquotes import smart_quotes
26
- from flowmark.text_filling import DEFAULT_WRAP_WIDTH
18
+ from flowmark.formats.flowmark_markdown import flowmark_markdown
19
+ from flowmark.formats.frontmatter import split_frontmatter
20
+ from flowmark.linewrapping.line_wrappers import (
21
+ LineWrapper,
22
+ line_wrap_by_sentence,
23
+ line_wrap_to_width,
24
+ )
25
+ from flowmark.linewrapping.sentence_split_regex import split_sentences_regex
26
+ from flowmark.linewrapping.text_filling import DEFAULT_WRAP_WIDTH
27
+ from flowmark.transforms.doc_cleanups import doc_cleanups
28
+ from flowmark.transforms.doc_transforms import rewrite_text_content
29
+ from flowmark.typography.ellipses import ellipses as apply_ellipses
30
+ from flowmark.typography.smartquotes import smart_quotes
27
31
 
28
32
 
29
33
  def _normalize_html_comments(text: str, break_str: str = "\n\n") -> str:
@@ -126,7 +130,7 @@ def fill_markdown(
126
130
  markdown_text = _normalize_html_comments(markdown_text)
127
131
 
128
132
  # Parse and render.
129
- marko = custom_marko(line_wrapper)
133
+ marko = flowmark_markdown(line_wrapper)
130
134
  document = marko.parse(markdown_text)
131
135
  if cleanups:
132
136
  doc_cleanups(document)
@@ -2,7 +2,7 @@ import re
2
2
  from collections.abc import Callable
3
3
  from enum import Enum
4
4
 
5
- from flowmark.text_wrapping import (
5
+ from flowmark.linewrapping.text_wrapping import (
6
6
  DEFAULT_LEN_FUNCTION,
7
7
  WordSplitter,
8
8
  html_md_word_splitter,
@@ -3,9 +3,9 @@ from pathlib import Path
3
3
 
4
4
  from strif import atomic_output_file
5
5
 
6
- from flowmark.markdown_filling import fill_markdown
7
- from flowmark.text_filling import Wrap, fill_text
8
- from flowmark.text_wrapping import html_md_word_splitter
6
+ from flowmark.linewrapping.markdown_filling import fill_markdown
7
+ from flowmark.linewrapping.text_filling import Wrap, fill_text
8
+ from flowmark.linewrapping.text_wrapping import html_md_word_splitter
9
9
 
10
10
 
11
11
  def reformat_text(
@@ -4,7 +4,7 @@ from marko import block, inline
4
4
  from marko.block import Document
5
5
  from marko.element import Element
6
6
 
7
- from flowmark.doc_transforms import transform_tree
7
+ from flowmark.transforms.doc_transforms import transform_tree
8
8
 
9
9
 
10
10
  def _unbold_heading_transformer(element: Element) -> None:
@@ -45,7 +45,7 @@ def coalesce_raw_text_nodes(doc: Document) -> None:
45
45
  This is useful for smart quotes processing which needs to see text that spans
46
46
  across line breaks as a single unit.
47
47
  """
48
- from flowmark.doc_transforms import transform_tree
48
+ from flowmark.transforms.doc_transforms import transform_tree
49
49
 
50
50
  def transformer(element: Element) -> None:
51
51
  if hasattr(element, "children") and isinstance(element.children, list): # pyright: ignore
@@ -1,6 +1,6 @@
1
- from flowmark.custom_marko import custom_marko
2
- from flowmark.doc_cleanups import unbold_headings
3
- from flowmark.line_wrappers import line_wrap_by_sentence
1
+ from flowmark.formats.flowmark_markdown import flowmark_markdown
2
+ from flowmark.linewrapping.line_wrappers import line_wrap_by_sentence
3
+ from flowmark.transforms.doc_cleanups import unbold_headings
4
4
 
5
5
  input_md = """
6
6
  # **Bold Heading 1**
@@ -53,7 +53,7 @@ Final text.
53
53
 
54
54
 
55
55
  def test_unbold_headings() -> None:
56
- marko = custom_marko(line_wrap_by_sentence())
56
+ marko = flowmark_markdown(line_wrap_by_sentence())
57
57
 
58
58
  doc = marko.parse(input_md)
59
59
  unbold_headings(doc)
@@ -1,4 +1,4 @@
1
- from flowmark.ellipses import ellipses
1
+ from flowmark.typography.ellipses import ellipses
2
2
 
3
3
 
4
4
  def test_ellipses():
@@ -2,7 +2,10 @@ from textwrap import dedent
2
2
 
3
3
  import marko
4
4
 
5
- from flowmark.markdown_filling import _normalize_html_comments, fill_markdown # pyright: ignore
5
+ from flowmark.linewrapping.markdown_filling import (
6
+ _normalize_html_comments, # pyright: ignore[reportPrivateUsage]
7
+ fill_markdown,
8
+ )
6
9
 
7
10
 
8
11
  def test_normalize_html_comments():
@@ -1,5 +1,5 @@
1
- from flowmark.frontmatter import has_frontmatter, split_frontmatter
2
- from flowmark.markdown_filling import fill_markdown
1
+ from flowmark.formats.frontmatter import has_frontmatter, split_frontmatter
2
+ from flowmark.linewrapping.markdown_filling import fill_markdown
3
3
 
4
4
 
5
5
  def test_split_frontmatter():
@@ -10,7 +10,7 @@ number of paragraphs in the list item.
10
10
 
11
11
  from textwrap import dedent
12
12
 
13
- from flowmark.markdown_filling import fill_markdown
13
+ from flowmark.linewrapping.markdown_filling import fill_markdown
14
14
 
15
15
 
16
16
  def test_list_items_with_code_blocks():
@@ -1,7 +1,7 @@
1
1
  from dataclasses import dataclass
2
2
  from pathlib import Path
3
3
 
4
- from flowmark.markdown_filling import fill_markdown
4
+ from flowmark.linewrapping.markdown_filling import fill_markdown
5
5
 
6
6
  testdoc_dir = Path("tests/testdocs")
7
7
 
@@ -1,4 +1,4 @@
1
- from flowmark.smartquotes import smart_quotes
1
+ from flowmark.typography.smartquotes import smart_quotes
2
2
 
3
3
 
4
4
  def test_basic_double_quotes():
@@ -1,6 +1,6 @@
1
1
  from textwrap import dedent
2
2
 
3
- from flowmark.text_wrapping import (
3
+ from flowmark.linewrapping.text_wrapping import (
4
4
  _HtmlMdWordSplitter, # pyright: ignore
5
5
  html_md_word_splitter,
6
6
  markdown_escape_word,
@@ -224,7 +224,7 @@ def test_wrap_width():
224
224
 
225
225
 
226
226
  def test_line_wrap_to_width_with_markdown_breaks():
227
- from flowmark.line_wrappers import line_wrap_to_width
227
+ from flowmark.linewrapping.line_wrappers import line_wrap_to_width
228
228
 
229
229
  # Get a markdown-aware line wrapper
230
230
  wrapper = line_wrap_to_width(width=80, is_markdown=True)