Jelly Snippets

by Spencer Gouw
5
4
3
2
1
Score: 41/100

Description

Category: Note Enhancements

The Jelly Snippets plugin for Obsidian.md is a simple yet powerful tool for streamlining your writing experience. With Jelly Snippets, you can define text replacements that can be triggered with a single keystroke, allowing you to quickly insert common phrases or code snippets into your documents.

The plugin's core feature is its ability to recognize and replace predefined text patterns, known as "snippets," in your writing. You can create multiple snippets and customize their behavior using various symbols and formatting options. For example, you can use a snippet divider to separate different snippets in the same file, or define custom symbols for whitespace and cursor placement.

One of the standout features of Jelly Snippets is its flexibility. The plugin allows you to define snippets that incorporate advanced text manipulation techniques, such as regex capabilities and semantic symbol handling. This makes it an excellent choice for developers and writers who need to work with complex code or formatting schemes.

Overall, the Jelly Snippets plugin is a valuable addition to any Obsidian.md user's toolkit, offering a convenient and customizable way to streamline your writing workflow.

Reviews

No reviews yet.

Stats

26
stars
6,062
downloads
1
forks
1,130
days
944
days
944
days
2
total PRs
1
open PRs
1
closed PRs
0
merged PRs
19
total issues
8
open issues
11
closed issues
0
commits

Latest Version

3 years ago

Changelog

2e1764a3bf486929c97f6a7a24a9cab4f0055de4 - fixed weird behavior with checkboxes.

The version upgrade represents the first bit of CodeMirror usage, which is preferable for editor changes at the least. The more CodeMirror-specific code I write, the more complex the extension gets. With any luck, if I implement more advanced features using that API, I'll be able to keep it simple.

README file from

Github

jelly-snippets

A simple text snippets plugin for Obsidian.md.

BEFORE UPDATING,READ:

If you have used an older version of this plugin (1.5) or below, updating to version 1.6 will erase your snippets. Backup your snippets before updating; I will update the plugin with a backup functionality later too in case I mess up again. Deepest apologies.

What does it do?

Pretty simple. You probably have run into snippets before.

  1. Specify a mapping of snippet to replacement in the settings tab.

    snippet. |+| replacement!

  2. If the cursor is at the end of a snippet...

    snippet.<cursor here>

  3. ..then triggering the snippet conversion...

    snippet.<cursor here - TRIGGER!>

  4. ..will replace the snippet with its replacement!

    replacement!<cursor here>

In greater detail:

Snippets are defined in a text area (like a file) in settings. Each snippet has two parts: lhs and rhs.

The lhs (left hand side) determines what text gets replaced; the rhs (right hand side) determines what replaces the text.
The lhs is exactly the text that will be replaced, while the rhs can have certain symbols to represent things like whitespace.

Naturally, there is a symbol to divide these two halves of a snippet, called a snippet part divider:

|+|, for example. (With spaces at the ends.)

lhs |+| rhs

So when you type lhs and then trigger the snippet command, it will replace the text lhs with rhs.

And, there is a symbol to divide each separate snippet in the list of snippets, called a snippet divider:

-==-, for example.

You must keep the snippet divider on their own line - that is, the plugin expects a newline after the snippet divider. (Implicitly, no two snippets can be on the same line.)

So if you had the following snippets file:

lhs |+| rhs
-==-
superb |+| superbowls

Then you would have two snippets. If your divider was -==- still and you had the following file:

lhs |+| rhs
superb |+| superbowls

Then typing lhs and triggering the snippet command would replace lhs with:

rhs
superb |+| superbowls

Using Symbols (simple)

Say you want to expand hw into a full hello-world function. Say we're using Rust. You define the snippet:

hw |+| fn hello() {
%\t%\e
}

When you trigger the snippet, you'll end up with this:

fn hello() {
    |
}

... where | represents your cursor. Of course, Obsidian is a markdown editor, so expect the little indent guide.

List of supported symbols
  • Newline: %\n
  • Tab: %\t
  • Space: %\s
  • Cursor Ending position (after snippet replacement): %\e

Why?

I wanted to make a generic snippets plugin that operated on text and worked as I needed. There is an existing snippets plugin already, Text Snippets by ArianaKhit, but not only is the plugin code somewhat outdated and a little complex, it seems to use an older API. (It is a very good plugin by the way.)

One of my goals writing this was to write a simple plugin that used the API exactly as described by the unofficial docs and by vanilla Typescript. I also wanted to make the core functionality of the plugin more flexible, though of course I have yet to add certain features that would truly provide that.

Another motivation was that I wanted to make a plugin by which I could type in my personal note-taking syntax (called JellyNote); I originally was going to write a whole editor extension, but I eventually realized that I could implement it with snippets. So, I'll be adding features to this plugin as long as I need them for JellyNote syntax.

This plugin also reminds me of LaTeX2Unicode, a neovim plugin which I used extensively in my first two years of college. I liked it because it would automatically change latex to unicode on pressing space; that was it. No stretching for the tab key.

It's since been incorporated back into julia.vim. I didn't originally mean to write a plugin that could provide this kind of functionality - but I suppose the concept of text translation is really useful!

Future Improvements/TODO

  • Control characters in snippets (whitespace only)
  • Semantic symbols in snippets (e.g. where does cursor go afterwards? a snippet with braces might benefit from placing the cursor inside...)
  • Regex capabilities - at least on selection.
  • A backup for snippets - or a way of specifying snippets in a file, to modularize snippets. May be useful if regex snippets need to be defined separately from text snippets.
  • Bugfixes and auditing.
  • AUTOMATED TESTING. Use Jest.
  • Do the things liamcain suggested in my plugin PR to the Obsidian plugin repo. (one half done)
  • Working with Obsidians template stuff.
  • REWRITE: CodeMirror editor extension. See here on state fields. This should also make things such as tabstops and working in live preview possible, but I don't know for sure. This would mark a version upgrade.

Other caveats

  • None right now, except that the maintainer of this plugin (me) is inexperienced and may break something. Keep your snippets safe if you write a lot of them.

Similar Plugins

info
• Similar plugins are suggested based on the common tags between the plugins.
Text Generator
4 years ago by Noureddine Haouari
Text Generator is a versatile plugin for Obsidian that allows you to generate text content using various AI providers, including OpenAI, Anthropic, Google and local models.
Text Extractor
3 years ago by Simon Cambier
A (companion) plugin to facilitate the extraction of text from images (OCR) and PDFs.
Colored Text
3 years ago by Erinc Ayaz
Text Format
5 years ago by Benature
Format seleted text in Obsdidian.md
Colored Tags
3 years ago by Pavel Frankov
Colorizes tags in different colors.
Callout Manager
3 years ago by eth-p
An Obsidian.md plugin that makes creating and configuring callouts easy.
CSS Editor
3 years ago by Zachatoo
Edit CSS snippets in Obsidian.
Text Snippets
5 years ago by Ariana Khitrova
Snippets plugin for obsidian
Text Transporter
5 years ago by TfTHacker
Text Transporter - advanced text management for Obsidian.
MySnippets
5 years ago by Chetachi
MySnippets is a plugin that adds a status bar menu allowing the user to quickly manage their snippets within the comfort of their workspace 🖌.
Text expand
6 years ago by MrJackphil
A simple text expand plugin for Obsidian.md
Pieces for Developers
3 years ago by Pieces For Developers
Pieces' powerful extension for Obsidian-MD that allows users to access their code snippets directly within the Obsidian workspace
Translator
4 years ago by Haifeng Lu
A plugin for Obsidian to translate selected text.
Typst Mate
3 months ago by azyarashi
Render math expressions with Typst instead of MathJax in Obsidian.
Snippetor
4 years ago by ebullient
An assist for creating CSS snippets for Obsidian
Slash snippets
10 months ago by echo-saurav
Insert snippet of text with slash command
Regex Mark
2 years ago by Mara-Li
Snippet Commands
5 years ago by death_au
Registers custom css snippets as commands (which you can bind hotkeys to)
Remove Newlines
2 years ago by Elias Jaffe
A plugin for Obsidian.md which removes newlines and blank lines from selected or pasted text.
Text Finder
a year ago by hafuhafu
Provides a find/replace window in edit mode similar to VSCode (supports regular expressions and case sensitivity).
Toggle Case
3 years ago by automattech
Obsidian plugin to toggle between `lowercase` `UPPERCASE` and `Title Case`
Snippets
5 years ago by Pelao
Group Snippets
4 years ago by Mara-Li
Create folder of snippets to activate them in one click !
Text Transform
3 years ago by ipshing
Text Dataset Aid Plugin
3 years ago by Conner Ohnesorge
This is a obsidian plugin to help with the creation of personal jsonl datasets for text generation models.
Fill in the Blank (FITB)
3 years ago by Shawn McGee
Text Conversions
3 years ago by Juan D Frias
Text conversions for Obsidian
Snippets Manager
2 years ago by Venkatraman Dhamodaran
Snippets Manager (Text Expander) For Obsidian
Colorizelt
2 years ago by Artsem Holub (WiNE-iNEFF)
Easy color and clear selected text
复制图文 (Copy Image Text)
2 years ago by msgk
obsidian插件,复制笔记内容(包括文本和图片)到剪贴板
Dynamic Text Concealer
2 years ago by Matt Cole Anderson
Obsidian.md Plugin to conceal or replace user configured text patterns in Live Preview and Read Mode.
Textgrams
a year ago by Akop Kesheshyan
Create and store ASCII graphics in your Obsidian
Text Focus
2 years ago by usysrc
Focus the text area when opening a new note.
Cliplet
6 months ago by namikaze-40p
An Obsidian plugin that serves as a clipboard and snippet manager — your own, separate from the OS clipboard.
Snippetsaurus
a year ago by Christian Humbert
Inline Code Copy
a year ago by Hongchen Lin
Arcane Obfuscate
2 years ago by Shusako
Obfuscate text in Obsidian.md with an arcane runic effect.
Auto Math
2 months ago by Vladislav Sorokin
Auto-expands LaTeX snippets. External rules with live reload, Custom Rules Editor, and default math pack.