James Robert Huggins Ngo

Dark Matter: Front Matter for Every File

Front matter is a great way to embed metadata in files — but it only works in Markdown with the right rendering software. That leaves HTML, CSS, JavaScript, and a whole bunch of other formats out in the cold.

My solution is what I call Dark Matter — front matter, but using comments as delimiters. Whether it’s an HTML comment, a C-style block comment, or a Perl inline comment, the metadata hides in plain sight. Since comments are ignored by renderers and compilers, the file still works perfectly without any extra handling.

The idea scales nicely too. A Markdown file renders cleanly while the metadata sits quietly in the background. For TypeScript and SASS you can embed compiler instructions specific to that file. And for static site generators, Dark Matter can point to assets that need to be carried over to the final website. It’s front matter that works everywhere — you just can’t see it.

💡 Idea by me, prose by Claude (Anthropic)

#DarkMatter #FrontMatter #WebDev #StaticSiteGenerator #Markdown