-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Certain code tag content breaks AMP output #9716
Comments
Seems the problem is at
ampHTML if logged, prints the code fine to the console. But when we pass it to the sanitizeHtml function, it breaks. Don't know if we missed something in options passed to the sanitizeHtml . Please correct me if I am wrong. Taking a look at this.
|
@lunaticmonk I think you're on the right track. That's where I saw this glitch happening too. I couldn't find a solution within the |
My guess it is a markdown issue as even the non-amp page adds the end code block in the wrong place. I am taking a look at this as well. |
I was wrong it looks like the mobiledoc issue as this is what gets posted to the server: |
Ok never mind on all of that was using the wrong editor type. Fixed and now looking at the sanitize html code. |
Ok on the hunt farther down as this might be a handlebars issue as the output from everything in amp_content.js is |
Ok this is a bug in express-hbs it uses Javascript string replace which has special string syntax. (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#Specifying_a_string_as_a_parameter) |
Opened an issue in express-hds to solve this issue: TryGhost/express-hbs#144 |
Opened a PR. TryGhost/express-hbs#149 Once it is merged and published in a new version we can open a PR to update the version in this repo. |
The PR was merged! 🎉 |
Still waiting for the permissions to publish the merge and then we can make sure this fixes this issue by testing out the new version here. |
This bug is known and understood, it is expected to be fixed by the update to express-hbs, which has an open PR #10288. Currently waiting on a bug check/fix before merging. |
closes TryGhost#9716 This was caused by a bug in express-hbs, which has more explanation here: TryGhost#9716 (comment)
closes #9716 This was caused by a bug in express-hbs, which has more explanation here: #9716 (comment)
Re-opening because we had to revert the express-hbs bump. See #10643 for further details. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Issue Summary
Adding
'$example$'
to the markdown truncates the AMP output before the second$
causing broken browser rendering through missing closing tags.To Reproduce
'$example
.The HTML output is clearly malformed. the trailing
$'
is removed and the rest of the helper output is added to the bottom of the post with the final section duplicated:This results in the browser injecting lots of extra
<code></code>
tags to try and deal with the malformed HTML.Removing the SafeString call so that handlebars outputs the raw string appears to show that there's a nested async helper issue:
Narrowing the troublesome content down it appears to be caused by a trailing
$
or$'
in any element. This can be demonstrated with simply putting$
as the only markdown content in a post.Technical details:
The text was updated successfully, but these errors were encountered: