XRay
XRay copied to clipboard
How to remove the img tag from `p-content`
trafficstars
Part of #52.
When the original HTML uses p-content that contains a u-photo inside, the mf2 parser strips out the HTML completely, returning a plaintext string for content that doesn't contain an img tag at all. XRay has no way to remove the image from the content.
HTML
<html>
<head>
<title>Test</title>
</head>
<body class="h-entry">
<p class="p-content p-name">This is a photo post with an <code>img</code> tag inside the content. <img class="u-photo" src="http://target.example.com/photo.jpg"></p>
</body>
</html>
mf2 json
{
"type": [
"h-entry"
],
"properties": {
"content": [
"This is a photo post with an img tag inside the content. http://target.example.com/photo.jpg"
],
"name": [
"This is a photo post with an img tag inside the content. http://target.example.com/photo.jpg"
],
"photo": [
"http://target.example.com/photo.jpg"
]
}
}
https://pin13.net/mf2/?id=20180112195016745
I have no idea what the correct thing to do here is. Any ideas @tantek?