Show HN: Md2blog – A zero-config static site generator for dev blogs
jaredkrinke.github.io
jaredkrinke.github.io
This program is written in TypeScript, a browser-incompatible dialect of JS that is nonetheless regularly compiled to standard JS, e.g. to transform a given module into a form that can run in the browser—and yet md2blog itself doesn't. You are expected to either download an out-of-band, platform-specific binary or use Deno to run it.
Instead, one should be able to use md2blog and similar programs by using the browser itself to open and run the program, considering it's the universal platform that everyone already has, and it's reasonable to expect that you're going to use it at some point in the pipeline, anyway (e.g. for proofing your work).
Even better quick start instructions would look something like this:
0. Start with a directory that contains the site sources that you intend to publish.
1. Save a copy of "md2blog.html" there, too (or anywhere, really).
2. Open the md2blog program in your browser by double clicking md2blog.html.
3. Drag and drop the directory with your Markdown sources (same one from steps 0 and 1) into the newly opened md2blog tab.
(For good measure, a copy of these quick start instructions would be shown when you open md2blog.html.)
My workflow is that I write my posts in VS Code, and then if I want to preview or upload, I just hop over to the console and type a command (no mouse needed). Deno's built-in sand boxing is the most convenient command line alternative to browser-based apps that I'm aware of.
Edit to add: I have toyed with the idea of integrating VS Code's Monaco editor into a "dev blog in your browser" type of app, but (the last time I checked) durable storage for web app data wasn't reliable (it was more intended to be a cache). Maybe things have changed.
I can see you're offering self-contained prebuilt single-file binary releases. From my perspective those are a fine way to address the user request of "I want it to be easy to install without needing to first install and configure n other tools". That's one thing that I reckon hugo got right.
Out of curiosity I downloaded a linux binary md2blog release, and apart from needing to unzip and `chmod +x` it, it ran fine without dependencies -- i don't have any tooling related to deno or typescript installed locally.
Are you using `deno compile` [1] to build these self-contained release binaries?
Why not both? It doesn't need to be mutually exclusive; write md2blog.html so it can run either from the command-line or be opened in the browser—whichever is preferable (easiest) at the time.
I don't understand your comment about durable storage. If you have a directory of Markdown files on your disk, that's already durable storage. I'm just talking about tweaking the development approach so the site generator's business logic can run using the browser process's JS runtime that's almost definitely already in memory. md2blog.html would be written to accept the same directory that the current incarnation reads; use ordinary file APIs—the input element or drag and drop. "Web app data" (I think you're talking about localStorage?) would only seem to come in after starting to expand the scope of the tool and is a separate matter.
On the other hand, if I wanted to ship something similar with a built-in editing experience, then I think running it in the browser would be the way to go. The problem I saw there (last time I checked) was that I couldn't write directories of files to the file system from a web page (and I definitely want to store everything in the file system).
You mean to an arbitrary path—why would this be necessary? The only write operation that most static site generators make use of is putting exactly one file tree somewhere after processing the input. The same thing is achieved by the browser's native Save File handling. If it were running in the browser, you'd generate a ZIP containing that file tree.
I do like the idea in other contexts, just not here.
> To build and test the site locally (with automatic reloading), run:
> md2blog --clean --serve
> And open a browser to the "localhost" URL that is written to the console. You can kill the server with Ctrl+C.
as described in https://jaredkrinke.github.io/md2blog/quick-start.html
> Perhaps your use case is already supported in a different way
It wasn't a support request.
I've tried and went into a different direction and created a desktop app [1] for creating a basic website. Yes it's electron and yes it currently only uploads to Vercel for hosting. But those are things my dad does not care about. I can send him a pre-configured "project" file, so he does not even have to enter any API keys.
EDIT: I've re-read this and this sounds like I'm ranting on your project. Not my intention, I love the bloat free sites md2blog generates. Keep it up!
> FAQ (e.g. themes, command line options, support)
Just saying.
In the long term I suspect Md2blog will evolve to be little different to Jekyll.
Not to detract from Md2blog, I just want to add it to the converstaion for anyone interested in these things :) Keep up!
It certainly sounds very similar!
Edit: Found this link on the Markblog docs: https://olaven.org/
Edit again: I like that you appear to have an automated approach to deploying to GitHub Pages.
Thank you!
Might be a useful FAQ entry.
The "keywords" tag includes both the post's category (derived from the parent directory name), as well as any keywords specified in YAML front matter.
I don't use Twitter/Facebook, so I wasn't aware of Open Graph. That might be worth looking into. I'm familiar with the concept, but didn't realize there was a standard.
Google have also said in the past, they don't use the 'keywords' meta tag for SEO anymore, due the abuse it gets.
Support an optional “footer” argument in ‘site.json’. Useful for copyright, social links, ??
Also thinking about hosting a static blog and don't know what ssg from md to choose.
But I found Hugo’s template language to have the most unusual/unintuitive template language of any SSG I tried.
In the end, it comes down to personal preference:
Are you going to build your own templates or use a canned theme? If DIY, make sure you like the template language, otherwise make sure you can find a theme you like. This ruled out Hugo for me because I didn’t like the template language.
Do you think you’ll need to write code to perfect your workflow? If so, use one in a language you’re familiar with. Otherwise, just make sure you can tolerate the install/setup process. This ruled out Jekyll/Pelican for me.
If you’re using an SSG with a plug-in architecture, what’s the security model and are you comfortable with it? Security concerns around huge dependency trees pushed me away from Metalsmith.
Going to give this a try!
I built it for my own needs, but I’d like to know if anyone else finds it useful. Thanks!
Left a GitHub issue with the precompiled binary install. But it might be my fault.
The closest thing to this in terms of out of the box simplicity is probably Material theme for MkDocs [1], which has other features, but no official blog support.
I was very excited to find Thomas Weise had wrangled latex and a Tex Live installation into a docker container: https://github.com/thomasWeise/docker-texlive-thin
Another useful tool is latexmk, which is already installed inside the docker-texlive-thin container : https://mg.readthedocs.io/latexmk.html
By containing the madness of latex tooling and package management with docker and some volume mounts, I could have a reasonably sane build process to manufacture PDFs from latex source files.
I don't recommend md2blog add mandatory dependencies on anything related to latex. Another way to think about it might be offering optional latex support through some md2blog plugin mechanism that doesn't know anything about latex. But that path sure won't produce anything resembling a "zero config" static site generator! Might end up with something closer to apache httpd.
If so, that might be something I could look into. Version 1 of md2blog actually did almost exactly that for Graphviz diagrams (but I removed that feature because, frankly, I didn't understand the Graphviz license). A quick look indicates that Latex also has its own unique license that is... quite lengthy.