Get Started in One Minute: Installation and Configuration
What You'll Learn
- Install the table formatter plugin in OpenCode
- Make AI-generated Markdown tables automatically aligned
- Verify that the plugin is working correctly
Your Current Problem
AI-generated Markdown tables often look like this:
| 名称 | 描述 | 状态 |
|--- | --- | ---|
| 功能A | 这是一个很长的描述文本 | 已完成 |
| B | 短 | 进行中 |Column widths are uneven and look messy. Manually adjusting them? Too time-consuming.
When to Use This Approach
- You frequently have AI generate tables (comparisons, checklists, configuration guides)
- You want tables to display neatly in OpenCode
- You don't want to manually adjust column widths every time
🎒 Prerequisites
Prerequisites
- OpenCode installed (version >= 1.0.137)
- Know where the
.opencode/opencode.jsoncconfiguration file is located
Follow Along
Step 1: Open the Configuration File
Why: Plugins are declared through the configuration file, which OpenCode automatically loads on startup.
Find your OpenCode configuration file:
# Configuration file is usually in the project root directory
ls -la .opencode/opencode.jsonc
# Or in the user directory
ls -la ~/.config/opencode/opencode.jsonc# Configuration file is usually in the project root directory
Get-ChildItem .opencode\opencode.jsonc
# Or in the user directory
Get-ChildItem "$env:APPDATA\opencode\opencode.jsonc"Open this file with your preferred editor.
Step 2: Add Plugin Configuration
Why: Tell OpenCode to load the table formatter plugin.
Add the plugin field to the configuration file:
{
// ... other configurations ...
"plugin": ["@franlol/[email protected]"]
}Already have other plugins?
If you already have a plugin array, add the new plugin to it:
{
"plugin": [
"existing-plugin",
"@franlol/[email protected]" // Add here
]
}You should see: The configuration file saves successfully, with no syntax error prompts.
Step 3: Restart OpenCode
Why: Plugins are loaded when OpenCode starts, so you need to restart after modifying the configuration.
Close the current OpenCode session and restart it.
You should see: OpenCode starts normally, with no errors.
Step 4: Verify the Plugin Takes Effect
Why: Confirm that the plugin is correctly loaded and working.
Ask AI to generate a table, for example input:
帮我生成一个表格,对比 React、Vue、Angular 三个框架的特点You should see: The AI-generated table has aligned column widths, like this:
| 框架 | 特点 | 学习曲线 |
|--- | --- | ---|
| React | 组件化、虚拟 DOM | 中等 |
| Vue | 渐进式、双向绑定 | 较低 |
| Angular | 全功能框架、TypeScript | 较高 |Checkpoints ✅
After completing the above steps, check the following points:
| Check item | Expected result |
|---|---|
| Configuration file syntax | No errors |
| OpenCode startup | Normal startup, no plugin loading errors |
| AI-generated tables | Column widths automatically aligned, separator row format unified |
Common Pitfalls
Table Not Formatted?
- Check configuration file path: Ensure you've modified the configuration file that OpenCode actually reads
- Check plugin name: Must be
@franlol/[email protected], note the@symbol - Restart OpenCode: Must restart after modifying configuration
Seeing "invalid structure" comment?
This means the table structure doesn't conform to Markdown specification. Common causes:
- Missing separator row (
|---|---|) - Inconsistent number of columns across rows
See the Troubleshooting section for details.
Lesson Summary
- Plugins are configured through the
pluginfield in.opencode/opencode.jsonc - Version
@0.0.3ensures using a stable version - Need to restart OpenCode after modifying configuration
- The plugin automatically formats all AI-generated Markdown tables
Next Lesson Preview
Next lesson we'll learn Feature Overview.
You'll learn:
- The 8 core features of the plugin
- Width calculation principles in hidden mode
- Which tables can be formatted and which cannot
Appendix: Source Code Reference
Click to expand source code locations
Last updated: 2026-01-26
| Feature | File path | Line number |
|---|---|---|
| Plugin entry point | index.ts | 9-23 |
| Hook registration | index.ts | 11-13 |
| Package config | package.json | 1-41 |
Key constants:
@franlol/[email protected]: npm package name and versionexperimental.text.complete: hook name the plugin listens to
Dependency requirements:
- OpenCode >= 1.0.137
@opencode-ai/plugin>= 0.13.7