Auto Spacer
approvedby fanthus
This plugin has not been manually reviewed by Obsidian staff. Wrap mixed English segments with inline code and insert CJK-adjacent spaces.
English | 中文
Auto Spacer
Obsidian plugin for mixed CJK–English typography. Inserts spaces at CJK–Latin boundaries and wraps English segments in inline code.
Features
- Detects mixed Chinese (including Japanese kana and kanji) and English text
- Inserts spaces between CJK and Latin characters
- Wraps English segments in
`inline code` - Skips existing backticks, links, tags, and other Markdown structures
- Formats the current selection, or the entire current line when nothing is selected
- Optional toolbar button in the editor header
Usage
Command
Open the command palette and run 「中英混排:反引号包裹并补空格」 (Mixed CJK–English: wrap in backticks and add spaces).
Default shortcut: Cmd + Shift + S (macOS) / Ctrl + Shift + S (Windows / Linux).
Settings
Configure under Settings → Community plugins → Auto Spacer:
- 显示顶部按钮 (Show header button): show the “中英混排格式化” action in the editor toolbar
Installation
Manual install from GitHub Release
- Download
main.js,manifest.json, andstyles.cssfrom Releases - Copy them into your vault:
YourVault/.obsidian/plugins/auto-spacer/
- Enable the plugin in Obsidian: Settings → Community plugins
Source files alone are not enough—you must build
main.jsor download the compiled artifacts from a Release.
Development
Requirements
- Node.js 16 or later (18+ recommended)
Local development
git clone https://github.com/fanthus/obsidian-auto-spacer.git
cd obsidian-auto-spacer
npm install
npm run dev
npm run dev watches and compiles src/main.ts to main.js. Reload Obsidian after code changes to test.
Production build:
npm run build
Linting
ESLint is configured. Run:
npm run lint
You can also use the Obsidian rules package eslint-plugin-obsidianmd. A GitHub Action runs lint on pushes to all branches.
Releasing
This project uses release.mjs to build and create GitHub Releases. Obsidian downloads main.js, manifest.json, and styles.css from the release.
Repository: https://github.com/fanthus/obsidian-auto-spacer
Prerequisites
- Install Node.js (18+ recommended)
- Install GitHub CLI and sign in:
gh auth login
- Install dependencies:
npm install
First release
Set the target version in manifest.json (e.g. 1.0.0), then run:
npm run release -- --push
The script will:
- Run
npm run buildto producemain.js - Create a git tag matching the version (e.g.
1.0.0—novprefix) - Push the branch and tag to GitHub
- Create a GitHub Release and upload
main.js,manifest.json, andstyles.css
Subsequent releases
Pick a bump type for your changes:
| Command | Version change | When to use |
|---|---|---|
npm run release:patch | 1.0.0 → 1.0.1 | Bug fixes, small changes |
npm run release:minor | 1.0.0 → 1.1.0 | New features, backward compatible |
npm run release:major | 1.0.0 → 2.0.0 | Breaking changes |
These commands bump the version, sync manifest.json and versions.json, build, publish, and push.
Update minAppVersion in manifest.json before releasing if you require a newer Obsidian version.
Common options
Preview steps without publishing:
npm run release -- --dry-run
Custom release notes:
npm run release -- --bump patch --push --notes "Fix spacing around punctuation."
Read notes from a file:
npm run release -- --bump patch --push --notes-file CHANGELOG.md
Replace an existing release (e.g. after a failed publish):
npm run release -- --push --force
Full help:
node release.mjs --help
Manual release (optional)
Without the script:
- Update
versioninmanifest.json - Add
"newVersion": "minObsidianVersion"toversions.json - Run
npm run build - Create a GitHub Release whose tag exactly matches
version(e.g.1.0.0) - Attach
main.js,manifest.json, andstyles.css
Submit to the Obsidian community catalog
After a GitHub Release, submit your plugin on community.obsidian.md with the repository URL. See Submit your plugin.
Funding links
Set fundingUrl in manifest.json to show sponsorship options:
{
"fundingUrl": "https://buymeacoffee.com"
}
Multiple links as an object:
{
"fundingUrl": {
"Buy Me a Coffee": "https://buymeacoffee.com",
"GitHub Sponsor": "https://github.com/sponsors",
"Patreon": "https://www.patreon.com/"
}
}
API documentation
Obsidian plugin development: https://docs.obsidian.md
For plugin developers
Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.