Slash snippets

by echo-saurav
5
4
3
2
1
Score: 34/100

Description

The Slash Snippets plugin speeds up writing by letting you insert frequently used text snippets with a simple trigger character, like a slash (/). It supports plain text, markdown, callouts, tables, HTML, Dataview blocks, and even dynamic templates using Templater. You can define a folder to store your snippets and quickly reuse them without leaving the editor. This is particularly handy for users who often work with reusable content blocks or want to combine snippets with advanced scripting for AI templates or Dataview queries.

Reviews

No reviews yet.

Stats

31
stars
9,417
downloads
2
forks
312
days
92
days
92
days
1
total PRs
1
open PRs
0
closed PRs
0
merged PRs
10
total issues
3
open issues
7
closed issues
0
commits

RequirementsExperimental

Latest Version

3 months ago

Changelog

Minor bug fix

Last Added New Features

  • Last used snippet at top
  • Cursor position and text selection complete variable
  • Load all snippets at start for faster search

README file from

Github

Slash snippets

total

Quickly insert your most-used text snippets while writing in Obsidian. Perfect for things like Dataview blocks, callouts, templates, or any reusable text.

gif

Setup

  • Pick a trigger character, by default, it’s / (slash).
  • Enter the folder path where you'll keep all your text snippets.
  • Set a folder path where you will be store all your text snippets.
  • Turn on Ignore properties if you don’t want property values included when inserting snippets.
  • Enable Templater support if you want to use Templater syntax inside snippets.
  • Add your snippets to the folder you specified.

image

How to install

Currently its under review , you can install using BRAT plugin or manually

Manual Installation

  • Download main.js , manifest.json , styles.css the latest release from the releases page
  • create a folder name slash-snippets-plugin in .obsidian/plugins
  • put all the file you downloaded in your vault's .obsidian/plugins/slash-snippets-plugin/ directory
  • Reload Obsidian
  • Enable the plugin in Settings -> Community Plugins

Text Variables

cursor position

use %%cursor%% in the snippet file to have a predefined position after the snippet is inserted.

Example:

<iframe src="%%cursor%%" height="400px" width="100%"></iframe>

Text selection insert

insert last selected text into snippet.

Example

> [!faq]- %%textSelection%%
> 

gif

Here are some inspirations for snippets

Colorful text

<span style='background:red; color: white'>%%cursor%%</span> 

Or this, if you want text selection

<span style='background:red; color: white'>%%cursor%%%%textSelection%%</span> 

image

Callouts

> [!faq]- Are callouts foldable?
> yes 
> [!success] 
> nice!

2 col table

| 1   | 2   |
| --- | --- |
|     |     |

3 col table

| 1   | 2   | 3   |
| --- | --- | --- |
|     |     |     |

4 col table

| 1   | 2   | 3   | 4   |
| --- | --- | --- | --- |
|     |     |     |     |
|     |     |     |     |

Html snippets

</br> </br>
<iframe src=" " height="400px" width="100%"></iframe>

mermaid chart

```mermaid
flowchart LR 
    Start --> Stop
```

Also you can mix with templater code to make powerful snippets**

Iframe

<iframe src="<% await tp.system.prompt("Ifram Url") %>" height="400px" width="100%"></iframe>

Markdown comment

<!-- <% tp.file.cursor() %> -->

You can create some snippets named as today, yesterday and so on

today

[[<%tp.date.now("YYYY-MM-DD")%>]] 

tomorrow

[[<% tp.date.now("YYYY-MM-DD" ,1) %>]] 

yesterday

[[<% tp.date.now("YYYY-MM-DD" ,-1) %>]]

last week

[[<% tp.date.now("YYYY-MM-DD" ,-7) %>]]

Quick dataview

```dataview
LIST FROM "<%tp.file.cursor()%>"
SORT file.mtim DESC
```
```dataview
TABLE 
<%tp.file.cursor(1)%>
FROM "<%tp.file.cursor()%>"

WHERE
<%tp.file.cursor(2)%>

SORT file.mtim DESC
```

Progress bar for tasks in a note with inline dataview

`= "<progress value='" + (length(filter(this.file.tasks.completed, (t) => t = true)) / length(this.file.tasks)) * 100 + "' max='100'></progress>" + "<br>" + round((length(filter(this.file.tasks.completed, (t) => t = true)) / length(this.file.tasks)) * 100) + "% completed"`

List all backlinks

## Backlinks
```dataview
LIST FROM [[<%tp.file.title%>]]
```

List all outgoing links

## Outlinks
```dataview
LIST
WITHOUT ID
file.link
FROM  "/"

WHERE 
contains(file.inlinks ,[[<%tp.file.title%>]] )

```

AI Templates with obsidian-ai-templater plugin

Answer question about the note

<%*_
const content = tp.file.content
const userInput = await tp.system.prompt("What you want to write?")

let cleanContent = content.replace(/^-{3}[\s\S]*?-{3}\s*/gm, '');
cleanContent = cleanContent.replace(/<%\*_[\s\S]*?_%\>/g, '');
cleanContent = cleanContent.replace(/<%[\s\S]*?%\>/g, '');
cleanContent = cleanContent.trim();

const prompt = `
${userInput}
Do this based on the note bellow , 
---
${cleanContent}
--

Do not add any yaml for notes, only do or asked as user said. keep it simple and short
`
const aiWrite = await tp.ai.chat(prompt)

_%>
<% tp.file.cursor() %>
<% aiWrite %> 

Make summery of current note

<%*_
const content = tp.file.content

let cleanContent = content.replace(/^-{3}[\s\S]*?-{3}\s*/gm, '');
cleanContent = cleanContent.replace(/<%\*_[\s\S]*?_%\>/g, '');
cleanContent = cleanContent.replace(/<%[\s\S]*?%\>/g, '');
cleanContent = cleanContent.trim();

const prompt = `
Make a summery of the text bellow 
---
${cleanContent}
--

Only make summery dont make heading or anything else, your output will be inserted into a note , so write it as a note's summery sections. 
`
const summery = await tp.ai.chat(prompt)
_%>
<% tp.file.cursor() %>
## Summery
<% summery.trim() %>

Make tasks list for notes

<%*_
const content = tp.file.content
let cleanContent = content.replace(/^-{3}[\s\S]*?-{3}\s*/gm, '');
cleanContent = cleanContent.replace(/<%\*_[\s\S]*?_%\>/g, '');
cleanContent = cleanContent.replace(/<%[\s\S]*?%\>/g, '');
cleanContent = cleanContent.trim();

const prompt = `
Read this notes bellow carefully and make markdown tasks list based on what the notes talking about doing or planning 
---
${cleanContent}
--

Only make tasks dont make heading or anything else, your output will be inserted into a note , so write it as a note's ## Todo's sections, so you dont have to write heading for todo's, Only markdown task 
ex: 
- [ ] something 
`
const tasks = await tp.ai.chat(prompt)
_%>
<% tp.file.cursor() %>
## Todo's
<% tasks %>

Mermaid chart

<%*_
const content = tp.file.content
let cleanContent = content.replace(/^-{3}[\s\S]*?-{3}\s*/gm, '');
cleanContent = cleanContent.replace(/<%\*_[\s\S]*?_%\>/g, '');
cleanContent = cleanContent.replace(/<%[\s\S]*?%\>/g, '');
cleanContent = cleanContent.trim();


const prompt = `
Read this notes bellow carefully and make top down mermaid flowchart based on what the notes talking about, include key points the note says
---
${cleanContent}
--
`
const mermaidChart = await tp.ai.chat(prompt)
_%>
<% tp.file.cursor() %>
<% mermaidChart %> 

Answer question about note

<%*_
const content = tp.file.content
const userInput = await tp.system.prompt("What you want to write?")

let cleanContent = content.replace(/^-{3}[\s\S]*?-{3}\s*/gm, '');
cleanContent = cleanContent.replace(/<%\*_[\s\S]*?_%\>/g, '');
cleanContent = cleanContent.replace(/<%[\s\S]*?%\>/g, '');
cleanContent = cleanContent.trim();

const prompt = `
${userInput}
Do this based on the note bellow , 
---
${cleanContent}
--

Do not add any yaml for notes, only do or asked as user said. keep it simple and short
`
const aiWrite = await tp.ai.chat(prompt)

_%>
<% tp.file.cursor() %>
<% aiWrite %>

Similar Plugins

info
• Similar plugins are suggested based on the common tags between the plugins.
Dataview
5 years ago by Michael Brenan
A data index and query language over Markdown files, for https://obsidian.md/.
Heatmap Calendar
4 years ago by Richard Slettevoll
An Obsidian plugin for displaying data in a calendar similar to the github activity calendar
Callout Manager
3 years ago by eth-p
An Obsidian.md plugin that makes creating and configuring callouts easy.
Charts View
5 years ago by caronchen
Data visualization solution in Obsidian, support plots and graphs.
CSS Editor
3 years ago by Zachatoo
Edit CSS snippets in Obsidian.
Text Snippets
5 years ago by Ariana Khitrova
Snippets plugin 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 🖌.
Smart ChatGPT
a year ago by 🌴 Brian
DataCards
a year ago by Sophokles187
Obsidian Plugin that transforms dataview tables into visually appealing and customizable card layouts.
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
Table to CSV Exporter
4 years ago by Stefan Wolfrum
An Obsidian Plugin that allows to export tables from a pane in reading mode to CSV files.
Page Gallery
3 years ago by Nathan Clark
Generates a gallery based on selected page contents.
Link Tree
3 years ago by Joshua Tazman Reinier
A sidebar foldable list of Obsidian link hierarchies.
Simple Note Review
4 years ago by dartungar
Simple, customizable plugin for easy note review, resurfacing & repetition in Obsidian.md.
Typst Mate
3 months ago by azyarashi
Render math expressions with Typst instead of MathJax in Obsidian.
Dataview Serializer
2 years ago by Sébastien Dubois
Obsidian plugin that gives you the power of Dataview, but generates Markdown, making it compatible with Obsidian Publish, and making the links appear on the Graph.
Better Inline Fields
4 years ago by David Sarman
Obsidian plugin to enhance Dataview style inline fields
Habit Calendar
3 years ago by Hedonihilist
Monthly Habit Calendar for DataviewJS. This plugin helps you render a calendar inside DataviewJS code block, showing your habit status within a month.
Dataview Publisher
2 years ago by UD
Output markdown from your Dataview queries and keep them up to date. You can also be able to publish them.
Snippetor
4 years ago by ebullient
An assist for creating CSS snippets for Obsidian
Release Timeline
4 years ago by cakechaser
Habit Tracker
4 years ago by David Moeller
A Plugin to display a Habit Tracker in Obsidian.
Dataview (to) Properties
10 months ago by Mara-Li
Sync inline Dataview to properties (YAML frontmatter)
Tasks Map
7 months ago by NicoKNL
A graph view of your tasks.
Query all the things
3 years ago by Sytone
Query all your data stored in Obsidian, this plugin allows SQL based queries against the data collections available in Obsidian and Dataview. Output can then be rendered by Handlebars
Snippet Commands
5 years ago by death_au
Registers custom css snippets as commands (which you can bind hotkeys to)
Search++
6 years ago by Noureddine Haouari
Allow inserting text context search results on the active note.
moviegrabber
3 years ago by Leon Holtmeier
obsidian.md plugin to grab data from public movie Databases and make them into a note that can be used with dataview querries
Double Colon Conceal
3 years ago by Michal Srch
Obsidian plugin to display double colon (i.e. Dataview inline fields) as a single colon for more natural reading experience.
Virtual Footer
a year ago by Signynt
Display markdown text (including dataview queries or Obsidian bases) at the bottom or top of all notes which match a specified rule, without modifying them.
Snippets
5 years ago by Pelao
Bulk Exporter
3 years ago by symunona
Bulk export Markdown filtered, renamed and sorted by front matter metadata into a new structure.
Jelly Snippets
3 years ago by Spencer Gouw
A simple text snippets plugin for Obsidian.md. BACKUP SNIPPETS BEFORE UPDATING.
Group Snippets
4 years ago by Mara-Li
Create folder of snippets to activate them in one click !
Kanban Status Updater
a year ago by Ankit Kapur
Obsidian plugin that automatically updates the note property when card is moved to a column.
View Count
2 years ago by Trey Wallis
Add view count tracking to your Obsidian vault
Meld Build
3 years ago by meld-cp
Write and execute (sandboxed) JavaScript to render templates, query DataView and create dynamic notes.
HackerOne
3 years ago by neolex
A plugin to get our hackerone reports data into obsidian
Run
2 years ago by Hananoshika Yomaru
Generate markdown from dataview query and javascript.
Feeds
2 years ago by LukeMT, pashashocky, madx
Magic feeds dataview query for obsidian
Snippets Manager
2 years ago by Venkatraman Dhamodaran
Snippets Manager (Text Expander) For Obsidian
Reason
2 years ago by Joshua Pham
Digest your Obsidian notes
Tier List
a year ago by Mox Alehin
Obsidian plugin for visual ranking and organizing content into customizable Tier Lists.
Dataview Autocompletion
a year ago by Daniel Bauer
CSV All-in-One
a year ago by hihangeol
Tagvis
a year ago by Mason Bryant
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.
Every Day Calendar
a year ago by QuBe
Obsidian plugin to create calendars inspired by Simone Giertz's Every Day Calendar
TikToker
2 months ago by ameyxd
Save TikTok videos as markdown notes with embedded content and metadata extraction.
MOC Link Helper
2 years ago by Bogdan Codreanu
This obsidian plugins allows you to quickly see which notes you need to include in your MOC.
Snippetsaurus
a year ago by Christian Humbert
Hotstrings
a year ago by wakywayne
Inline Code Copy
a year ago by Hongchen Lin
Log Keeper
a year ago by James Sonneveld
Generates times stamps automatically as changes are made to a note.
Pug Templates
2 years ago by Nicholas Wilcox
An Obsidian plugin that enables the usage of Pug templates.
Auto Math
2 months ago by Vladislav Sorokin
Auto-expands LaTeX snippets. External rules with live reload, Custom Rules Editor, and default math pack.
Move Cursor On Startup
8 months ago by Jared Kelnhofer
Obsidian plugin to move the cursor to the right and back to the left when starting up. Why? To keep DataView expressions from not running on the first load of, say, your Home file.