Chris Hua

“Data” “Scientist”

Python-Markdown Bootstrap Styling Extension

2017-12-30


I wrote a small extension for the Python-Markdown library which adds Bootstrap 4.0 styling to images and tables generated by the generator, available on GitHub.

Call this extension towards the end of your extension stack; it simply adds class='img-fluid' to <img> tags and class='table table-striped' to <table> tags. This extension probably isn’t life-changing and it is probably also under-tested (in particular, there is no support for Python 2.7 which I don’t use and don’t intend to support). However, it goes a long way towards making images and tables behave nicely in sites using Bootstrap + Python-Markdown, both by respecting responsive layouts and by just looking nicer.