Use markdown in html

I mostly use markdown as my to-go formatting, and I need to display my markdown on my website. I want to be able to edit the markdown easily, so I don’t want to use a markdown-html converter, then copy/paste the output into my html file. Is there a more dynamic way of doing this, wherein I don’t need to keep converting my markdown to html?

Yes, good thought, this is basically what static site generators like 11ty do for you.

I know they can seem a bit daunting but an SSG is basically an automatic script to turn your MD files into a static site.

Take a look at (and remix) the Glitch eleventy starter

Once you’re in your project, change the MD in the index.md or about.md files:

image

You can strip this site down to make it less complicated and change the style to how you want it.

It’s set up to use different “layouts” (basic HTML template) for each type of page, but you don’t have to do that! You can make one layout to rule them all (such as page.njk) and have every page use that.

The layouts are written in “nunjucks” (hence njk) but other options are available, and you don’t have to use the nunjucks syntax really, it’s just for doing dynamic things.

And because these sites are supported on Glitch now as “Generated Static Sites” you still get the benefits of Static Site hosting.

Hope it helps!

3 Likes

Woah this totally helps! It’s exactly what I’m looking for. It might be a little complicated at first, but I’ll try to learn it. Thanks!

2 Likes