Commit e2ba081
fix: š resolve Slack directives in section/mrkdwn (verbatim + non-verbatim)
Slack directives like `<@u123>`, `<#C123>`, `<!subteam^S1|@team>`,
`<!channel|here|everyone>`, and `<!date^ā¦>` now fire the matching hooks
(`hooks.user`, `hooks.channel`, `hooks.usergroup`, `hooks.atHere` /
`atChannel` / `atEveryone`, `hooks.date`) in both `verbatim: true` and
`verbatim: false` modes ā matching the behaviour of the rich_text path.
- Verbatim mode no longer early-returns. It splits the input by directive
boundaries and renders each segment, preserving non-directive text
literally (no markdown sugar expansion ā that's the point of verbatim).
- Non-verbatim mode now masks fenced code, inline code, and directive
atoms before the URL-rewrite / asterisk-doubling regex pass, then
restores them before Yozora parses ā so directives can't be mangled
by the pre-pass and directive-shaped text inside code stays literal.
- Broadcast tokenizer recognises `<!here>` / `<!everyone>` / `<!channel>`
natively, alongside the existing `@here` / `@everyone` / `@channel`.
- Yozora's `autolink` and `autolink-extension` are unmounted; bare URL
autolinking is handled by the existing `<X>` / `<X|Y>` regex rewrite,
and the autolink-extension was stealing directives like
`<!subteam^S1|@team>` because of the embedded `@`.
- mrkdwn sub-element hook payloads now include `style: undefined` to
match the rich_text path shape (`{ id, name, style }`).
- `<@Uā¦|fallback>` and `<!subteam^Sā¦|@team>` now split on `|` for data
lookup + fallback display name (channel mention already did this).
- `&` is decoded alongside `>` / `<` in text-object payloads
so escaped ampersands don't leak into hrefs or visible text.
Adds a vitest test suite (the repo previously had none) covering the
directive Ć verbatim matrix, code-span suppression, escaped entities,
hook payload shape, data-map resolution, and non-directive regression.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent bb2b269 commit e2ba081
17 files changed
Lines changed: 1545 additions & 59 deletions
File tree
- .changeset
- src
- components/composition_objects
- test
- utils/markdown_parser
- __tests__
- sub_elements
- tokenizers/slack_broadcast
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
47 | 53 | | |
48 | 54 | | |
49 | 55 | | |
50 | 56 | | |
51 | | - | |
52 | | - | |
53 | 57 | | |
54 | 58 | | |
| 59 | + | |
55 | 60 | | |
56 | 61 | | |
57 | 62 | | |
58 | 63 | | |
59 | 64 | | |
60 | | - | |
| 65 | + | |
| 66 | + | |
61 | 67 | | |
62 | 68 | | |
0 commit comments