Comment by cxr
4 years ago
> I think a command line tool is better
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.
The simple answer to "why not run this in a web page?" is that I built this tool based on my own needs and I never had any need to run a file system-based tool in my browser.
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).
> The problem I saw there (last time I checked) was that I couldn't write directories of files to 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.
If your website is only text, you could have it as a single HTML file, so “Save As…” would be enough to export it. A working example: https://cadars.github.io/portable-php
Saving a single zip file would work, thanks. But it still seems like a cumbersome workflow in this case because you’d have to unzip to view/upload the site.
I do like the idea in other contexts, just not here.
Perhaps your use case is already supported in a different way, by downloading a single self-contained binary md2blog release, and then
> 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
How does that sound like it might be similar? I'm very confused how someone could think this is at all like what I described. To say "not even close" would be an understatement. It's the exact opposite in every way.
> Perhaps your use case is already supported in a different way
It wasn't a support request.