You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(slack): render_postable uses AST path for PostableMarkdown (closes#81) (#82)
* fix(slack): render_postable uses AST path for PostableMarkdown (issue #81)
SlackFormatConverter.render_postable was calling _markdown_to_mrkdwn (a
simple regex) for PostableMarkdown and {"markdown": ...} dict inputs.
The upstream TS SDK routes these through fromAst(parseMarkdown(text)),
which correctly handles all markdown constructs — including links — via
AST node handlers.
The regex had two failure modes the AST path avoids: (a) its link pattern
[^)]+ stops at the first ')' so URLs with parentheses were truncated, and
(b) it had no equivalent of the link-node branch in _node_to_mrkdwn, making
edge-case formatting harder to extend safely.
Change both markdown branches in render_postable to call from_markdown
instead. str and raw branches are unaffected — they correctly stay on
_convert_mentions_to_slack since those inputs are already mrkdwn.
Adds TestRenderPostable to test_slack_format.py covering the previously
untested render_postable(PostableMarkdown(...)) code path, including link
conversion, bold, mixed formatting, query-string URLs, and the str/raw
passthrough cases.
Closes#81https://claude.ai/code/session_01XZeM3apTXAHZmjndAqeKPw
* fix(slack): add card support and str fallback to render_postable
Two pre-existing gaps in SlackFormatConverter.render_postable flagged in
review:
1. Card types (PostableCard / CardElement dict) were unhandled; the
override returned "" instead of routing through card_to_fallback_text
like the base class does.
2. The fallback for unknown message shapes was "" (silent failure)
rather than str(message), which matches BaseFormatConverter and is
safer for unexpected inputs.
Mirrors the base class structure for both cases. No new tests needed:
these branches are identical to the base class and covered by its suite.
https://claude.ai/code/session_01XZeM3apTXAHZmjndAqeKPw
* refactor(slack): delete dead _markdown_to_mrkdwn and add card/ast branch tests
Remove _markdown_to_mrkdwn — a regex-based private method with no call sites
after render_postable was switched to the AST path. Deleting it restores
structural parity with the TS SDK (which has no equivalent method). Also adds
test coverage for the card dict branch, CardElement-style dict branch, .card
attribute branch, and the {"ast": ...} dict branch in render_postable.
https://claude.ai/code/session_01XZeM3apTXAHZmjndAqeKPw
* test(slack): expand format converter coverage to all node types and branches
Add 19 new tests covering previously untested paths:
- render_postable: {"raw": ...} dict, CardElement dict, .ast attribute,
arbitrary object fallback, multiple simultaneous @mentions
- _node_to_mrkdwn: heading (h1/h2 → bold), blockquote, thematic break,
image with alt, image without alt
- extract_plain_text: strikethrough, bare URL, channel mention with name,
bare channel, named user mention
- to_blocks_with_table: non-dict AST returns None, standalone table emits
no extra section blocks, column alignment produces column_settings
https://claude.ai/code/session_01XZeM3apTXAHZmjndAqeKPw
* chore: bump version to 0.4.26.3 and update changelog
https://claude.ai/code/session_01XZeM3apTXAHZmjndAqeKPw
---------
Co-authored-by: Claude <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+20Lines changed: 20 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,25 @@
1
1
# Changelog
2
2
3
+
## 0.4.26.3 (2026-05-07)
4
+
5
+
Python-only fix. No upstream version change.
6
+
7
+
### Fixes
8
+
9
+
-**`SlackFormatConverter.render_postable` now uses the AST path for all markdown inputs** (issue #81). Previously, `PostableMarkdown` and `{"markdown": ...}` dict inputs were routed through a private regex helper (`_markdown_to_mrkdwn`) that truncated URLs containing parentheses and diverged silently from the TS SDK's `fromAst(parseMarkdown(text))` behavior. Both branches now call `from_markdown`, which goes through the AST. `str` and `raw` branches are unchanged.
10
+
11
+
### Structural parity
12
+
13
+
-**Deleted `_markdown_to_mrkdwn`** — a regex-based private method with no call sites after the fix above. The TS SDK has no equivalent; its presence was an undocumented divergence. Removes a confusing dead-code path and restores structural parity with `adapter-slack/src/markdown.ts`.
14
+
15
+
### Additions
16
+
17
+
-**`render_postable` now handles card and object-with-ast inputs** — added `{"card": ...}` dict, `{"type": "card", ...}``CardElement` dict, `{"ast": ...}` dict, and `.card` / `.ast` attribute branches, plus `str(message)` fallback for unrecognized types. Matches the full union of `AdapterPostableMessage` variants.
18
+
19
+
### Test quality
20
+
21
+
- Added 19 tests to `tests/test_slack_format.py` covering all `render_postable` branches, every `_node_to_mrkdwn` node type (heading, blockquote, thematic break, image with/without alt), the remaining `extract_plain_text` paths (strikethrough, bare URL, channel mentions), and `to_blocks_with_table` edge cases (non-dict AST, standalone table, column alignment).
22
+
3
23
## 0.4.26.2 (2026-04-24)
4
24
5
25
Parity catch-up with upstream `4.26.0`. No upstream version change.
0 commit comments