It’s been a long time since I started writing md2pptx. But finally I’ve open sourced it.
A Problem Statement Of Sorts
I wrote md2pptx because I got tired of four things:
- The process of embedding graphics in PowerPoint.
- The fact that pasting a picture into PowerPoint made the resulting presentation file huge.
- The location of a manually added picture on a page is likely to be inconsistent.
- Presentations become a hodge podge of inconsistent text styles.
The last one is really the result of success. Take a presentation of mine like “Parallel Sysplex Performance Topics”. It has evolved over at least 10 years. It probably started out in Open Office and ended up in PowerPoint. I know for a fact that each time I “refurbished” it I introduced styling inconsistencies, particularly if I swiped slides from someone else. “Much Ado About CPU” saw that problem in spades.
It also occurred to me that what today is a presentation might tomorrow need to be a document. Or a presentation guide, which is really both a document and slides. If only I could – from the same source – produce both a presentation and a text document.
How Do I Write Documents?
I don’t often write documents but when I do I abjure Word in favour of Markdown. And this is significant.
I rather like a text-based format and, if you forced me to, I’d write in HTML. Thankfully nobody has forced me to write HTML, though I’m very familiar with it. So Markdown (or rather MultiMarkdown) is the text-based format I have chosen.
I write in a wide variety of applications – across Mac, iPad and iPhone. Precisely which needn’t concern us here. What matters is that a text-based format allows to me to write anywhere – and I wanted to extend that to slides.
md2pptx and python-pptx
A while back I discovered a Python package called python-pptx. You can write programs to drive python-pptx to make PowerPoint presentations. Specifically the XML flavour – with file extension “pptx”. Hence the name. It’s actually quite easy – if you’re reasonably adept at Python – to use python-pptx in a program.
So I wrote such a program called md2pptx. I started writing it a few years ago – and I’ve used it in every engagement since. I’ve also refurbished a number of presentations by converting them to Markdown, extracting the graphics, and rebuilding with md2pptx. As I’ve used md2pptx I’ve enhanced it.
md2pptx takes a subset of MultiMarkdown (a superset of “vanilla” Markdown) and builds the presentation, embedding the graphics as appropriate.
If you know Markdown you know how to write in a way that md2pptx can convert.
Everything you would code for md2pptx is valid Markdown so you can turn it into a document – if you need to.
There are some nice wrinkles, such as the automatic creation of a Table Of Contents slide, turning Taskpaper-formatted tasks into task list slides at the end. Likewise a glossary slide. It even supports Critic Markup format – for reviewing presentations.
How This Fits Into My Life
I built a load of automation around preparing for an engagement. I have a Keyboard Maestro macro that creates a new folder for the study (as a subfolder of the one I use for the customer in question). It then creates subfolders – one for each presentation I’d use in a workshop. Inside these folders it writes a stub Markdown file and a make file.
As I develop the presentation I edit it in BBEdit and – on the command line – type
make to build the presentation. md2pptx runs very fast, always well under a second to build any presentation I’ve ever used it with. This includes embedding graphics.
I also wrote some automation to cause PowerPoint to exit any slideshow, close the presentation, and reload it. This is a piece of AppleScript I suppose I could share.
Open Sourcing md2pptx
Without giving away any commercial secrets, I can say the process of open sourcing in IBM can be quite straightforward: You submit a proposal, covering points such as licensing, expected IBM effort, commercial considerations. In my case I’ve found getting approval quick – because there’s nothing contentious about it.
So md2pptx is on GitHub. You can find it here. As with my other projects, I invite contributions, issues, testing. The only things I would say are:
- Don’t expect it to be a highly robust, full function Markdown parser.
- If you think there is some feature you’d like md2pptx to have consider these two questions:
- How would you express the semantic in Markdown?
- How would you express the feature in PowerPoint?
Anyhow, I hope you enjoy using it – if you do. I know I do – and I’m pleased to share it.