DigitalCommons / mykomap-monolith

A web application for mapping initiatives in the Solidarity Economy
0 stars 0 forks source link

[CWM] Strip/render tags/html from popup descriptions #69

Open lin-d-hop opened 1 day ago

lin-d-hop commented 1 day ago

Description

Many of the descriptions have html tags in them. They contain a mix of special characters, line breaks and paragraph tags mostly.

I need more info to spec this issue well. My initial thoughts are:

&...; tend to be special characters like Õ or   <...> tend to be

but may also include which is more relevant.

One to chat through if we get to it in time so that we can choose the right approach balancing time and impact.

Acceptance Criteria

  • [ ] TBC
rogup commented 21 hours ago

I'll do a basic strip of tags using a regex replace: string.replace(/<[^<>]+(>)/g, "")

and use https://www.npmjs.com/package/html-entities to decode entities

Maybe best to eventually do this in the data pipeline but I'll just add it to the front-end for now

rogup commented 21 hours ago
wu-lee commented 2 hours ago

The way that the old Mykomap did this was to insert the text raw into the pop-up.

This isn't ideal if you don't trust the HTML, which we probably shouldn't, but it strikes me as the easiest most reliable route to seeing what we used to. Somewhat moot point now, however, if it's been done and merged already.

Later we should decide what we want the descriptions to be, and make sure the data has that - e.g. sanitised HTML