Supercharged Links
This plugin allows you to style the links in your Obsidian vault based on your notes metadata! You can, for example, automatically add colors and emojis to the links:
Why is this useful?
For example, when your notes represent something, like a paper, a location, a person or a day in the week. Then you can use Supercharged links to have those notes stand out. Another use case might be to give notes with the #todo tag a loud color.
This visual feedback helps you find the right note back quickly!
Setting Supercharged Links up is easier than ever now with the Style Settings Plugin! See down below for a tutorial to get started.
Getting started
Let's say I have a note about Jim called Jim.md with the tag #person and some YAML frontmatter.
---
status: call soon
age: 42
---
Jim is one of my colleagues
#person
I want to change what links to Jim's note look like. In particular, I want links to persons to have a blue background, and I want persons I have to call to have a telephone emoji
.
Setting up the plugin
Time to set up the plugin to get this work! Let's go to the plugin settings.
First, you have to tell the plugin what front-matter attributes to include for your styling in the Target Attributes for Styling option on top. Let's add status here, which indicates whether we need to call Jim!
Next, we have to tell the plugin to look for notes with the tag #person. In the settings, under the Styling header, create a new selector. Under types of selector, select "Tag", and add person down below:
We also want to add an emoji when notes have call soon as its status. We will tell the plugin to look for the attribute status, and that its value should be call soon. Note that this will also look for inline fields called status from DataView.
One important setting for our use case is that we only enable the "Add content before link" option under "Style options", since otherwise this style would override the one from the tag #person!
In addition to styling based on attributes or tags, we can also style notes based on their 'path' (which includes its name, folders and extension). For example, we can style all notes in the folder dailies. Make sure to select 'Contains value' under match here instead of 'Exact match':
Time to style!
First, make sure you have the Style Settings Plugin installed and enabled. Then, under settings, navigate to the settings of Style Settings. Now we are ready to style our links! Let's start with setting up our style for notes with the tag #person. We will use a white text color, enable the background, and use a nice blue background there.
Next, let's add emoji's before notes with the call soon status. All we have to do here is copy the
And voila!
Advanced use
While the Style Settings integration provides a huge amount of customizability options, if you are comfortable with CSS and HTML, you can go even further with styling your links. For that, let's explain what this plugin does in the background.
Let's say I have some link to [[Jim]] somewhere.
Without the plugin activated, the HTML link element would normally look like this:
<a data-href="Jim" href="Jim" class="internal-link" target="_blank" rel="noopener">Jim</a>
This does not give any information about what is in the Jim.md note! So, we wouldn't be able to customize it.
That's where this plugin comes in: it will add two extra properties in the <a> element : data-link-status and data-link-tags. Importantly, these attributes are prefixed with data-link so that it will not conflict with other attributes in Obsidian.
With the plugin active, the <a>element will be supercharged like this:
<a data-href="Jim" href="Jim" class="internal-link data-link-text data-link-icon data-link-icon-after" target="_blank" rel="noopener" data-link-status="call soon" data-link-tags="#person" >Jim</a>
Style your links with CSS!
You can use the flexibility of CSS to customize your links by setting CSS properties in a CSS snippet like links.css. To create a CSS snippet, go to the Obsidian settings, then to Appearance and scroll to the CSS snippets section. Click on the little folder icon, then create a new file in the opened folder called links.css.
Example CSS snippets
To change the color of every appearance of a link to a note based on the tag in the file:
[data-link-tags*="#topic" i]{
color: #ff6600 !important;
}This will target all HTML elements that contain the data-link-tags property, that is, all supercharged links.
To put a
.data-link-icon[data-link-category$="People" i]::before{
content: "👤 "
}Selecting specifically .data-link-icon is required to prevent bugs in Live Preview.
To highlight the link in a tag-like blue rounded rectangle when the property status is in the note:
:not(:empty)[data-link-next-status] {
color: white;
background-color: rgb(29, 29, 129);
border-radius: 18px;
padding: 5px 15px;
}To display the value of the status property at the target file, but only whenever you hover on the link:
.data-link-icon-after[data-link-status]:hover::after{
content: " ► "attr(data-link-status)
}To hide the display of links with the tag #hide from your notes (that is, from preview mode and live preview):
a.internal-link[data-link-tags *="hide"],
.cm-hmd-internal-link > [data-link-tags *="hide"]{
visibility: hidden !important;
display: none;
}Demos
NOTE: These demos are somewhat outdated.
Live Preview
Internal link simple styling
Multiple properties
Multiple values for a property
Supported plugins
Live preview, source view, reading mode and the file browser are fully supported in core Obsidian. Other plugins are also supported, as listed below:
Core plugins:
- Backlinks (including Backlinks in edit mode)
- Outgoing links
- Search
- Starred files
- Quick Switcher
Community plugins:
- Breadcrumbs
- Graph Analysis
- Recent files
- Quicker Switcher++
- Another Quick Switcher
- Dataview (inline fields)
Want support for another plugin? Create an issue here in the repo!
Link context menu extra options
This plugin also adds context menu items to modifiy target note's frontmatter properties and "inline fields" (dataview syntax) by right-clicking on the link The preset values for those properties can be managed globally in the plugin's settings or on a file-by-file basis thanks to fileClass definition (see section 4)
Right click on a link will automatically display an item per target note's frontmatter property and "inline fields" (dataview syntax)
these options are accessible from:
- the context menu of a link,
- the context menu of a calendar day,
- the context menu of a file in the file explorer,
- the "more options" menu of a file
- the command palette "Cmd+P" or by typing the hotkey Alt+O (can be customized in hotkeys settings)
Update text property
- Right-click on the link
- Click on "Update .... " to change the property's value
- Change the value in the modal's prompt
- Type
enterto save or click X orescto cancel
demo: https://youtu.be/qhtPKstdnhI
Update boolean property
- Right-click on the link
- Toggle the swith in the modal to change the value
- Press
escto leave the modal
demo: https://youtu.be/iwL-HqvoNOs
Update multiple values property
- Right-click on the link
- Change values comma-separated
- Press
enter, the values will be displayed as an array of values in the target note's frontmatter property
this doesn't work with indented lists YAML format
demo: https://youtu.be/WaW6xElq0T4
Preset values for property
- Add a new Property Manager in the settings
- Enter the property name
- Add preset values (you can order them once the property has been created)
Back in a note Right-click on the link
- Click on "Update .... " to change the property's value
- The modal will display a dropdown list with preset values
- Change the value in the modal's dropdown
- Click on the save button to save or click X or
escto cancel
demo: https://youtu.be/GryvvJ6qIg4
Multi select preset values for property
- In the settings, follow the steps 1 to 3 of previous section
- Toggle the
isMultiswitch
Back in a note Right-click on the link
- Click on "Update .... " to change the property's value
- The modal will display a grid of switches for preset values
- Change the values by toggling the switches in the modal
- Click on the save button to save or click X or
escto cancel
demo: https://youtu.be/iyIG6LmCcuc
Cycle through preset values
- In the settings, follow the steps 1 to 3 of previous section
- Toggle the
isCycleswitch
Back in a note Right-click on the link
- Click on " .. > .. " to change the property's value for the next one in the settings list
demo: https://youtu.be/7BqG4sG15jc
Add a new property at section
- Right-click on the link
- Click on "Add field at section"
- Select the line in the target file where you want to insert the new field
- Select the field
- Select/input the value for this field (if the field has preset values, you will be prompted to choose one)
demo: https://youtu.be/JYURK2CM3Es
Manage Authorized / Ignored fields
Disable field options in context menu
In the settings
- toggle "display field option in context menu" If toggled on, the context menu will include field options If toggled off, the context menu wont include field options
demo: https://youtu.be/PC3MC0CfG0E
Ignore fields globally
In the settings
- Add the fields you don't want to see in your context menu, comma separated
demo: https://youtu.be/eFkxECqBvvY
Manage preset values based on the context of a file (fileClass)
Define a class for a file and authorized fields for this class
a class file is basically a simple note the name of the file will be the name of the class the lines of the file will be the fields managed for this class
- Define the folder where you want to store your class files
- Create a note in this folder, let's say
music.md, containing lines with the name of fields that you want to manage for this class
music.md
=========
genre
difficulty
artist
tone- In a regular note, let's say
Black Dog.md, insert a frontmatter field namedfileClass - The value of
fileClasshas to be the name of the file Class where you have the fields that you want to manage for this note. e.g in our case
---
fileClass: music
---- when right-clicking on a link to
Black Dog.md, the fields in the context menu will be filter to show only the ones that are also included inmusic.md
demo: https://youtu.be/Av7DeYZILUk
Define preset values for a class
You can specify the type of an attribute in a fileClass, and its options. Type and Options are called "attributes settings"
Type can be one of:
- "input" (default) : this field can take any value
- "select" : this field can take one value out of a list of items preset in options (see below)
- "multi" : this field can take 0,1 or multiple values out of a list of items preset in options (see below)
- "cycle" : this field can take one value that can "progress" within a list of items preset in options (see below)
Options is an array of options
An attribute settings is written in JSON and must be written as a value of and "inline (dataview) field"
example: Say you want to set "genre" attribute in music.md fileClass as a "multi" with "rock", "pop" and "jazz" as options, and you want to set "difficulty", "artist" and "tone" as fields that can take any value, your music.md will look like this:
music.md
=========
genre:: {"type":"multi", "options":["rock", "pop", "jazz"]}
difficulty
artist
toneNB: "input" type attributes dont need a setting, leaving the name of the attribute only will categorize this attribute automatically as an "input" type.
Because it can be overwhelming to remember this syntax, you can manage "type" and "options" for each fields from:
- the context menu of a note that has this fileClass as a frontmatter's fileClass attribute : click on [
⚙️ Manage <music> fields] formusic.mdfrom any file withfileClass: musicset in frontmatter - the more-options menu of a fileClass file
- a command within a fileClass file (
alt+P)
demo: https://youtu.be/U0Bo_x1B2TM
Roadmap
- manage indented lists multi-values frontmatter property












