Skip to content

fix(docs): expand inline markdown inside table cells#612

Merged
steipete merged 3 commits into
openclaw:mainfrom
chrischall:fix/608-table-cell-inline-md
May 20, 2026
Merged

fix(docs): expand inline markdown inside table cells#612
steipete merged 3 commits into
openclaw:mainfrom
chrischall:fix/608-table-cell-inline-md

Conversation

@chrischall

Copy link
Copy Markdown
Contributor

Closes #608.

Root cause

InsertNativeTable inserted raw cell content via a single InsertText request, so **bold**, *italic*, `code`, and [links] inside a markdown table cell rendered as literal characters. Outside of tables the converter already runs `ParseInlineFormatting` and emits per-span `UpdateTextStyle` requests — this PR runs the same pipeline on table cells.

Change

Extracted the per-cell request construction into a pure helper:

```go
buildTableCellRequests(cellContent string, cellIdx int64, isHeaderRow bool) ([]*docs.Request, int64)
```

so the inline-formatting expansion is directly unit-testable without HTTP mocking. The header-row whole-cell bold is preserved, and the running cell indices in `updateIndicesAfter` now shift by the UTF-16 length of the stripped text rather than the original markdown (since markers are gone from the inserted text).

Tests

  • `TestBuildTableCellRequests_AppliesInlineBold` — `Alice` → InsertText "Alice" + UpdateTextStyle{Bold} on [cellIdx, cellIdx+5].
  • `TestBuildTableCellRequests_AppliesInlineItalicAndCode` — covers `italic` and ` + "code" + `.
  • `TestBuildTableCellRequests_HeaderRowAppliesBoldOverWholeCell` — preserves the existing header-bold behaviour.
  • `TestBuildTableCellRequests_PlainTextNoStyleRequest` — guards against spurious style requests for plain cells.
  • `TestBuildTableCellRequests_EmptyAfterStrippingReturnsNothing` — a marker-only cell is skipped cleanly without sending an empty batch.

`go test ./internal/cmd/ -count=1` → ok 24.2s.

chrischall and others added 3 commits May 20, 2026 20:50
Closes openclaw#608.

`InsertNativeTable` inserted raw cell content via a single InsertText
request, so `**bold**`, `*italic*`, `` `code` ``, and `[links]` inside a
markdown table cell rendered as literal characters. Outside of tables
the same converter already runs `ParseInlineFormatting` and emits per-
span `UpdateTextStyle` requests; this change applies that same pipeline
to table cells.

Extracted the per-cell request construction into a pure
`buildTableCellRequests(cellContent, cellIdx, isHeaderRow)` so the
inline-formatting expansion is directly unit-testable without HTTP
mocking. The header-row whole-cell bold is preserved and the running
cell indices in `updateIndicesAfter` now shift by the UTF-16 length of
the actual stripped text rather than the original markdown.

Tests cover **bold**, *italic*, `code`, plain text, header-row bold,
and the marker-only cell that strips to "".

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@steipete
steipete force-pushed the fix/608-table-cell-inline-md branch from ab3e6c5 to 32f74d4 Compare May 20, 2026 19:56
@steipete
steipete merged commit 946578d into openclaw:main May 20, 2026
7 checks passed
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.

docs write --append --markdown: inline markdown inside table cells (bold/italic/code) renders literally

2 participants