@-mention support for “People” (identities)

If it helps anyone else, I made a quick Templater script to solve the @-mention issue for me.

I have a People folder with a note for each person I reference. In the gif above you can see that I have prefixed my people with the ‘@’ symbol, but you do not need to do that. No symbol is needed, it just works off the names of the notes.

When I want to mention someone I use the hotkey Alt+2 (the @ key) which inserts this Templater template:

<%* 
// Get the list of people
const folder = 'People'
const people = this.app.vault.getFiles().filter(f => f.path.startsWith(folder)).map(f => f.basename)

// Pop the suggester
const person = await tp.system.suggester(people, people)

return person ? `[[${person}]] ` : ''
%>

When you press Alt+2, a suggester list pops up on the screen, you just start typing the name of the person and press Enter, and the script will automatically insert the link to that page. Super super fast.

If you don’t like filling in a specific note for a person, then I recommend to use a Dataview that automatically shows all the linked pages for that person. That way the person page will be useful in that it lets you immediately browse out to all other mentions of that person.

5 Likes

I’m very sad, but I agree with you :D.

I don’t seem to be able to add the glyph to the settings. I have Font Awesome 5 OTF installed but when I copy the glyph and paste it into Obsidian I get an icon with five or so vertically stacked lines.
Would you mind explaining a bit more which steps you took to install the font and copy the glyph? Thanks!

it would be great if this could interface with Wikidata in some way too Wikidata

If you’re just looking for any icon (rather than that specific one), you could use the unicode person silhouette symbol: :bust_in_silhouette:

It works fine in Windows and Mac filesystems, and is allowed as part of your note name.

So rather than a @John note, you could have a 👤John note.

No special fonts needed, just copy and paste the symbol from this comment.

Thats a good solution too and definitely more portable. Btw I like the Templater solution you posted, thats almost exactly what I need. Now I just want to be able to “@” people OR dates (as in nldates), the way you can in Notion or google docs

@janpeeters you need to both install the font in your OS, and tell Obsidian to use the font for rendering. You’ll want to add it to your font list, but after your desired primary font, that way it only uses Font Awesome font for characters it can’t find in the primary font.

For example my font list is “system-ui”, then “Font Awesome 5 Free Regular”, then “Font Awesome 5 Brands Regular”

If you only want this for the supercharged links application there is probably some clever CSS to just use the svg for those icons. I have the font installed because I like to use the font awesome icons throughout my notes.

Ooh that’s a great plugin, thanks for linking it. I might fork it and add the people aspect.

Your post inspired me to go see how close to this I can get with currently-exiting plugins. I got 90% of the way there using a combination of Supercharged Links with Style Settings plus Dataview.

This:

[[Sally Smith]]'s husband is: `= [[Sally Smith]].Spouse`. 
Her children are `= [[Sally Smith]].Children`. 
She lives in `=[[Sally Smith]].Location`, and works at `=[[Sally Smith]].Organization`.`.

Renders like this:


This method actually works really well, except for the fact that it only renders correctly in Read Mode (or, oddly enough, when the content is inside a callout). More details on how I did this can be found in this post, where I am looking for help to resolve the rendering issue in Edit/Live Preview mode:

Thanks @AlanG And @ryanc. I didn’t realize that adding a font to your font stack meant adding in it the Obsidian font list. And keeping it portable is also an excellent idea.
I do like the circular person a lot though because it blends nicely with the typeface I use, so I will have to weigh both possibilities.

Update: @AlanG I just tested for portability but when I open a note in e.g. Panda or another .md editor I don’t see the icons in the links. Can you explain a bit more how using a custom font instead of emoticons would be less portable?

A custom font requires you to save and deploy the font everywhere you want to use it.

The person emoji above is just a normal “letter” - it’s Unicode character U+1F464. The letter ‘A’ is Unicode character U+0041.

An emoji character is stored with the document even if the particular font/app (Panda for example) won’t display it. The emoji character is still stored in the .md file and will display on any system which does support the Unicode emoji characters.

Thanks for the explanation. You’re right, it’s indeed not portable to have to install the font.

But regarding the showing up as a Unicode character, it looks like no data is added in the file.
When I create a .md file with a supercharged link like this:

It looks like this in the file tree:

20220926 Obsidian A testperson - Notes - Obsidian v0.16.3@2x

And when I open the file in TextEdit or BBEdit in plaintext. I don’t see any code.
The ‘A’ before Testperson is for sorting purposes because I wanted to avoid publishing the name of real people.

Maybe you can check what you see in a file with a custom font icon?

Could be that the plugin just does some smart trickery in the background and adds it as a ::before or ::after with CSS when parsing the note in Obsidian.

You might be misunderstanding my post. I don’t use supercharged links, I’m saying you can put the actual emoji character into the note title / link text.

Literally call your note 👤A testperson and link to it with [[👤A testperson]].

Ah okay, thanks for that clarification.