README file from
GithubText Alchemy
Text Alchemy is an Obsidian text cleanup toolkit for turning messy selected text into clean Markdown. It can remove line gaps, trim wiki links, fix copied PDF wrapping, remove duplicates, make lists, re-number lists, space headings, add dividers, and sort text from the command palette.
Created by @NameIsKyro.
Features
- Remove gaps between lines.
- Add paragraph spacing.
- Add spacing around all headings.
- Add spacing around selected heading levels only.
- Add Markdown dividers between all headings or selected heading levels.
- Trim whitespace from the start and end of every line.
- Remove duplicate lines in soft mode or hard mode.
- Turn lines into bullet lists.
- Turn lines into numbered lists.
- Turn lines into unchecked checklists.
- Remove bullets and numbering.
- Re-number numbered lists.
- Clean wiki-link lines.
- Convert plain lines into wiki links.
- Convert label-url lines into Markdown links.
- Fix copied PDF line breaks.
- Remove hyphenated line breaks.
- Sort lines A to Z or Z to A.
- Sort heading lines A to Z.
- Sort title-style lines A to Z.
- Clean selected text only, or clean the entire note.
- Ignore YAML frontmatter.
- Ignore fenced code blocks.
Examples
Remove gaps between lines:
[[How to Pick the Healthiest Cheeses]]
[[letter to medical professionals about raw milk.pdf]]
[[Life in the Milk A History of Intravenous Milk Injections]]
Becomes:
[[How to Pick the Healthiest Cheeses]]
[[letter to medical professionals about raw milk.pdf]]
[[Life in the Milk A History of Intravenous Milk Injections]]
Soft duplicate removal:
[[Milk]]
[[Cheese]]
[[Milk]]
[[Bread]]
Becomes:
[[Milk]]
[[Cheese]]
[[Bread]]
Duplicates:
[[Milk]]
Fix copied PDF line breaks:
Raw milk contains many different
types of bacteria and enzymes that
may be affected by heat.
Becomes:
Raw milk contains many different types of bacteria and enzymes that may be affected by heat.
Commands
Clean selected text- Runs the enabled cleaner pipeline on the current selection.Clean entire note- Runs the enabled cleaner pipeline on the active note.Remove gaps between lines- Removes blank lines inside the selected text or whole note.Trim whitespace on each line- Trims spaces before and after each line.Remove duplicates and list removed lines- Removes repeated lines and adds aDuplicates:section.Remove duplicates only- Removes repeated lines without adding a duplicate report.Add paragraph spacing- Keeps one empty line between paragraph blocks.Add spacing around all headings- Adds one blank line before and after every Markdown heading.Add spacing around selected heading levels- Adds spacing only around heading levels chosen in settings.Add dividers between all headings- Adds---between matching headings.Add dividers between selected heading levels- Adds---only between chosen heading levels.Turn lines into bullet list- Adds the configured bullet marker to each non-empty line.Turn lines into numbered list- Numbers each non-empty line from the configured start number.Turn lines into checklist- Converts each non-empty line to- [ ] text.Remove bullets and numbering- Removes bullet, checklist, and numbered-list markers.Re-number numbered list- Rebuilds numbering from the configured start number.Clean wiki links- Trims wiki-link lines like[[Milk]]into[[Milk]].Convert plain lines to wiki links- Wraps each plain line in[[...]].Convert lines to Markdown links- ConvertsGoogle - https://google.cominto[Google](https://google.com).Fix copied PDF line breaks- Joins wrapped paragraph lines while keeping blocks separate.Remove hyphenated line breaks- Convertsferment-plusationintofermentation.Sort lines A to Z- Sorts all lines alphabetically.Sort lines Z to A- Sorts all lines in reverse alphabetical order.Sort headings A to Z- Sorts heading lines alphabetically and leaves non-heading lines after them.Sort title lines A to Z- Sorts non-empty title-style lines alphabetically.
No default hotkeys are registered. Add your own hotkeys in Obsidian's Hotkeys settings if you want them.
Settings
The settings tab lets you build a cleaner pipeline by toggling each tool on or off. Every option includes a short Info description and example so you can remember what it does later.
Core settings:
- Whole-note fallback.
- Ignore YAML frontmatter.
- Ignore code blocks.
- Duplicate handling: off, soft, or hard.
- Cleaner sort mode.
- Bullet marker.
- Numbered list start.
- Heading levels for custom heading spacing.
- Heading levels for custom dividers.
- Blank lines around dividers.
Compatibility
- Desktop: supported.
- Mobile: supported by using Obsidian editor APIs and avoiding Node or Electron APIs at runtime.
- Minimum app version: Obsidian
1.5.0.
Installation
Install from the community directory when Text Alchemy is listed:
- Open Settings.
- Go to Community plugins.
- Search for Text Alchemy.
- Install and enable it.
Manual install for testing:
- Download
main.js,manifest.json, andstyles.cssfrom a release. - Create
<your-vault>/.obsidian/plugins/text-alchemy/. - Put those three files in that folder.
- Reload Obsidian.
- Enable Text Alchemy in Community plugins.
Release files
Each GitHub release should attach exactly these files:
main.jsmanifest.jsonstyles.css
The source repository intentionally does not commit generated release files.
Privacy
Text Alchemy runs locally in Obsidian. It does not collect telemetry, make network requests, use external accounts, or send note content anywhere.
Limitations
- PDF cleanup is heuristic and may need a manual pass for tables, citations, poetry, or intentionally line-broken text.
- Heading spacing and dividers target Markdown headings that begin with
#. - Sorting commands are line-based and do not preserve nested Markdown structures.
- Whole-note cleanup can make broad changes. Test your enabled pipeline on a small selection first.
Troubleshooting
- If a command changes too much, turn off whole-note fallback and run it on selected text only.
- If code examples are being changed, enable Ignore code blocks.
- If frontmatter changes, enable Ignore YAML frontmatter.
- If the cleaner pipeline does not do anything, make sure at least one cleaner option is enabled.
Development
npm ci
npm run lint
npm run typecheck
npm test
npm run build
npm run build creates main.js for local testing and release uploads. The generated main.js file is intentionally ignored by Git.
Release
See RELEASING.md for the release checklist.
License
MIT. See LICENSE.
Support
Open an issue at https://github.com/NameIsKyro/text-alchemy/issues.