XRay icon indicating copy to clipboard operation
XRay copied to clipboard

How to remove the img tag from `p-content`

Open aaronpk opened this issue 7 years ago • 1 comments
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

aaronpk avatar Jan 12 '18 19:01 aaronpk

I have no idea what the correct thing to do here is. Any ideas @tantek?

aaronpk avatar Jan 12 '18 20:01 aaronpk