A unified text optimization plugin for OpenCode that sanitizes emojis and formats markdown tables. Built for high-performance pipelines where minimal latency is a requirement.
- Deterministic Emoji Sanitizer: Removes emojis from AI outputs without altering the surrounding whitespace or layout.
- Isolated Table Aligner: Formats Markdown tables by calculating maximum column widths and applying deterministic padding, ensuring visual correctness.
- Low-Latency Engine: Processes AI output efficiently without a full AST-based parser, maintaining near-linear time processing.
- Concealment-Aware Widths: Intelligently calculates table widths by accounting for markdown markers like bold, italics, bold, or italics which are hidden in many views.
- Flat Configuration: Simple, flat boolean configuration file with nested-object validation.
Add the plugin name to your OpenCode config file plugins section in ~/.config/opencode/config.json:
{
"plugins": [
"opencode-fmt"
]
}The plugin automatically initializes a default configuration at ~/.config/opencode/fmt/config.json on its first run if it doesn't already exist.
{
"stripEmojis": true,
"alignTables": true,
"concealmentAware": true,
"logging": false
}Note
All configuration keys are booleans. Top-level arrays and unknown keys in config.json are accepted for forward compatibility, but current core behavior only uses the documented keys below. Nested objects are strictly prohibited.
| Key | Default | Description |
|---|---|---|
stripEmojis |
true |
Removes all emojis from the output. |
alignTables |
true |
Dynamically aligns Markdown tables for visual consistency. |
concealmentAware |
true |
Accounts for hidden markdown markers (e.g. **, _) in column widths. |
logging |
false |
Enables duration and raw/clean output logging to opencode-fmt.log. |
The sanitizer removes pictographic and dingbat symbols from the text stream.
Before: Hello [hand-wave], our launch [rocket] was a success [party]!
After: Hello , our launch was a success !
(Note: Surrounding whitespaces are strictly preserved for deterministic layout stability, which may result in double spaces where an emoji was removed).
Note
If a response contains only emojis (and optional whitespace characters), opencode-fmt will replace it with a redaction placeholder:
[Only emojis received and redacted by opencode-fmt]
The aligner intelligently pads columns based on the longest cell in each column.
Before:
| Header 1 | H2 |
|---|---|
| Val | Long Value |After:
| Header 1 | H2 |
| -------- | ---------- |
| Val | Long Value |This plugin is governed by strict technical rules to preserve its performance:
- AST-Free Processing: No heavyweight parsing into an Abstract Syntax Tree.
- Zero Runtime Dependencies: Built purely on native Bun/Node APIs and the core plugin hook.
- Flat Config: No nested objects are allowed in
config.jsonto prevent parsing overhead. The configuration is stored in~/.config/opencode/fmt/config.json. Top-level arrays are permitted for list-based features. Any unknown keys are merged but ignored by core logic. - Diff Stability: Non-target text (pure paragraphs) is preserved byte-for-byte in the output.
This plugin was inspired by two community plugins that pioneered single-feature plugin design:
- opencode-md-table-formatter by @franlol — Automatic Markdown table formatting with concealment mode support
- opencode-unmoji by @bastiangx — Strips emojis from agent output
Both showed that focused, lightweight plugins can solve specific pain points elegantly. This plugin follows the same philosophy: one concern, done well.
This project is licensed under the MIT License. See the LICENSE file for details.
© 2026 Ritesh Kumar Pal