This post outlines my efforts to bring in markdown focused workflow for creating presentations. The tool allows setting up automated workflow leveraging markdown and Reveal.js.
Reveal.js has teased me for many days to Leave powerpoint/impress and try it. I never gave it a serious thought, as my existing setup was working just fine. But as now i have started to use markdown a lot .I realised the need for clean plaintext version of data and capabilities to present it easily and quickly. So i started to read about reveal.js and how to use it.
General reading around reveal.js suggested that people were either writing HTML, directly copy pasting markdown or relying on external tools like pandoc.
So the general use case i observed is as following:
- Write slides in markdown.
- Convert slides from markdown to reveal.js format (using pandoc)
- Place converted index.html and git clone reveal.js in same folder.
- To present launch the html file in browser full screen.
Advantage of this approach:
- Markdown is neutral in nature if written properly
- No need of a server style hosting or running your own python simple server
- If even a word is changed the steps 1 and 2 needs to be repeated.
- Once those changes are done browser needs to be refreshed or reopened.
At this point i saw multiple set of repetitions, so wanted to optimise and automate this approach. This is the point where i identified that reveal.js also supports external markdown syntax (silly me for not reading the README carefully the first time). However it had one caveat, the markdown needs to be served via web server for browsers to pick it up.
This is what led to my current automated setup. In short this one screenshot should showcase how simple it becomes to run presentations using this.
So what i have as my current setup is
- A bash script called “present” (glue for all : the heart/brain)
- Folder where git clone of reveal.js is placed
- Customised index.html with placeholder text
So after doing this one time effort this is how my setup looks like.
- Write markdown in any arbitrary location.
- “present setup” (if md file name is anything other then presentation.md then specify it) : This still looks like how we do pandoc however the additional commands is where the beauty of the script lies in.
- “present” : This is one command which performs following operations
- Start a python simpleHTTP server
- Based on the predefined browser path, start a browser (chrome / chromium) with url of index file in it.
- “present print” : This performs similar steps (start webserver and lauch browser) but it also appends “?print-pdf” in the url which informs reveal.js to present slides in printable format.
- “present clean” : This will clean all the additional resource i.e. index.html and reveal.js
This setup allows me to continue working on markdown file and all i need to do is change file in markdown save and go back to browser refresh page to get the output reflected.
Once presentation is done and you close the browser then it automatically kills the python server that was started. (and hence not leaving stale bits.)
The fourth command : “present print” was added to ensure we are able to quickly create distributable copies of the presentation.
So without further ado here is the script
[github userid=”anantshri” repoid=”automated_revealjs” path=”present” language=”bash”]
The project is available at github
I have uploaded the whole script over at github so that it can be used by others and can be overall improved. Feel free to fork it ,hack it and customise it to your satisfaction. (If you think the setup might help others feel free to share it across)