Skip to content

Instantly share code, notes, and snippets.

@mickey-happygolucky
Created October 24, 2016 17:03
Show Gist options
  • Save mickey-happygolucky/72125583050a9b0fe8c23d30134d3534 to your computer and use it in GitHub Desktop.
Save mickey-happygolucky/72125583050a9b0fe8c23d30134d3534 to your computer and use it in GitHub Desktop.
A script that convert to reveal.js from pandoc markdown.
#!/bin/bash
filename=$1
theme=$2
transition=$3
exec_pandoc() {
pandoc ${filename} -s -t revealjs --slide-level=2 --self-contained -o ${filename%.*}.html
}
exec_pandoc_with_theme() {
pandoc ${filename} -s -t revealjs --slide-level=2 --self-contained -o ${filename%.*}.html -V theme:${theme}
}
# none/fade/slide/convex/concave/zoom
exec_pandoc_with_theme_and_transition() {
pandoc ${filename} -s -t revealjs --slide-level=2 --self-contained -o ${filename%.*}.html -V theme:${theme} -V transition=${transition}
}
download_revealjs() {
if [ ! -e ./reveal.js ] ; then
git clone https://github.com/hakimel/reveal.js.git
fi
}
if [ -z ${filename} ] ; then
echo "Please specify a markdown file."
exit
fi
download_revealjs
if [ -z ${theme} ] ; then
echo "execute pandoc"
exec_pandoc
elif [ -z ${transition} ] ; then
echo "execute pandoc with ${theme}"
exec_pandoc_with_theme
else
echo "execute pandoc with ${theme} and ${transition}"
exec_pandoc_with_theme_and_transition
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment