-
Notifications
You must be signed in to change notification settings - Fork 176
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
Is it possible to ignore certain part of the slideshow? #208
Comments
Thanks a lot for the kind feedback! The |
Merci Antonin ta prompte réponse. Excluding a slide based on his number is quite touchy, what if I change my slideshow... I'll probably forget to change the "ignored slide number" and thus, no, not so great for my use case. And, more, some slides contains a title + one or two lines of text + an animated gif (it's a DOS console f.i.). When exporting to pdf, it would be great to just ignore the image because right now, the PDF of that slide show a dark screen (the DOS prompt) and not the final result (last frame of the gif f.i.). Animations are a visual support when I'll give the demo, during a conference and only when running the slideshow is his html version. My first thought was to use html comments like this: <!-- screen_only - start -->
![Here is a great animation](./images/demo.gif)
<!-- screen_only - end --> And, thus, ignore everything between the start and end tag during the exportation. If I good understand, such features doens't exists yet. Perhaps one day ;) Many thanks for giving to us, the Open Source community, such amazing software. Have a nice day. |
Your are making very good points. Your understanding is correct, there is currently no such feature. I agree it'd be very useful. I need to think about it more. Let's keep that issue open to hear from other users as well. |
Good morning Because I really need that feature, I've quickly write a Powershell function to do this. Why Powershell? Because I write in markdown, in multiple files and I've already a big set of ps1 scripts that I run each time for merging all my files into a single one, make some processing like replacing custom functions, variables, ... and inject result in the markdown content. I'll then reuse my function more than once; also when outputting my markdown file to DOCX, ODT, PDF (not slides but a real document), ... Here is the Powershell script; perhaps someone will find it usefull and/or give a direction for the js code. # Mode (reveal or pdf)
$global:mode = ""
# Name of the input file, the one that contains the slides
$global:inputFileName = ""
function getContent() {
$slides = Get-Content -Path $global:inputFileName -Raw -Encoding UTF8
$pattern = [regex]$(
"\n\<\!\-\- conditional [\""'](.*)[\""'] \-\- start \-\-\>" +
"([\s\S]*?)" +
"\<\!\-\- conditional [\""'].*[\""'] \-\- end \-\-\>\n"
)
do {
$matches = $pattern.Matches($slides)
if ($matches.Count -gt 0) {
$match = $pattern.Match($slides)
while ($match.Success) {
# Get the condition which is "pdf" in the example below
# <!-- conditional "pdf"-- start -->
$conditionalMode = $match.captures.groups[1].value
$command = [Regex]::Escape($match.Value)
# And now, based on the mode (reveal, pdf) parameter
# specified as argument to this Powershell script, keep
# or remove the block
if ($conditionalMode -eq $global:mode) {
# Get the content in the conditional statement
$contentBlock = $match.captures.groups[2].value
# And keep it
$slides = ($slides -replace "$command", $contentBlock)
}
else {
# Remove the condition and the block since the mode
# isn't the specified one
$slides = ($slides -replace "$command", "")
}
# And get the next one
$match = $match.NextMatch()
}
}
} Until ($matches.Count -eq 0)
return $slides
}
$global:mode = "pdf"
$global:inputFileName = "slides.md"
$slides = getContent
Set-Content "c:\tmp\slides_out.md" -Encoding UTF8 -Value $slides Here the sample on regex101 : https://regex101.com/r/kjOqB9/1 And below the sample. So, when I'll use the Powerschell script given above by setting That way I can run the Powershell function to get a new .md file for my desired output. That new .md will be used with reveal.js and thus decktape will convert the desired one too. # My demo info session
<!-- conditional "reveal" -- start -->
I'm really happy to be here with you today to talk to you.
<!-- conditional "reveal" -- end -->
<!-- conditional "pdf" -- start -->
Below are the slides of the presentation given in Brussels
<!-- conditional "pdf" -- end -->
<!-- conditional "docx" -- start -->
This part will be printed only when exporting to DOCX format...
<!-- conditional "docx" -- end --> Hope this can help someone. Have a nice day. |
Hi all
I'm using dectkape for converting reveaj.js slideshows to PDF and that's really great. It's amazing. Thank you for that 💯
Some of my slides contains animated gifs and my question is the following: did you know if we can tell Decktape (or Puppeteer) to skip portions like part of a slide (keep title, text and not the image) or skip an entire slide (where the background is an animation f.i;)?
Many thanks!
The text was updated successfully, but these errors were encountered: