-
-
Notifications
You must be signed in to change notification settings - Fork 32
Clean up description via HTML escape #120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean up description via HTML escape #120
Conversation
As the description is taken from the raw text of the document it can contain some HTML reserved characters. This change will escape the description string to use HTML entities instead.
I wonder what users of og:desc do. Like how slack and discord embeds display the escaped version. It should be fine but just wanna check. |
Thanks @TheTripleV for looking into the PR. I created a quick reproduction of the issue via this repo in case you wanted to look at it yourself. |
I want to remove all opengraph meta tag from ePub. |
Apparently
I've uploaded following file to a server: <!doctype html>
<html lang="en">
<head>
<title>test</title>
<meta name="robots" content="noindex">
<meta property="og:description" content="Rob & Bob <[email protected]> wrote: 'Please replace "Hi" with "Hello"'" />
</head>
</html> Both https://opengraph.dev and https://opengraph.xyz render them correctly, with rendered HTML entities. Facebook debugger was unable to fetch the data in reasonable time. LinkedIn post inspector render the entities correctly in the properties (the card preview doesn't load description content, so no preview screenshot). ![]() Also a message shared on Discord loaded rendered entities (previous version of it, with only On Slack my links didn't convert to a preview. I can share the URL I used with anyone interested, privately. I believe this PR should fix the EPUB rendering issue. |
# Conflicts: # sphinxext/opengraph/_description_parser.py # tests/test_options.py
As the description is taken from the raw text of the document it can contain some HTML reserved characters. This change will escape the description string to use HTML entities instead.
This was causing an error when generating a sphinx EPUB document.