In the span of three days, I wrote and actually finished the fourth iteration of my website, aptly titled...
website v4. Even though this is literally the first finished iteration of it. Ignore the previous iterations from the past two years (and the fact that I lost an iteration due to a hard drive formatting).
Update [26 July 2020]: The status of this has been marked "work in progress" for the longest time. it's not. It's been done for a while now. Even though the compiler is disgusting to look at and I really need to rewrite it.
So, into the technical stuff. What does this do, how does it work, and any other things.
Just a fair warning: I am not very qualified to write about this stuff. And also this is very substanceless. Cool.
The Goal Of It All
How It All Works
- gray-matter - used for parsing the YAML into some usable information
- showdown - actually turning the markdown into an html site.
Now, how does it all work? (Or at least, how is it supposed to?)
First, the script (
main.js) is executed. It proceeds to read the contents of two preset directories,
/projects/md, where the markdown files are stored. After that, for each file in the directory, it:
- Reads the file, and saves the content into a variable.
gray-matterto parse the file, and save the result of that into a variable.
showdownto convert the markdown into HTML
- Appends some extra HTML to the result. This is where the YAML comes in handy - it plugs in variables in certain spots, such as the title, the date, progress (if the file is a project), etc.
- Saves the file to the parent directory (of the
- Somewhere along the line, it would update
index.htmlwith a little entry so people can actually access it.
And that's how it should work. It's actually a lot messier than that. (Don't read the source code, it's a nightmare.)
And that's all! I hope. I'm not coming back to this. Ever.
Until the inevitable re:re:rewrite,