Skip to content
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

Missing output after link #7

Open
fboes opened this issue Jan 11, 2016 · 2 comments
Open

Missing output after link #7

fboes opened this issue Jan 11, 2016 · 2 comments

Comments

@fboes
Copy link

fboes commented Jan 11, 2016

Consider this document:

Das Spiel "[Firewatch](http://www.firewatchgame.com/)" sieht so ähnlich aus wie das von mir hoch vereehrte "[The Long Dark](http://hinterlandgames.com/the-long-dark/)". Der Trailer macht Appetit.

[plugin:embed](https://www.youtube.com/watch?v=cXWlgP5hZzc)

Wer also noch nicht genug von Abenteuern in der Wildnis hat, sollte _beide_ Titel auf dem Radar behalten.

This leads to all content after the youtube div to be missing:

<div class="list-blog-padding">

            <p>Das Spiel "<a href="http://www.firewatchgame.com/">Firewatch</a>" sieht so ähnlich aus wie das von mir hoch vereehrte "<a href="http://hinterlandgames.com/the-long-dark/">The Long Dark</a>". Der Trailer macht Appetit.</p>
<div style="left: 0px; width: 100%; height: 0px; position: relative; padding-bottom: 56.2493%;"><iframe src="https://www.youtube.com/embed/cXWlgP5hZzc?wmode=transparent&amp;rel=0&amp;autohide=1&amp;showinfo=0&amp;enablejsapi=1" frameborder="0" allowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true" style="top: 0px; left: 0px; width: 100%; height: 100%; position: absolute;"></iframe></div>


        <p class="prev-next" style="padding:1em;text-align:center;">
                                                    <a class="button" href="/grav/posts/moby-dick-forbidden-seas" rel="prev">Vorheriger Post &raquo;</a>
                    </p>

                <p class="meta">
        Andere Artikel zu diesem Thema
                    &middot; <a href="/grav/tag:Spiel" rel="tag">Spiel</a>
                    &middot; <a href="/grav/tag:Outdoor" rel="tag">Outdoor</a>
                    </span>

    </div>

I am using Grav v1.0.5, Embed v1.0.0. Did I do something wrong, or is this a possible bug?

@CherryDT
Copy link

Same problem here with Twitter...

@CherryDT
Copy link

CherryDT commented Jan 10, 2023

I was unable to track down the exact bug, but I noticed these things:

I have tracked it down to the fact that using $e['page']->setRawContent(...) with something containing the embed string below will cause the output to be cut off before the <script> tag but after the </div>:

<div style="max-width: 550px;"><div style="left: 0; width: 100%; height: 0; position: relative; padding-bottom: 100%;"><iframe src="//if-cdn.com/yVhN1XG?app=1" style="top: 0; left: 0; width: 100%; height: 100%; position: absolute; border: 0;" allowfullscreen></iframe></div></div><script async src="//if-cdn.com/embed.js" charset="utf-8"></script>

Observations:

  • It also happens even if I change the <script> and </script> to <div> and </div>!
  • It stops happening if I add anything before and after the code on the same line, such as abc or <span></span>!
  • If I add an extra <div> at the start of the first embed (which never properly closes), all the embeds in the post are suddenly displayed just fine, inside the <div> now.
  • It happens regardless of the "filter dangerous HTML tags" setting in "security".

===

Workaround

In src/service/OEmbedService.php change line 71 to:

$embed = '<div style="display: contents;">' . $response['html'] . '</div>';

===

EDIT: Seems like some bug in the Markdown library. If there is more than one HTML tag in the same line and it starts with a non-inline tag like <div> then after the first tag, the whole rendering process just stops.

Probably this: erusev/parsedown-extra#130

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants