Skip to content

Pipe escaping fix, Unicode width handling, tests, ADR 0001 - #270

Merged
leynos merged 3 commits into
fix-mdtable-markdownlint-errors-dp20i0from
fix-pipe-escaping-and-add-tests-4hb1uo
Apr 22, 2026
Merged

Pipe escaping fix, Unicode width handling, tests, ADR 0001#270
leynos merged 3 commits into
fix-mdtable-markdownlint-errors-dp20i0from
fix-pipe-escaping-and-add-tests-4hb1uo

Conversation

@leynos

@leynos leynos commented Apr 22, 2026

Copy link
Copy Markdown
Owner
## Summary - Implements fix for escaping pipes within the table reflow pipeline - Adds tests to ensure continuation rows preserve column boundaries and escaped pipes remain literals - Introduces internal markers for leading empty continuation cells and re-escaping logic - Updates documentation: ADR 0001 and architecture notes to reflect new pipeline behavior - Improves width handling to render by Unicode display width

Changes

Core logic

  • Add parse_rows, clean_rows, calculate_widths, format_rows, insert_separator, and detect_separator to src/reflow.rs
  • Implement protection and re-escaping of leading empty cells to preserve continuation boundaries
  • Compute widths with UnicodeWidthStr::width to support wide Unicode chars

Table formatting

  • Add format_separator_cells and related helpers in src/table.rs
  • Implement extraction of separator lines and restoration of alignment markers

Tests

  • Extend tests/table_continuations.rs with scenarios for:
    • Preservation of leading empty continuation cells
    • Escaped pipes in continuation rows
    • Unicode width-consistent rendering
    • Ellipsis handling in cells
  • Add unit tests in reflow and table modules for new helpers:
    • protect_leading_empty_cells behavior
    • calculate_widths correctness
    • format_separator_cells alignment preservation

Documentation

  • ADR 0001: Table reflow pipeline with preservation rules
  • architecture.md updated with a dedicated section describing the table reflow pipeline and continuation handling
  • Minor wording updates in docs/execplans/yaml-frontmatter.md to maintain consistency

Test plan

  • Run cargo test
  • Focused test groups:
    • cargo test --lib tests::table_continuations
    • cargo test --lib reflow
    • cargo test --lib
  • Verify:
    • Escaped pipes remain literal after reparsing
    • Continuation rows preserve original column positions
    • Unicode wide characters align by display width
    • Separator cells maintain alignment markers and minimum width of three dashes

📎 Task: https://www.devboxer.com/task/eb7e6e3d-b663-4f6d-92ed-d23061ed6106

…nuation rows

- Protect leading empty continuation cells with a private marker before row splitting.
- Re-escape literal pipe characters in continuation row cells to preserve boundaries.
- Measure column widths using Unicode display width for proper alignment.
- Ensure separator columns have minimum width of three dashes with correct alignment markers.
- Apply ellipsis replacements before reflow to align by final rendered width.

This change fixes malformed table regressions affecting continuation rows, escaped pipes, and ellipsis handling, maintaining deterministic and testable behavior as documented in ADR 0001.

Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 6b403bf9-d3f9-4a88-a8e6-d94a6e13e2e4

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-pipe-escaping-and-add-tests-4hb1uo

Comment @coderabbitai help to get the list of available commands and usage tips.

@sourcery-ai

sourcery-ai Bot commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Refactors the Markdown table reflow pipeline to preserve continuation-row structure and escaped pipes while making width calculations Unicode-aware, adds focused helpers and tests around separator handling, and updates architecture/ADR/docs to describe the new behavior and keep examples consistent.

Class diagram for updated reflow and table helpers

classDiagram
    class reflow_module {
        +parse_rows(trimmed_lines) Vec_Vec_String
        +clean_rows(rows) Vec_Vec_String
        +calculate_widths(rows, max_cols) Vec_usize
        +format_rows(rows, widths, indent) Vec_String
        +insert_separator(out_lines, sep_cells, indent) Vec_String
        +detect_separator(sep_line, rows, max_cols) SeparatorDetection
        -split_into_rows(cells) Vec_Vec_String
        -protect_leading_empty_cells(line) String
        -pad_cell_to_width(cell, width) String
    }

    class table_module {
        +split_cells(line) Vec_String
        +reflow_table(lines) Vec_String
        +format_separator_cells(widths, sep_cells) Vec_String
        -extract_indent_and_trim(lines) IndentAndTrimmed
        -extract_separator_line(lines) Option_String
        -rows_mismatched(rows, allow_short) bool
    }

    class process_module {
        +process_stream_inner(lines, options) Vec_String
    }

    class frontmatter_module {
        +split_frontmatter(lines) FrontmatterSplit
    }

    process_module --> frontmatter_module : uses
    process_module --> table_module : calls reflow_table

    table_module --> reflow_module : uses helpers
    reflow_module --> table_module : uses split_cells

    class UnicodeWidthStr {
        +width(text) usize
    }

    reflow_module --> UnicodeWidthStr : calculates_display_widths
    table_module --> UnicodeWidthStr : formats_separator_cells
Loading

Flow diagram for the updated table reflow pipeline

flowchart TD
    subgraph StreamProcessing
        process_stream_inner["process_stream_inner"]
        ellipsis_replacement["Apply ellipsis replacement (if enabled)"]
        reflow_table["reflow_table"]
    end

    process_stream_inner --> ellipsis_replacement
    ellipsis_replacement --> reflow_table

    subgraph TableReflowStages
        extract_indent_and_trim["extract_indent_and_trim"]
        parse_rows["parse_rows"]
        protect_leading_empty_cells["protect_leading_empty_cells"]
        clean_rows["clean_rows"]
        detect_separator["detect_separator"]
        calculate_widths["calculate_widths"]
        format_separator_cells["format_separator_cells"]
        format_rows["format_rows"]
        insert_separator["insert_separator"]
    end

    reflow_table --> extract_indent_and_trim
    extract_indent_and_trim --> parse_rows

    parse_rows --> protect_leading_empty_cells
    protect_leading_empty_cells --> parse_rows

    parse_rows --> clean_rows
    clean_rows --> detect_separator
    detect_separator --> calculate_widths

    calculate_widths --> format_separator_cells
    format_separator_cells --> format_rows
    format_rows --> insert_separator

    insert_separator --> formatted_table["Aligned table output"]
Loading

File-Level Changes

Change Details Files
Preserve continuation-row leading empty cells and escaped pipes during table reflow, backed by new helper functions.
  • Introduce parse_rows/clean_rows/calculate_widths/format_rows/insert_separator/detect_separator in the reflow pipeline to parse, clean, size, and re-emit tables.
  • Protect leading empty continuation cells with an internal marker before splitting, then restore them after parsing so continuation columns remain aligned.
  • Re-escape literal pipes in non-leading cells during continuation-row reconstruction so reparsing does not create extra columns.
  • Compute column widths using UnicodeWidthStr::width and pad cells based on display width rather than byte length.
src/reflow.rs
Improve table separator formatting and add regression tests around continuation behavior, escaped pipes, Unicode widths, and ellipsis handling.
  • Add format_separator_cells to preserve alignment markers while enforcing a minimum separator width and respecting computed column widths.
  • Guard separator formatting against width/column-count mismatches by returning original cells when inputs are inconsistent.
  • Add rstest-based tests to verify continuation-row preservation, literal ellipsis behavior under different options, escaped-pipe handling in continuation rows, and Unicode-width-consistent alignment.
  • Add unit tests for protect_leading_empty_cells, calculate_widths, and format_separator_cells to pin the new behavior.
src/table.rs
tests/table_continuations.rs
Document the table reflow pipeline, its preservation rules, and refine existing documentation formatting.
  • Add ADR 0001 describing the table reflow pipeline, continuation-row protection, escaped-pipe handling, Unicode width rules, and ellipsis ordering.
  • Extend architecture.md with a dedicated section on the table reflow pipeline, including stage-by-stage behavior and rationale.
  • Tidy YAML frontmatter ADR prose for line-wrapping consistency without changing semantics.
  • Normalize tables, code fences, and minor prose in Rust testing and documentation guides for consistency with the new style.
docs/adrs/0001-table-reflow-pipeline.md
docs/architecture.md
docs/execplans/yaml-frontmatter.md
docs/rust-testing-with-rstest-fixtures.md
docs/rust-doctest-dry-guide.md
docs/documentation-style-guide.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@leynos
leynos marked this pull request as ready for review April 22, 2026 22:32
sourcery-ai[bot]

This comment was marked as resolved.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 34f89a5768

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/reflow.rs Outdated
LEADING_EMPTY_CELL_MARKER.to_string()
} else {
cell
cell.replace('|', r"\|")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve escaped pipes in emitted continuation cells

Re-escaping at protect_leading_empty_cells is only temporary here: split_cells unescapes \| back to | before formatting, so continuation rows with escaped pipes are emitted with a raw pipe character. In inputs like | | keep \| literal in continuation |, the output row becomes | ... | keep | literal ... |, which Markdown parsers read as an extra column delimiter and therefore still corrupts table structure. The fix needs to keep these pipes escaped in final output (or re-escape during row formatting), not only during intermediate parsing.

Useful? React with 👍 / 👎.

- Changed ADR title to full form 'Architecture Decision Record (ADR) 0001' in the ADR file and references.
- Replaced 'CJK' abbreviation with full 'Chinese, Japanese, and Korean (CJK)' in architecture.md for clarity.
- Updated a test in table_continuations.rs to use process_stream_opts with ellipsis option disabled, improving test accuracy.

Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
@leynos leynos changed the title Fix pipe escaping in table reflow and add tests Implement pipe escaping fix, Unicode width alignment, tests, and ADR 0001 Apr 22, 2026
@leynos

leynos commented Apr 22, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai Have the following now been resolved?

Annul any requirements that violate the en-GB-oxendict spelling (-ize / -yse / -our) conventions (for example a request to replace "normalize" with "normalise" or "artefact" with "artifact"), or where the requirement unnecessarily increases cyclomatic complexity.

Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="tests/table_continuations.rs" line_range="70-66" />
<code_context>
 }

+#[test]
+fn process_stream_preserves_literal_ellipsis_in_table_cells_when_disabled() {
+    let input = lines_vec![
+        "| Module | Notes                       |",
+        "| ------ | --------------------------- |",
+        "| `foo`  | preserves literal ... here  |",
+        "| `bar`  | and also ... in this cell   |",
+    ];
+    let expected = lines_vec![
+        "| Module | Notes                      |",
+        "| ------ | -------------------------- |",
+        "| `foo`  | preserves literal ... here |",
+        "| `bar`  | and also ... in this cell  |",
+    ];
+
+    assert_eq!(process_stream(&input), expected);
+}
+
</code_context>
<issue_to_address>
**issue (testing):** Test name implies explicit ellipsis disabling, but the test relies on the default configuration

This test uses `process_stream` with default options while its name says "when_disabled". If the default changes, the test will no longer cover the "disabled" behavior. Please either pass an explicit options struct via `process_stream_opts` that disables ellipsis replacement (preferred), or rename the test to indicate it verifies the default behavior.
</issue_to_address>

### Comment 2
<location path="docs/architecture.md" line_range="125" />
<code_context>
+3. `clean_rows`, `detect_separator`, and `calculate_widths` rebuild the logical
+   table. Explicit separator lines are preferred, but the second parsed row can
+   be promoted when the source embeds the separator in the body. Widths are
+   measured with `UnicodeWidthStr::width`, so CJK text, emoji, and accented
+   characters align by display width rather than byte count.
+4. `format_rows` and `insert_separator` emit the final table. Separator cells
</code_context>
<issue_to_address>
**suggestion (review_instructions):** The acronym “CJK” is introduced without being expanded on first use.

Consider expanding the acronym on first use, for example: “Chinese, Japanese, and Korean (CJK) text, emoji, and accented …”.

<details>
<summary>Review instructions:</summary>

**Path patterns:** `**/*.md`

**Instructions:**
Define uncommon acronyms on first use.

</details>
</issue_to_address>

### Comment 3
<location path="docs/architecture.md" line_range="142" />
<code_context>
+aligning for `...` and shrinking the rendered column after the fact.
+
+The rationale for these choices is captured in
+[ADR 0001](adrs/0001-table-reflow-pipeline.md).
+
 ## Footnote Conversion
</code_context>
<issue_to_address>
**suggestion (review_instructions):** The acronym “ADR” is used in link text without being expanded on first use in this document segment.

To satisfy the acronym rule, consider something like “Architecture Decision Record (ADR) 0001” for the first mention.

<details>
<summary>Review instructions:</summary>

**Path patterns:** `**/*.md`

**Instructions:**
Define uncommon acronyms on first use.

</details>
</issue_to_address>

### Comment 4
<location path="docs/adrs/0001-table-reflow-pipeline.md" line_range="1" />
<code_context>
+# ADR 0001: preserve table structure during reflow
+
+- Status: Accepted
</code_context>
<issue_to_address>
**suggestion (review_instructions):** The document title uses the acronym “ADR” without defining it on first use.

Consider updating the title to expand the acronym, for example: “Architecture Decision Record (ADR) 0001: preserve table structure during reflow”.

<details>
<summary>Review instructions:</summary>

**Path patterns:** `**/*.md`

**Instructions:**
Define uncommon acronyms on first use.

</details>
</issue_to_address>

@coderabbitai

coderabbitai Bot commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check Comment 1: test name / usage in table_continuations.rs
rg -n "process_stream_preserves_literal_ellipsis" tests/table_continuations.rs -A 5

# Check Comments 2 & 3: CJK and ADR in architecture.md
grep -n "CJK\|ADR\|Chinese" docs/architecture.md

# Check Comment 4: title line of ADR document
head -5 docs/adrs/0001-table-reflow-pipeline.md

Length of output: 696


@leynos: Comments 2, 3, and 4 are resolved. Comment 1 is not yet addressed.

# Location Status
1 tests/table_continuations.rs line 70 ❌ Not resolved
2 docs/architecture.md line 125 — "CJK" expansion ✅ Resolved
3 docs/architecture.md line 143 — "ADR" expansion in link text ✅ Resolved
4 docs/adrs/0001-table-reflow-pipeline.md title ✅ Resolved

Comment 1 still requires attention. The function at line 70 retains the name process_stream_preserves_literal_ellipsis_in_table_cells_when_disabled and calls process_stream with the default configuration. Either rename it to reflect default behaviour, or switch to process_stream_opts with an explicit struct that disables ellipsis replacement. Example of the latter:

#[test]
fn process_stream_preserves_literal_ellipsis_in_table_cells_when_disabled() {
    let opts = Opts {
        ellipsis: false,
        ..Opts::default()
    };
    let input = lines_vec![
        "| Module | Notes                       |",
        "| ------ | --------------------------- |",
        "| `foo`  | preserves literal ... here  |",
        "| `bar`  | and also ... in this cell   |",
    ];
    let expected = lines_vec![
        "| Module | Notes                      |",
        "| ------ | -------------------------- |",
        "| `foo`  | preserves literal ... here |",
        "| `bar`  | and also ... in this cell  |",
    ];

    assert_eq!(process_stream_opts(&input, &opts), expected);
}

Adjust the Opts field name to match the actual struct definition in the codebase.

Previously, literal pipe characters in table cells were not being escaped
correctly when calculating widths and formatting output rows, causing
misalignment and rendering issues. This change introduces functions to
escape literal pipes and account for their width correctly when
calculating cell widths and padding. Tests have been added and updated
to verify escaped pipes are handled properly.

Also fixed table continuation rendering to preserve escaped pipes in output.

Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
@leynos leynos changed the title Implement pipe escaping fix, Unicode width alignment, tests, and ADR 0001 Pipe escaping fix, Unicode width handling, tests, ADR 0001 Apr 22, 2026
@leynos
leynos merged commit 74178f3 into fix-mdtable-markdownlint-errors-dp20i0 Apr 22, 2026
3 checks passed
@leynos
leynos deleted the fix-pipe-escaping-and-add-tests-4hb1uo branch April 22, 2026 23:15
devboxerhub Bot added a commit that referenced this pull request Apr 23, 2026
* feat(table-reflow): preserve table structure during reflow with continuation rows

- Protect leading empty continuation cells with a private marker before row splitting.
- Re-escape literal pipe characters in continuation row cells to preserve boundaries.
- Measure column widths using Unicode display width for proper alignment.
- Ensure separator columns have minimum width of three dashes with correct alignment markers.
- Apply ellipsis replacements before reflow to align by final rendered width.

This change fixes malformed table regressions affecting continuation rows, escaped pipes, and ellipsis handling, maintaining deterministic and testable behavior as documented in ADR 0001.

Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>

* docs(adr): clarify ADR title and terminology; update ellipsis test

- Changed ADR title to full form 'Architecture Decision Record (ADR) 0001' in the ADR file and references.
- Replaced 'CJK' abbreviation with full 'Chinese, Japanese, and Korean (CJK)' in architecture.md for clarity.
- Updated a test in table_continuations.rs to use process_stream_opts with ellipsis option disabled, improving test accuracy.

Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>

* fix(reflow): properly escape literal pipes in table cell formatting

Previously, literal pipe characters in table cells were not being escaped
correctly when calculating widths and formatting output rows, causing
misalignment and rendering issues. This change introduces functions to
escape literal pipes and account for their width correctly when
calculating cell widths and padding. Tests have been added and updated
to verify escaped pipes are handled properly.

Also fixed table continuation rendering to preserve escaped pipes in output.

Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>

---------

Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
leynos added a commit that referenced this pull request Apr 23, 2026
* feat(table): preserve leading empty cells in continuation rows and add ellipsis support

- Added support to preserve leading empty cells in table continuation rows by marking them during parsing and cleaning up markers before output.
- Improved table reflow to calculate column widths using unicode widths and pad cells accordingly.
- Added an option to replace ellipsis occurrences in tables during processing.
- Introduced tests covering Markdown tables with continuation rows and ellipsis handling.
- Ensured separator rows have a minimum column width for consistent formatting.

These changes improve Markdown table formatting fidelity, especially for continued rows and truncated content representation.

Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>

* Pipe escaping fix, Unicode width handling, tests, ADR 0001 (#270)

* feat(table-reflow): preserve table structure during reflow with continuation rows

- Protect leading empty continuation cells with a private marker before row splitting.
- Re-escape literal pipe characters in continuation row cells to preserve boundaries.
- Measure column widths using Unicode display width for proper alignment.
- Ensure separator columns have minimum width of three dashes with correct alignment markers.
- Apply ellipsis replacements before reflow to align by final rendered width.

This change fixes malformed table regressions affecting continuation rows, escaped pipes, and ellipsis handling, maintaining deterministic and testable behavior as documented in ADR 0001.

Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>

* docs(adr): clarify ADR title and terminology; update ellipsis test

- Changed ADR title to full form 'Architecture Decision Record (ADR) 0001' in the ADR file and references.
- Replaced 'CJK' abbreviation with full 'Chinese, Japanese, and Korean (CJK)' in architecture.md for clarity.
- Updated a test in table_continuations.rs to use process_stream_opts with ellipsis option disabled, improving test accuracy.

Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>

* fix(reflow): properly escape literal pipes in table cell formatting

Previously, literal pipe characters in table cells were not being escaped
correctly when calculating widths and formatting output rows, causing
misalignment and rendering issues. This change introduces functions to
escape literal pipes and account for their width correctly when
calculating cell widths and padding. Tests have been added and updated
to verify escaped pipes are handled properly.

Also fixed table continuation rendering to preserve escaped pipes in output.

Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>

---------

Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>

* feat(table-reflow): add advanced table reflow pipeline and user/developer guides

- Implement a staged table reflow pipeline in `src/reflow.rs` supporting continuation rows,
  separator detection, Unicode width-based column sizing, escaping of literal pipes, and
  reinsertion of separator rows.
- Add detailed internal API documentation and design rationale in `docs/developers-guide.md`.
- Add a comprehensive user guide on table reflow and ellipsis handling in `docs/users-guide.md`.
- Enhance process functions with examples for table reflow and ellipsis flag.
- Improve formatting of separator cells preserving Markdown alignment markers in `src/table.rs`.
- Fix minor markdown lint and formatting updates in execution plans documentation.
- Include tests verifying escaping logic, width calculations, padding, and ellipsis transformations.

This feature improves Markdown table formatting robustness, ensuring visually aligned columns
with proper handling of Unicode and special characters, while documenting the implementation
and usage thoroughly.

Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>

* feat(table/reflow): reject tables with invalid separator rows during reflow

- Changed format_separator_cells to return empty vector if length mismatch, so invalid separator rows are detected.
- Added handling in calculate_and_format to return None when separator formatting is invalid, preventing table reflow.
- Made reflow_table return original input lines if separator row is invalid, preserving original table.
- Refactored tests by moving them out of reflow.rs into reflow/tests.rs with expanded coverage.
- Minor docs fix in ADR title case.

This prevents malformed Markdown tables with invalid separator rows from being reflowed incorrectly, improving stability and correctness of the table reflow pipeline.

Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>

* feat(table): add regex to detect Markdown table separator lines

Introduce `SEP_RE`, a static regular expression matching Markdown
table separator lines composed only of pipes, colons, dashes,
and whitespace. This enables accurate detection and extraction of
the alignment row during table parsing.

Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>

---------

Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant