Text Format
approvedby Benature
Format selected text upper/lower/capitalize.
Text Format
[ δΈζ | English ]
When I'm taking notes, sometimes I encounter some issues like
- I copied some text from pdf or some other source, but the copied content is out of format. For example, there are more than one space between words or one paragraph brokes into several lines.
- Lowercase letters are required while they are all uppercase, etc.
- blahblahblah...
This plugin is created to format selected text lowercase/uppercase/capitalize/titlecase or remove redundant spaces/newline characters, and other features listed below.
Click to install this plugin right now
Features
Experimental features:
- Format on paste: see #86
Commands
Press cmd/ctrl+P to enter the command. π
Or you can consider to bind custom hotkeys to those commands according to #29.
βοΈ: There is setting of this command.
Basic
| Command | Description |
|---|---|
| Lowercase | Lowercase all letters in selection or the whole title (when cursor focus inline tile) |
| Uppercase | Uppercase all letters in selection or the whole title (when cursor focus inline tile) |
| Capitalize all words βοΈ | Capitalize all words in selection or the whole title (when cursor focus inline tile) |
| Capitalize only first word of sentence βοΈ | Capitalize only first word of sentence(s) in selection or the whole title (when cursor focus inline tile) |
| Title case βοΈ | Capitalize words but leave certain words in lower case in selection or the whole title (when cursor focus inline tile) #1 |
| Cycle case βοΈ | A custom loop to format the selection or the whole title (when cursor focus inline tile) |
| Slugify selected text | convert any input text into a URL-friendly slug |
| Snakify selected text | Lowercase all letters in selection and replace spaces with underscores |
| camelCase selected text | Convert text to camelCase with a lowercase first letter |
| CamelCase selected text | Convert text to CamelCase with an uppercase first letter |
Title case supports Unicode letters. When Turkish-specific characters are present, casing uses Turkish lowercase rules (I β Δ±, Δ° β i). With no selection, it formats the word at the cursor, including each cursor in a multi-cursor selection. An optional setting expands partial selections to whole words, including hyphenated words, possessives, and camelCase words.
Markdown Grammar
| Command | Description |
|---|---|
| Heading upper | e.g.: # Heading -> ## Heading |
| Heading lower | e.g.: ## Heading -> # Heading [discussions] |
| Callout format | #80 |
List
| Command | Description |
|---|---|
| Detect and format bullet list βοΈ | Change β’ into bullet list, i.e. - ; split every bullet point into single line; and remove blank lines. (test cases) |
| Detect and format ordered list | Change *)(star could be any letter) into ordered list (e.g. 1. , 2. ); split every ordered point into single line; and remove blank lines. (#4) |
| Convert table to bullet list without header | The first column becomes the top-level list; other columns become sub-lists |
| Convert table to bullet list with header | Sub-list begins with ${header}: |
| Sort to-do list | #37, #46 |
Links
| Command | Description |
|---|---|
| Remove WikiLinks format in selection | e.g. Convert [[WikiLinks]] to WikiLinks (#28) |
| Remove URL links format in selection | e.g. Convert [Google](www.google.com) to Google |
| Convert URL links to WikiLinks in selection | e.g. Convert [Google](www.google.com) to [[Google]] |
| Convert WikiLinks to plain markdown links in selection βοΈ | e.g. Convert [[Google]] to [Google](Google.md) (#40) |
Copy / OCR issues
| Command | Description |
|---|---|
| Remove redundant spaces in selection | Ensure only one space between words |
| Remove all spaces in selection | Remove all spaces |
| Remove trailing spaces in selection | Remove trailing spaces (#61) |
| Remove blank line(s) | replace \n\n with \n |
| Merge broken paragraph(s) in selection βοΈ (remove line breaks) | Remove single line breaks and change selected lines into a single line. For example, first line\nsecond line becomes first line second line. Paragraphs separated by blank lines remain separate. Blank lines can optionally be merged into one blank line, and redundant spaces can optionally be removed (both enabled by default). |
| Split line(s) by blanks | Replace with \n for OCR use case. |
| Convert to Chinese punctuation marks (,;:!?) βοΈ | For OCR use case. (For who require more custom setting, I would recommend https://p.gantrol.com/) |
| Convert to English punctuation marks | Similar to Convert to Chinese punctuation marks (,;:!?) |
| Remove hyphens | Remove hyphens (like when pasting text from pdf) #15 |
| Replace ligature | Replace ligature to Non-ligature #24 |
Remove trailing spaces, Remove blank line(s), Split line(s) by blanks, and Add extra line break between paragraphs are provided as built-in Custom Replacement commands.
Academic / Study
| Command | Description |
|---|---|
| Convert selection into Anki card format | #32 |
| Remove citation index | e.g., A research [12] about notes => A research about notes |
| Get Zotero note from clipboard and paste βοΈ | See below β¬οΈ |
| Detect and convert characters to math mode (LaTeX) | e.g. convert P into $P$ (latex), apply for all single letter except a. |
| Convert Mathpix's LaTeX array to markdown table | Convert a LaTeX array generated by Mathpix to Markdown table format |
Advanced custom
| Command | Description |
|---|---|
| Custom Replace βοΈ | Custom replace <search> to <replace>. See below for more examples β¬οΈ |
| Custom Wrapper βοΈ | Add any arbitrary wrapping element in Setting. (https://github.com/Benature/obsidian-underline/issues/5) See below for more examples β¬οΈ |
| Custom API Request βοΈ | Replace Selection with the return of custom API request. The selection will be sent to custom API URL with POST method. (No user data is collected!) There is an example of my use case. |
Others
| Command | Description |
|---|---|
| Open preference settings tab | Open the Text Format settings tab directly |
| Decode URL | Decode URL for better reading and shorter url. |
| Add extra line break between paragraphs | replace \n with \n\n |
| Format space between words and symbols | add spaces between words and symbols, such as ( |
Privacy and network access
Text Format does not collect telemetry. Features that access external data are limited to the following cases:
- Custom API Request sends the selected text and current file path to your configured endpoint only when you invoke that command.
- WikiLink conversion searches loaded vault files to resolve the matching note path.
- Format on paste reads clipboard content only when enabled by the note property or global setting. When the optional multiline bullet paste setting is enabled (off by default), pasting multiple plain-text lines into an empty bullet item converts them into same-level items with the current indentation and marker.
- Donation information loads sponsor links and a QR-code image from the displayed external domains.
Support
If you find this plugin useful and would like to support its development, you can sponsor me via Buy Me a Coffee βοΈ, WeChat, Alipay or AiFaDian. Any amount is welcome, thank you!
Some Examples
Zotero format
The format template can refer to https://www.zotero.org/support/note_templates
- default
- zotero:
<p>{{highlight quotes='true'}} {{citation}} {{comment}}</p> - plugin config:
β(?<text>.*)β \((?<item>.*?)\) \(\[pdf\]\((?<pdf_url>.*?)\)\) - result:
{text} [π]({pdf_url})
- zotero:
Replacements
Custom replacements use global (g) regular expressions by default. Use the optional Flags field to add other JavaScript RegExp flags, such as i (case-insensitive), m (multiline), or s (dotAll). Leave it empty to preserve the default behavior.
For example, this rule removes a Markdown link's optional title when it differs from the URL only by letter case:
- Search:
\[([^\]]+)\]\((\S+) "(\2)"\) - Flags:
i - Replace:
[$1]($2)
- [Example](https://example.com/PATH "https://example.com/path")
+ [Example](https://example.com/PATH)
- Split paragraph into sentences: #78
Wrapper
Anki cloze markers such as {{c1:: and }} are preserved as literal text. Metadata templates such as {{link}} are still evaluated when used alongside them.
use cases:
- Underline: prefix=
<u>, suffix=</u>, then selected text will turn into<u>text</u> - Font color: #30
Convert citation index to the file name of paper note
With bib-cacher, I can connect to Zotero database by python, building a simple Flask server.
Example of command Custom API Request:
- A survey concludes that obsidian is a good app [12]. Furthermore, The note taking...
+ A survey concludes that obsidian is a good app ([[File Name of the Reference]]). Furthermore, The note taking...
Basic

- lowercase
- Hello, I am using Obsidian. + hello, i am using obsidian. - uppercase
- Hello, I am using Obsidian. + HELLO, I AM USING OBSIDIAN. - capitalize word
- Hello, I am using Obsidian. + Hello, I Am Using Obsidian. - capitalize sentence
- hello, I am using Obsidian. + Hello, I am using Obsidian. ^ - title case
- Obsidian is a good app. + Obsidian Is a Good App. ^ - slugify
- Obsidian - a good app. + obsidian-a-good-app - snakify
- Obsidian is a good app + obsidian_is_a_good_app - redundant spaces
- There are so many redundant blanks + There are so many redundant blanks - merge broken paragraph
- This paragraph is broken - into several lines. I want - those lines merged! - - And this is second paragraph. There is a blank line between - two paragraph, indicating that they should not be merged into - one paragraph! + This paragraph is broken into several lines. I want those lines merged! + + And this is second paragraph. There is a blank line between two paragraph, indicating that they should not be merged into one paragraph! - bullet list
- β’ first, blahblah β’ second, blahblah β’ third, blahblah + - first, blahblah + - second, blahblah + - third, blahblah - ordered list
- a) first, blahblah b) second, blahblah c) third, blahblah - i) first, blahblah ii) second, blahblah iii) third, blahblah + 1. first, blahblah + 2. second, blahblah + 3. third, blahblah
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.