Front-End Markdown Gallery Script

14 Mar, 2016 | DownloadsTechVfd

When I converted one of my sites from WordPress to static, I lost some things. One of those was the ability to easily generate a gallery of images; thumbnails that link to larger versions.

Markdown, which is what my posts are now written in, is great for writing without the overhead of a having to wrap everything in raw HTML or stop to select icons in a WYSIWYG, but it also lacks the ability to generate the code for a simple gallery. So my only option would have been to write HTML in the middle of the text.

Instead, I whipped up a bit of JavaScript to scan the page for lists that consist solely of images (linked or not) and adds HTML to make it easy to style them into a gallery (for example, wrapping the list in a div tag and converting the list items into figures and figcaptions).

You can find an example in this post.

More details and the script itself can be found on Github.