Skip to content

Instantly share code, notes, and snippets.

@ritalin
Created September 12, 2013 09:28
Show Gist options
  • Save ritalin/6534954 to your computer and use it in GitHub Desktop.
Save ritalin/6534954 to your computer and use it in GitHub Desktop.
PowerShell script for converting Reveal.js output by pandoc
# usage: <source-path> | md2reveal [-block <script-block>]
[CmdletBinding()]
param(
[parameter(Mandatory=$true, ValueFromPipeline=$true)]
[ValidateNotNullOrEmpty()]
[string]$source,
[scriptblock]$block
)
if ($block -eq $null) {
$block = { $_ | out-file -encoding utf8 ([IO.Path]::ChangeExtension($source, 'html')) | out-null }
}
$file = Split-Path $myInvocation.MyCommand.path
$output = pandoc --section-divs -t html5 -s --template $file\templates\reveal.js\template-revealjs.html $source
(,$output) | %{ &$block }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment