Skip to content

Instantly share code, notes, and snippets.

View mpechner's full-sized avatar

Michael Pechner mpechner

View GitHub Profile
@mpechner
mpechner / markdown-tables-to-png-hero.py
Created April 23, 2026 03:16
Render Medium preview hero via headless Chrome — companion to 'Markdown Tables Don't Survive Medium Import. Here's a Chrome-Only Fix.' (https://medium.com/@michaelpechner/markdown-tables-dont-survive-medium-import-here-s-a-chrome-only-fix-123092e95330)
#!/usr/bin/env python3
"""Render the Medium preview hero image for the tables-as-images article.
Uses the same headless-Chrome approach the article documents — because
it would be silly to do otherwise.
"""
import os
import subprocess
import tempfile
@mpechner
mpechner / markdown-tables-to-png.py
Created April 23, 2026 03:15
Render Markdown tables as PNGs via headless Chrome — companion to 'Markdown Tables Don't Survive Medium Import. Here's a Chrome-Only Fix.' (https://medium.com/@michaelpechner/markdown-tables-dont-survive-medium-import-here-s-a-chrome-only-fix-123092e95330)
#!/usr/bin/env python3
"""Render markdown tables as PNG images via headless Chrome.
Produces article-ready table images so Medium can import them as figures
instead of rendering markdown tables (which Medium strips on import).
"""
import os
import re
import subprocess