Description
Hello.
Thanks for umap, it's really beautiful and useful.
I want to use some url
feature property from my source geojson to add a clickable link in the layout popup.
Unfortunately this url is really long and contains some http
word that seam to break the markdown + pseudo text parser of umap. Could you please tell me how to fix it?
Problem demo here (click on marker to display broken oopup), to reproduce simply import the following feature in a new layer:
{
"type": "Feature",
"properties": {
"color": "#fffe00",
"marker-color": "#fffe00",
"marker-size": "medium",
"marker-symbol": "camera",
"name":"au milieu de nulle part",
"description":"Un bel endroit où commencer votre visite.",
"url": "https://cdn.pannellum.org/2.4/pannellum.htm?config=https://gitcdn.xyz/repo/berteh/nogemerhaff/master/web/tour.json&autoLoad=true&firstScene=nowhere"
},
"geometry": {
"type": "Point",
"coordinates": [
5.851593017578125,
49.79433484385573
]
}
}
and set the popup template for this layer to
# {name}
{description}
[[{url} | Commencez votre visite ici !]]
Since the generated html code is as follows I suspect the template engine is at fault:
<a target="_blank" href="https://cdn.pannellum.org/2.4/pannellum.htm?config=<a target=" _blank"="">https://gitcdn.xyz/repo/berteh/nogemerhaff/master/web/tour.json&autoLoad=true&firstScene=nowhere</a>
Looks like a bad side effect of L.Util.greedyTemplate followed (2 lines below) by a L.Util.toHTML that breaks the target attribute of the link resulting of greedyTemplate
but I don't know how to improve the Util.toHTML to ensure it does not break HTML attributes... As I've always been told regexp cannot parse HTML right. ever.... Is there no good existing JS library to pretty print txt to html that would do the "toHTML" job? or as lightweight JS Markdown library that does not rely on regexp ?
Any hint?
Berteh.