Skip to content

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

Open
chrischall wants to merge 2 commits into
openclaw:mainfrom
chrischall:fix/608-table-cell-inline-md
Open

fix(docs): expand inline markdown inside table cells#612
chrischall wants to merge 2 commits into
openclaw:mainfrom
chrischall:fix/608-table-cell-inline-md

Conversation

@chrischall
Copy link
Copy Markdown

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 2 commits May 19, 2026 19:59
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) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.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.

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

1 participant