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

Unable to create stretch images in revealjs slides #1291

Closed
cwu opened this issue May 11, 2014 · 8 comments
Closed

Unable to create stretch images in revealjs slides #1291

cwu opened this issue May 11, 2014 · 8 comments

Comments

@cwu
Copy link

cwu commented May 11, 2014

Using pandoc to create revealjs slides from markdown, there doesn't seem to be a way to create <img class="stretch"/> outputs which are necessary to include images that stretch to fit the window.

I've tried

% Some Slides

# Title
<img class="stretch" src="http://upload.wikimedia.org/wikipedia/commons/4/4e/Pleiades_large.jpg">\

However this wraps the img tag in a p tag but revealjs requires strech elements to be direct descendants of the

tag.

Don't know if this is in the scope of pandoc but since it aims to support reveal.js, I just wanted to bring it up

@mpickering
Copy link
Collaborator

See #261

@Quintasan
Copy link

This change partly solves the problem. You can now add the stretch class to the image but the image itself is wrapped between <p></p> which renders the whole thing useless in this case. For example:

pandoc -f markdown -t revealjs
## Header
![Image](images/test.jpg){.stretch}\

yields

<section id="header" class="slide level2">
<h1>Header</h1>
<p><img src="images/test.jpg" alt="Image" class="stretch" /> </p>
</section>

@jgm
Copy link
Owner

jgm commented Feb 19, 2016

One approach would be to use -f markdown-markdown_in_html_blocks-native_divs and then include this raw HTML:

<div>
<img class="stretch" ... />
</div>

@Quintasan
Copy link

@jgm Unless I'm doing it wrong then it won't work because

pandoc -f markdown-markdown_in_html_blocks-native_divs -t revealjs
## Header
<div>
<img class="stretch" src="images/test.jpg" />
</div>

yields

<section id="header" class="slide level2">
<h1>Header</h1>
<div>
<img class="stretch" src="images/test.jpg" />
</div>
</section>

@jgm
Copy link
Owner

jgm commented Feb 19, 2016

Yes, that's what I thought it would yield. Sorry, I don't
know how stretch works. What is wrong with this output?

+++ Micha? Zaj?c [Feb 19 16 09:49 ]:

[1]@jgm Unless I'm doing it wrong then it won't work because
pandoc -f markdown-markdown_in_html_blocks-native_divs -t revealjs

Header

yields

Header


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

References

  1. https://github.com/jgm
  2. Unable to create stretch images in revealjs slides #1291 (comment)

@Quintasan
Copy link

@jgm I am not 100% sure but for stretch to work the image has be direct descendant of section.slide. So in order to get it working the slide should look like this.

<section id="header" class="slide level2">
<h1>Header</h1>
<img src="images/test.jpg" alt="Image" class="stretch" />
</section>

@jgm
Copy link
Owner

jgm commented Feb 19, 2016

I see. Then for now maybe your best workaround is to add a bit
a javascript that runs before reveal.js and moves img
tags with stretch out of enclosing paragraphs.

+++ Micha? Zaj?c [Feb 19 16 09:57 ]:

[1]@jgm I am not 100% sure but for stretch to work the image has be
direct descendant of section.slide. So in order to get it working the
slide should look like this.

Header

Image


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

References

  1. https://github.com/jgm
  2. Unable to create stretch images in revealjs slides #1291 (comment)

@Quintasan
Copy link

Quite unfortunate but I'll do it like that then. Thanks.

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

No branches or pull requests

5 participants