Powerpoint to Markdown converter - Python 3 script
NOTE: This works on .pptx files ONLY - if you're using Google Drive or Keynote etc., export your presentation to .pptx first.
What does it do:
Takes a PowerPoint file and a PDF of the same file (generated from the same application) and generates a Markdown version in a directory with an image for each slide and a yaml metadata block as used by various static site generators.
This is for people who know how to run Python or Docker. Instructions are for MacOS. The examples below show the uv runner (replace with python/python3 if you prefer).
This is a simple rough and ready way to turn a Powerpoint slide deck into Markdown.
This project no longer requires Poetry. Use the uv runner to execute the script directly.
For uv installation, see https://docs.astral.sh/uv/.
- Get the code:
git clone https://github.com/ptsefton/pptx_to_md.git
cd pptx_to_mduv run pptx2md.py your-preso.pptx
Try the tool with the included test file:
# Basic usage - creates a directory called 'test-preso' with index.md and SVG images
uv run pptx2md.py test_files/test-preso.pptxThe result is a directory test-files/test-preso/ with an index.md file in it.
# Specify custom output directory and generate and index.html file
uv run pptx2md.py -d out --html test_files/test-preso.pptxCustom output directory:
# Specify where to write the output
uv run pptx2md.py -d /path/to/output your-preso.pptxGenerate HTML:
# Create both index.md and index.html
uv run pptx2md.py --html your-preso.pptxImage path prefix:
# Add a prefix to image paths (useful for Pelican or other CMS)
uv run pptx2md.py -i {attach} your-preso.pptxCombine options:
uv run pptx2md.py -d output --html -i /images/ your-preso.pptxThe script WILL NOT create images for the slides (but see below the experimental part) - for that you need a PDF file. The best way to get a PDF is to manually create it from the application you used to make the .pptx file, usually Microsoft Word or Google Slides. If you have a PDF file with the same name as the .pptx with a .pdf extension run:
uv run pptx2md.py your-preso.pptx
If you're using Pelican or another CMS that needs it, you can also add a prefix to the image paths use the -i flag:
uv run pptx2md.py -i {attach} your-preso.pptx
If you would like to try your luck at getting Libre/Open Office to generate the PDF for you, you can do this:
# On a mac with LibreOffice installed
uv run pptx2md.py --soffice /Applications/LibreOffice.app/Contents/MacOS/soffice --topdf preso.pptx
# On linux or where soffice is in your path
uv run pptx2md.py --topdf preso.pptxBuild the container (this image installs uv and the Python dependencies):
docker build -t pptx2md .Run the container (mount current directory as /data):
docker run --rm -v "${PWD}":/data pptx2md yourfile.pptx