#920·parsedown

Easy way to wrap elements with div

Author: WouterGritterCreated Jun 25, 2025Updated Sep 5, 2025

I'm wondering if it would be possible to add a configuration entry when creating the Parsedown instance, to wrap certain elements inside a div. This was useful for my portfolio site, where I had to wrap all tables Parsedown created inside a div to fix the formatting on mobile (by adding a scrollbar).

I have done this manually by wrapping the element inside a div in a pretty hacky way, but it works: https://github.com/WouterGritter/portfolio-site/commit/e22cbbc48109f9ac51d47e630155749ba2475aa7#diff-8ea035b22bcd614e8049b427a507f57b23e816d9ddd7170c9983f449d8610a34

A more long term solution would be preferable however, as I can see this being useful for other elements as well. I'm looking to render code blocks properly, including a horizontal scrollbar to avoid word wrapping, and I assume this would need a wrapper div too.