• Stars
    star
    181
  • Rank 210,923 (Top 5 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 3 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Format seleted text in Obsdidian.md

Text Format

Obsidian Downloads GitHub stars

Sometimes I encounter some issues like

  1. I copy 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.
  2. I want to lowercase the letters when they are all uppercase, etc.

Therefore, I wrote this plugin to format selected text lowercase/uppercase/capitalize/titlecase or remove redundant spaces/newline characters, and other features listed below.

Install this plugin right now: obsidian://show-plugin?id=obsidian-text-format

Features

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 selected text Lowercase all letters in selection
Uppercase selected text Uppercase all letters in selection
Capitalize all words in selected text ⚙️ Capitalize all words in selection
Capitalize only first word of sentence in selected text ⚙️ Capitalize only first word of sentence(s) in selection
Title case selected text ⚙️ Capitalize words but leave certain words in lower case in selection (Note: not support Cyrillic strings for now) #1
Tooglecaseselected text ⚙️ A custom loop to format the selection

List

Command Description
Format bullet list ⚙️ Change into bullet list, i.e. - ; split every bullet point into single line; and remove blank lines.
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 The first volume is 1st list, other volumes are sub-list
Convert table to bullet list with header Sub-list begins with ${header}:
Sort to-do list #37
Command Description
Remove WikiLinks format in selection Convert [[WikiLinks]] to WikiLinks (#28)
Remove URL links format in selection Convert [Google](www.google.com) to Google
Convert URL links to WikiLinks in selection Convert [Google](www.google.com) to [[Google]]

PDF copy / OCR

Command Description
Remove redundant spaces in selection Ensure only one space between words
Remove blank line(s) replace \n\n with \n
Merge broken paragraph(s) in selection ⚙️ Change selected lines into single-line, except lines are separated by blank line(s). At the same time, blank lines will be merged into one blank line(optional, default enable), and redundant spaces will be removed(optional, default enable).
Remove hyphens Remove hyphens (like when pasting text from pdf) #15
Split line(s) by blanks Replace with \n for OCR use case.
Convert to Chinese character (,;:!?) ⚙️ For OCR use case. (For who require more custom setting, I would recommend https://p.gantrol.com/)
Replace ligature Replace ligature to Non-ligature #24

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
Zotero note format and paste ⚙️ See below ⬇️

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})

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...

Others

Command Description
Custom Wrapper ⚙️ Add any arbitrary wrapping element in Setting. (Benature/obsidian-underline#5) See below for more examples ⬇️
Decode URL Decode URL for better reading and shorter url.
Convert single letter into math mode e.g. convert P into $P$ (latex), apply for all single letter except a.
Convert Mathpix array to markdown table Convert latex array generated by Mathpix to markdown table format
Add extra double spaces per paragraph for whole file Add double spaces at the end of every paragraph #8
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.

Wrapper

e.g.

  • Underline: prefix=<u>, suffix=</u>, then selected text will turn into <u>text</u>
  • Font color: #30

Support

If you find this plugin useful and would like to support its development, you can sponsor me via Buy Me a Coffee ☕️, WeChat or Alipay, thank you!

Some Example

  • 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.
                  ^
  • 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

demo

More Repositories

1

WordReview

📚 背单词网页 Django + MySQL + Pug + JS
JavaScript
550
star
2

Benature-Obsidian

Obsidian 使用案例分享
JavaScript
53
star
3

obsidian-underline

Add underline(`<u>xxx</u>`) with shortcut, and `<center>xxx</center>`, `[[#xxx]]`, `[[#^xxx]]`
TypeScript
51
star
4

flomo

flomoapp.com API (third party)
Python
34
star
5

obsidian-sample-vault

JavaScript
30
star
6

obsidian-share-my-plugin-list

Share the obsidian plugins that is using currently
TypeScript
24
star
7

bib-catcher

Get bibtex of multiple references in a single line text, by python scraping Google Scholar.
Python
21
star
8

obsidian-automation

TypeScript
15
star
9

pdf-helper

利用 Python 对 PDF 文件进行批量快速处理
Python
15
star
10

obsidian-metadata-hider

Hide metadata property if its value is empty
TypeScript
12
star
11

obsidian-metadata-icon

change metadata entry icon
TypeScript
9
star
12

lazy-kit

用代码偷懒的乐趣. Being Lazy with Code
TeX
6
star
13

AutoLaTeX

Generate LaTeX code by Python.
Python
5
star
14

obsidian-default-query-in-backlink

TypeScript
5
star
15

flomo-workflow

Python
4
star
16

wechat-post-template

微信公众号推送 Markdown 转 HTML (markdown2html),自定义样式。
HTML
4
star
17

obsidian-plugin-reloader

manual reload plugins
JavaScript
3
star
18

StreetBasketballGame

It is a homework of HTML
HTML
2
star
19

ExamRater

结合问卷星的改卷助手
JavaScript
1
star
20

obsidian-dataview.js

JavaScript scripts with Dataview and CustomJS plugins in Obsidian.app
JavaScript
1
star
21

Computational-Physics-Course-Code

Computational Physics Course 计算物理课程代码
Python
1
star