@-mention support for “People” (identities)

Sorry, I started a new job and haven’t had time to contribute to anything. I’ll be sure to come back and share if I do wind up with time.

Just wanted to share a workaround I’ve been using, https://github.com/mdelobelle/obsidian_supercharged_links. I use it to make any note with the tag #person to show up as a different color so that they’re easily noticeable in my notes (this works in live preview/edit mode as well). You can also use it add content before/after links as part of the style, e.g. add a person emoji etc.

1 Like

I’m using Supercharged Links very similar and its meeting my need for @-mentions pretty well. And for other common types as well (dates, recurring meeting notes, etc). The icons in the autocomplete, dataview results, etc also really help. Example:
Screen Shot 2022-02-17 at 11.27.21 PM

It doesn’t solve the autocomplete of only people, but it does make them feel different from other notes.

1 Like

What is the icon you’re using for people? I like that better than mine.

It’s circle user from FontAwesome.

I have the FontAwesome font loaded in to my font stack and installed on all devices, so I just use the font glyph rather than an image.

1 Like

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

oEsTAY6

When I want to mention someone I use the hotkey Alt+2 (the @ key) which launches the Templater script, I start typing the name of the person and press Enter, and the script will automatically insert the link to that page. Super super fast.

The people in the suggester popup are simply notes inside a People folder. 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.

Update:

I have since changed this to use the :bust_in_silhouette: character rather than the @, so now instead of a @John note, I have a 👤John note. Everything still works the same. Please note, this isn’t an icon or a special font, it’s an emoji character - you can just copy and paste it, and it also works perfectly well in filenames. (Copy this one: 👤)

In a note it looks like this:

image

And here it is in Windows Explorer - no issues putting it in a file name:

image

Here’s the 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}]] ` : ''
%>

If you also have Dataview installed you can use this template instead, which sorts the people from most mentioned to least mentioned to make it easy to visually spot your most-referenced people. It also strips the @ or 👤 character before displaying the list, so that you only see names.

<%* 
// Get the list of people
const people = app.plugins.plugins.dataview.api.pages('"People"')
  .sort(x => x.file.inlinks.length, 'desc')
  .file.name

// Pop the suggester
const person = await tp.system.suggester(people.map(x => x.replace(/^\W+/, '')), people)

return person ? `[[${person}]] ` : ''
%>
11 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

1 Like

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:

1 Like

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.

1 Like

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.

This is neat work, @cwhiii ! But the 10% that’s missing is pretty key for my interests: using @-syntax instead of [[wiki link style]]. The appeal for me is to make content cross-publish compatible and cross-platform familiar, and most of the digital world understands and actively uses @ as the system for addressing people.

I’m building something that combines Obsidian with a social platform so that people can interplay with one another while using Obsidian for their own little “nook” on the platform (profile+more), and to make it truly social it’ll have to support @ for people. It may just become part of the platform-specific Obsidian plugin, in the end.

This alt-@ shortcut is cool. I type 6 keys for the same result: “[[ppl/”, then another 2 to finish “]]”