refactor(ui): replace middle-dot separators with clearer hierarchy (#6087)

* refactor(ui): replace middle-dot separators with clearer hierarchy

* refactor(ui): use layout instead of punctuation separators
This commit is contained in:
chengyongru authored and GitHub committed 2026-10-07 15:19:55 +08:00
1 parent d6ddceed99
commit 7cb396788c
82 files changed
+433 -462

No files matched your search

+13 -4
View File
@@ -850,11 +850,20 @@ class SlackChannel(BaseChannel):
code_blocks.append(m.group(0))
return f"\x00CB{len(code_blocks) - 1}\x00"
tables: list[str] = []
def _save_table(m: re.Match[str]) -> str:
tables.append(cls._convert_table(m))
return f"\ue000TB{len(tables) - 1}\ue000"
text = cls._CODE_FENCE_RE.sub(_save_fence, text)
text = cls._TABLE_RE.sub(cls._convert_table, text)
text = cls._TABLE_RE.sub(_save_table, text)
for i, block in enumerate(code_blocks):
text = text.replace(f"\x00CB{i}\x00", block)
return cls._fixup_mrkdwn(slackify_markdown(text)).rstrip("\n")
text = slackify_markdown(text)
for i, table in enumerate(tables):
text = text.replace(f"\ue000TB{i}\ue000", table)
return cls._fixup_mrkdwn(text).rstrip("\n")
@classmethod
def _fixup_mrkdwn(cls, text: str) -> str:
@@ -892,5 +901,5 @@ class SlackChannel(BaseChannel):
cells = (cells + [""] * len(headers))[: len(headers)]
parts = [f"**{headers[i]}**: {cells[i]}" for i in range(len(headers)) if cells[i]]
if parts:
rows.append(" · ".join(parts))
return "\n".join(rows)
rows.append(slackify_markdown("\n".join(parts)).rstrip("\n"))
return "\n\n".join(rows)
@@ -863,10 +863,10 @@ def test_to_mrkdwn_keeps_fenced_markdown_tables_intact() -> None:
def test_to_mrkdwn_still_converts_unfenced_markdown_tables() -> None:
out = SlackChannel._to_mrkdwn("| a | b |\n| - | - |\n| 1 | 2 |")
out = SlackChannel._to_mrkdwn("| a | b |\n| - | - |\n| 1 | 2 |\n| 3 | 4 |")
assert "| a | b |" not in out
assert "a" in out and "1" in out and "b" in out and "2" in out
assert out.splitlines() == ["*a*: 1", "*b*: 2", "", "*a*: 3", "*b*: 4"]
# ── file download SSRF ─────────────────────────────────────────────