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

iframes not being rendered correctly #2244

Closed
damienh opened this issue Jun 25, 2015 · 8 comments
Closed

iframes not being rendered correctly #2244

damienh opened this issue Jun 25, 2015 · 8 comments

Comments

@damienh
Copy link

damienh commented Jun 25, 2015

We are using Pandoc in our jekyll site and it appears that iframes are being escaped illustrated below.

screen shot 2015-06-24 at 15 02 09

Here is our config file where we use pandoc to convert markdown to html

gems: [ 'jekyll-pandoc-multiple-formats' ]
pandoc:
  output: ./tmp
  flags: '--parse-raw --smart --section-divs'
  outputs:
    markdown: redcarpet

here is the iframe in our markdown file

<div class="scratch-preview">
    <iframe allowtransparency="true" width="485" height="402" src="http://scratch.mit.edu/projects/embed/26818098/?autostart=false" frameborder="0"></iframe>
    <img src="space-final.png">
</div>

If anyone can point me in the right direction it would be very much appreciated.

@nkalvi
Copy link

nkalvi commented Jun 25, 2015

@damienh It looks like the four spaces indentation in front of the <iframe> makes it being treated as code blocks.

@mb21
Copy link
Collaborator

mb21 commented Jun 25, 2015

nkalvi is right, try the following markdown (note that the indentation is less than four spaces):

<div class="scratch-preview">
  <iframe allowtransparency="true" width="485" height="402" src="http://scratch.mit.edu/projects/embed/26818098/?autostart=false" frameborder="0"></iframe>
  ![](space-final.png)
</div>

@nkalvi
Copy link

nkalvi commented Jun 25, 2015

@damienh Depending on your source, you could try -f markdown_strict too.

@jgm Could one turn off just markdown_in_html_blocks in a case like this?
Also, if the indentation is reduced in this case, the <iframe> element it wrapped in a <p><\p> in output. It may not be the desired output.

Extension: markdown_in_html_blocks

Standard markdown allows you to include HTML "blocks": blocks
of HTML between balanced tags that are separated from the surrounding text
with blank lines, and start and end at the left margin. Within
these blocks, everything is interpreted as HTML, not markdown;
so (for example), * does not signify emphasis.

Pandoc behaves this way when the markdown_strict format is used; but
by default, pandoc interprets material between HTML block tags as markdown.

@damienh
Copy link
Author

damienh commented Jun 26, 2015

Hey thanks for this. Just did a test and it renders correctly.

Much appreciated.

Damien

@damienh
Copy link
Author

damienh commented Jun 26, 2015

Also just tried -f markdown_strict as a flag and that works without needing to amend the indentation. Which is a bonus as we have around 300 of these iframes like that.

Cheers @nkalvi

@damienh
Copy link
Author

damienh commented Jun 26, 2015

Though just noticed that breaks these flags :( # Introduction { .intro } so they lose their styling id's

@jgm
Copy link
Owner

jgm commented Jun 26, 2015

You can try:

-f markdown_strict+header_attributes

or turn off what you don't want:

-f markdown-markdown_in_html_blocks

+++ Damien Hogan [Jun 26 15 01:42 ]:

Though just noticed that breaks these flags :( # Introduction { .intro
} so they lose their styling id's


Reply to this email directly or [1]view it on GitHub.

References

  1. iframes not being rendered correctly #2244 (comment)

@nkalvi
Copy link

nkalvi commented Jun 26, 2015

@jgm -f markdown-markdown_in_html_blocks doesn't seem to produce the expected result (I cannot see any change).
-f markdown_strict+header_attributes works as expected with the snippets given here.

@jgm jgm closed this as completed Jun 26, 2015
elipousson added a commit to baltimoreheritage/civil-rights-heritage that referenced this issue Mar 24, 2016
These are not rendering correctly with pandoc. I see others have
encountered this issue so I hope I can fix it sometime in the future
jgm/pandoc#2244
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

4 participants