ATProto Browser

ATProto Browser

Experimental browser for the Atmosphere

Record data

{
  "uri": "at://did:plc:5rms2ebhdngu24hgsu3s2hqd/com.whtwnd.blog.entry/3ldrnonegm32h",
  "cid": "bafyreigdkfspsgvw6k4wh2psq3pu3xt4vpq7xqqvkwkfyngl564y6ynnle",
  "value": {
    "$type": "com.whtwnd.blog.entry",
    "theme": "github-light",
    "title": "I wish people would stop trying to reinvent the wheel except square this time... ",
    "content": "Okay so this could've just been a thread on Bluesky but I hate making threads so y'all get a post instead. Because why not. Fight me. This post does call out a particular module (and then by extension it's author), but they kind of have it coming.\n\n## Adventures in Markdown parsing\n\nSo for a project I'm working on I decided that instead of typing HTML for all my text content I'd just type Markdown. Because, again, why not? It's convenient, portable, and I'm pretty sure someone in the Perl ecosystem has written a parser for it already. \n\nAnd for sure, MetaCPAN shows a fair number of Markdown related modules. Some of these are part of other larger modules though and chipping them out (and maybe getting them to work) seemed weird. But then...\n\n### Enter `Markdown::Parser`\n\nSo I saw this. Since most parsing modules follow this naming scheme (`HTML::Parser`, `XML::Parser`, need I go on?) I figured alright, cool we'll just use that. And then it blew my mind because it pulled in a few dependencies, by the same author. \n\n#### `Module::Generic`... what the fuck is this thing smoking?\n\nSo this is the first of a few God-class type things. It's a module. A generic module. That has, itself, a stupid amount of dependencies because I've always wanted to be able to require a module that not only handles JSON serialization but also does terminal color output, HTTP, and a variety of other things because **of course** this makes perfect sense! God forbid you'd ever want to step away from using the `JSON` module and want to use `JSON::XS` (because faster) instead, nope, you get the god object. \n\nWhich of course fails to build on the CI/CD pipeline because *color tests require a fucking terminal with color support and a pseudo-TTY doesn't have that*. \n\n#### `Promise::Me` also makes an apperance... \n\nThere's a perfectly fine Promise module in my web framework of choice, so why do I need this? I don't know. But apparently it's a requirement for Module::Generic. Which is a requirement for a Markdown parser. Which in my mind makes no sense. Also it implements promises using fork. Yeah. \n\n### But that's not even the worst of it \n\nSo I have a file of markdown content. Let's say this particular blog post in it's raw format. \n\nIt takes **over 6 seconds** to parse the Markdown and spit out HTML. I've actually used this on a privacy policy document (they're wordy AF), and that sat there for **20+ seconds** before it generated anything. \n\nAnd then, instead of just going \"markdown goes in, HTML comes out\", no, no of course the HTML needs to be properly wrapped with a `<html><head><body>` section because **obviously** I'm not going to use that Markdown somewhere else, noooo that'd be too simple. \n\n### So then you look again and find `CommonMark`\n\n`CommonMark` is just a set of bindings on the C `libcmark` library. It has a lot of additional functionality if you really want to mess with parse trees and other such things, but the method I'm interested in is simply `markdown_to_html` - you feed it Markdown, and HTML comes out! Without any additional bits added.\n\nAnd it's fast. That privacy policy document took under a second to generate. \n\nSo why didn't I use that right from the start? Well, the module naming wasn't entirely obvious, and it showed up low down in the search results. But that's something I can't change. \n\n## The point of this rant\n\nSo. A long story short: I fucking hate it when people reinvent a perfectly fine wheel, and then decide it needs to be square. I especially hate God-objects that will do everything including brewing coffee. And it annoys the everloving piss out of me that people still seem to think following `systemd`'s trend of \"everything must be reinvented here\" is a *brilliant* idea. \n\nAnd I guess the point is I just wanted to rant. \n\nRant over. For now.",
    "createdAt": "2024-12-21T00:46:22.957Z",
    "visibility": "public"
  }
}