Style Your Markdown Posts With Tailwind CSS in Gridsome [2021 Guide]

June 19, 2020 · Updated January 23, 2021 · 1 min read

Man holds painted mess Photo by Alice Dietrich on Unsplash

This is part four of a series on building a file-based blog from scratch with Gridsome. Find the full series here.

In the last part, we added styling to our Gridsome blog with Tailwind CSS. But we were missing the styling on our blog posts written in Markdown.

Today we're going to add styling to our Markdown blog posts.

How to add Styling to your Markdown in Gridsome

The easiest way to style your markdown posts now is the tailwind typography plugin. Install it with yarn add @tailwindcss/typography.

Next, add this to your tailwind.config.js:

module.exports = {
  theme: {
    // ...
  plugins: [
    // ...

Now just add the prose class in the right place in src/templates/BlogPost.vue:

    <h1 class="text-4xl font-semibold mb-1">{{ $ }}</h1>
    <span class="font-light">{{ $ }}</span>
    <div class="mt-8 mb-16 prose lg:prose-lg xl:prose-xl" v-html="$" />

query Post ($path: String!) {
  post: blogPost (path: $path) {
    date (format: "MMMM D, Y")

export default {
  metaInfo () {
    return {
      title: this.$

The changes to look for are: <style src="../css/markdown.css" /> and <div class="mt-8 mb-16 markdown" v-html="$" />.

Done! Our blog posts are now styled, too: Our Styled Gridsome Blog Post

Next part: hosting Google Fonts yourself

That’s it for this post on styling your Markdown posts in Gridsome with Tailwind CSS. In the next part of this series, we will integrate Google Fonts directly and host them ourselves.