Developers
Menu

How names in text link to people, artists and other things, and how to show them.

Some text we return has names in it that link somewhere, like the person who changed an artwork. These are written as <name|link>:

<Jane|https://streetartcities.com/users/123> changed the artist name to <Banksy|https://streetartcities.com/artists/45>

You'll find them in the summary and content of a marker's history. In comments, people mention each other the same way, like <@Kim|https://streetartcities.com/users/678>.

Showing them

If you only need plain text, keep the names and drop the links:

const text = summary.replace(/<([^|>]*)\|[^>]*>/g, "$1");
// Jane changed the artist name to Banksy

To show the links, split the text up. The parts go text, name, link, text, name, link, and so on, always ending with text:

const parts = summary.split(/<([^|>]*)\|([^>]*)>/);
// ["", "Jane", "https://streetartcities.com/users/123", " changed the artist name to ", "Banksy", "https://streetartcities.com/artists/45", ""]
Escape the text

Names and comments are written by people, so escape them before putting them in a web page.