flowmark 0.2.7

A Markdown auto-formatter for clean diffs and semantic line breaks
Documentation
<!-- Parity corner-cases test document.
     Exercises ALL known bugs D1-D16, P1-P9 between Rust flowmark and Python flowmark v0.6.4.
     Expected output files are GENERATED by running Python flowmark, not hand-written.
     See: tests/test_parity_golden.rs -->

# Corner Cases: Parity Test Document

## D1: Plaintext mode preserves code fences

Some text before.

```javascript
// This is a code block
var x = 5;
```

More text after.

```
This is
another code block.
```

End of D1 section.

## D2: Plaintext word splitting treats markdown links as atomic

The school is
[St. John's Beaumont School](https://en.wikipedia.org/wiki/St_John%27s_Beaumont_School)
in the area.

## D3: Narrow width wrapping around sup tags

wb\+ mode (binary read/write), automatically deleted when closed or on process
termination.<sup>19</sup> While convenient, POSIX notes potential permission issues and
recommends mkstemp followed by fdopen for multithreaded apps to avoid leaking file
descriptors.<sup>59</sup>

## D4: Tight list spacing with nested sublists

- Level 1a - Level 2a - Level 3a - Level 1b - Level 2b

Simple sublists:

- A - B - C - D

Ordered sublists:

1. Ordered 1 1. Sub 1 2. Sub 2 2. Ordered 2

## D5: Loose list spacing with footnote embedded lists

[^217]: Testing - : Is Ketamine Contraindicated? - REBEL EM - more words,
<https://rebelem.com/test>

[^multiline]: Another footnote.

## D6: Nested blockquotes without extra blank lines

> Level 1 > > Level 2 > > > Level 3

Two levels:

> Outer > > Inner

Blockquote with blank separator preserved:

> Outer quote. > > > Inner quote.

## D7: Footnote body preserves structure

[^3]: Footnote with continuation text that is long enough to test proper wrapping and
line breaking behavior in the output format.

## D8: Footnote body blockquote continuation

[^4]: Footnote with blockquote: > This is quoted inside footnote.

[^5]: Another simple footnote that has enough text to verify wrapping.

## D9: Empty and whitespace input

<!-- D9 is tested separately (empty string input). This section tests near-empty. -->

Just a single paragraph.

## D10: HTML entities preserved

&amp; &lt; &gt; &quot;

The value is &gt; 5 and &lt; 10.

## D12: Paragraph before code fence — tight transition

**Configuration Options**: ```typescript
{
  minTime: number,
}
```

Add to root `package.json`: ```json
{
  "scripts": {}
}
```

First block: ```bash
echo hello
```

Second block: ```python
print("hi")
```

## D12b: Mixed loose/tight list code fences

Real-world pattern from corpus (plan-2026-02-17-batch-research-qa-cycle-v3.md):

- [ ] Create output: ```bash
  cd web
  ``` - [ ] Launch all:

```bash
  cd web
  pnpm batch
  ```

Note: If key not available, skip. - [ ] Monitor: ```bash
  watch ls
  ``` - [ ] Check
failures: ```bash
  echo check
  ```

## D13: Blockquote blank continuation line indentation

Real-world pattern from corpus (template-process-error-review.md):

> This is a template. Before executing this process: > > 1. **Copy this file** to a
dated version: > > ```
>    template-process.md
>    ``` > > 2. **Review the previous**
for context: > > - Check the section

Another pattern from corpus (impl-2025-11-06 specs):

> - Rules: > > 1. Look for duplicated code > > 2. Look for dead code

## D14: Escaped backtick in table inline code

| Col1 | Col2 | | --- | --- | | swallowing | `throw new CLIError(\`${msg}:
${error.message}\`)` |

## D15: Smart quote after inline code (context-sensitive)

The `config`'s value is important.

Call `foo()`'s result.

Use `@react-spring/web`'s API and `x`'s type but `foo()`'s result.

## D16: Empty code blocks — no spurious blank line

Emergency commits:

```bash
git commit --no-verify -m "WIP: emergency fix"
````

```

```

Only use `--no-verify` when absolutely necessary.

## P1: Reference links preserved

This is [an example][ref1] of a reference link.

And [another link][ref2] too.

[ref1]: https://example.com "Example Title" [ref2]: https://example.org

## P2: Footnotes stay in position

Some text before the footnote.[^early]

[^early]: This footnote appears mid-document.

More text after the footnote.

## P3: Escaped characters preserved

Escaped double quote: \"hello\"

Escaped at-sign: \@user

All CommonMark escapable: \! \# \$ \% \& \' \( \) \* \+ \, \- \. \/ \: \; \< \= \> \? \@
\[ \\ \] \^ \_ \` \{ \| \} \~

## P4: Nested list no extra blank line

- Parent item - Child 1 - Child 2 - Another parent

## Smart quotes in various contexts

"Double quoted" and 'single quoted' text.

It's a contraction.

"Nested 'quotes' here" should work.

Don't rebuild grep: full-text search is ripgrep's job, not ours.

## Mixed formatting stress test

> This blockquote has: > > 1. A numbered list with **bold** text > >
```bash
>    echo "code in blockquote list"
>    ``` > > 2. Another item with
`inline code`'s possessive > > - Nested bullet > - Another bullet

- Top-level list with [a link](https://example.com) and &amp; entity - Sublist with
`code` - Deep nesting - Another item

```typescript
  const x: string = "hello";
  ```

Continuation paragraph after code block.

---

End of corner cases document.