#dev 2025-01-23

2025-01-23 UTC
#
btrem
Well, a delimeter would be great, but afaik no markdown processors support it.
#
btrem
It sort of makes sense that they don't; I imagine the thinking is that a single markdown file represents a single, unbroken document. But templates and front matter -- that is, markdown in an SSG setting -- complicates things. Alas!
#
aaronpk
The other question to ask is why do you need it separate in the first place? Why not have the acknowledgments in the post content? Or at least in the markdown content if not in the microformats e-content
#
[KevinMarks]
Have you looked at TOML?
#
btrem
I don't /need/ it separate. No one is going to be hurt if I can't wrangle my tools!
#
btrem
I'd /like/ to have it separate, because I'd /like/ to place some bits in different containers, e.g., one bit in e-content, another outside it.
#
btrem
[KevinMarks]: My SSG is 11ty, and I can use TOML for front matter, but I don't think yaml is the problem. The problem is the inability to have sections in a markdown/front matter content section and access them in a template.
#
[aciccarello]
I find TOML confusing
#
btrem
I was impelled to try this because I found myself adding <aside class="ps">Thanks to...</aside> at the end of some of my md posts. Some posts have multiple such asides.
#
[aciccarello]
Why can't you access your frontmatter in a template? That should work with 11ty
#
btrem
I can access my frontmatter in a template.
#
btrem
In fact, that's what I'm doing, placing multiline markdown strings in my front matter, so I can place them outside of my main.e-content element.
#
btrem
I can't separate the *content*, that is, the non-frontmatter, and access those separate parts in my templates. It's just content.
#
btrem
It's a limitation of ssgs that use md files with frontmatter. I'm asking here because I thought maybe someone else came across this problem and came up with a solution of some sort that is more elegant than what I'm doing.
#
btrem
[aciccarello]: since you're here, a different 11ty question. The 11ty dev server hot reload is not working for me. Or more precisely, it works when I change and save a .md file, not not when I change a layout .njk file. The only way to get any changes to show themselves is to stop and restart the server. Are you having any issues with that?
#
[aciccarello]
Yep, the dev server has been buggy for me sometimes. I especially have issues with the incremental build.
#
[aciccarello]
There's a way to declare dependencies but I don't want to add a lot of configuration for that since it's supposed to be automatic.
#
btrem
Yeah, me too. It's the incremental builds that are failing, even though the terminal output indicates that all is well. Ok, maybe I'll file an issues.
#
btrem
sighs
#
btrem
Not looking forward to that.
#
[aciccarello]
At some point the plan is for the incremental build to be able to work off a static cache so you could have really fast builds on large sites. So I think it will get better over time but we are a long way off from that.
#
btrem
It makes working on layouts extremely painful. Half a minute each time I make a change.
grufwub, bterry, thegreekgeek and geoffo joined the channel
#
[Jo]
does anyone know a simlle shell command for getting alt text from html
#
[Jo]
simple*
#
_pi_r2_0[d]
[Jo] best I have without involving a scripting language is elements with an alt, not the text itself. `> curl -s https://pcarrier.com | htmlq '[alt]'` → `<img alt="Portrait" …<img alt="Self-reference as a QR code"…`
#
_pi_r2_0[d]
and if you'll allow JS… `deno eval 'import {DOMParser} from "jsr:@b-fuze/deno-dom";console.log([...new DOMParser().parseFromString(await (await fetch(Deno.args[0])).text(),"text/html").querySelectorAll("[alt]")].map((e)=>e.getAttribute("alt")))' https://pcarrier.com` → `[ "Portrait", "Self-reference as a QR code" ]`
[qubyte] joined the channel
#
[Jo]
hmm both of those arent quite what i need, but thanks! i do need it in the shell for my SSG, i have this thing where it generates a pure text version of each post and so far all of the images are just cut completely. itd be nice to have the alt text in there
ttybitnik, GuestZero, thegreekgeek_ and Guest6 joined the channel
#
_pi_r2_0[d]
[Jo] well that sounds a lot more complex than just extracting the alt text. `lynx -dump`?
#
_pi_r2_0[d]
or better, `links -dump`
thegreekgeek, alephalpha0 and nemonical joined the channel
#
[Jo]
well i do have the source code easily, all i need is to get the contents of the alt text before removing everything within the <> tags completely
#
[KevinMarks]
a microformats parser can be used to do that, as for e- elements it gives you a plaintext version that expands alt
thegreekgeek, GuestZero, gregsarjeant, Xe, strugee_, GWG, thegreekgeek_ and MrMan joined the channel
#
[Jo]
ooh thats interesting. do you have recommendation?
#
aaronpk
is trying to figure out a way to post HLS videos
#
aaronpk
i think i have it working such that with JS disabled in Safari you get the native HLS player experience, and JS disabled in browsers that don't support HLS natively you'd get the full single video file. with JS enabled, you get a nice video player experience using video.js and HLS support in non-Safari
#
doesnm
post hls? maybe convert mp4/etc to m3u through ffmpeg
#
aaronpk
Right but like, also getting the rendering of it to work
#
aaronpk
Because Chrome doesn't play hls in a video tag directly, unlike safari
#
aaronpk
Then the next question is how to automate the ffmpeg conversion and make it so I can upload from my phone. Looking at this library now which seems like the best path https://github.com/tus/tus-js-client/blob/main/docs/usage.md
#
aaronpk
one challenge with my workflow, as a side effect of my post storage being date based, is i need to know the URL of the post before I can save any files in the filesystem where they belong. which means any media uploads need to happen after the folder exists, which I can't know until I know the date of the post, so doesn't really map to the right workflow of using an external client to create posts
#
aaronpk
with photos it's not a huge deal because the photo lives at a temporary location until the post is created, but that feels more fragile once we're talking about a 200mb+ video file and all the chunks it gets broken up into
GuestZero_ joined the channel
#
[KevinMarks]
I'm not sure which microformats parsers you can run easily from the command line. Do you have an existing language you already use for scripts?
#
[tantek]
aaronpk, for storing media at least, one approach may be to store the media file itself based on its creation date, which is presumably known in advance of the date of any post that embeds or publishes the media file
#
aaronpk
That's true, it just is a change from the current scheme where every file for a post lives in that post's own folder
#
aaronpk
If I treat all media storage separately then it's pretty straightforward, just becomes harder to reconcile whether a particular file is actually in use by a post
#
[Jo]
I use bash for my scripts so 😬
#
btrem
aaronpk: something I've struggled with. I put my media in a separate folder structure based on a numerical index. Which leads to plenty of its own problems.
ttybitnik joined the channel
#
aaronpk
Yeah that's why I like my current method of self contained folders per post
#
aaronpk
Maybe I just have to buckle up and deal with the video transcoding happening in a temporary location and moving the files over when the post folder is ready
barnaby joined the channel
#
btrem
I've been tempted to put my media in the same folder as the file, but that might lead to its own problems, since a folder can have several posts.
wzns and ttybitnik joined the channel
#
sknebel
one approach for something file system based could be to sym- or hardlink media files from their central storage to the post folders
#
sknebel
then you can still access all media in one place and get whats needed for a post local to the post
#
sknebel
(I should actually do that... my site generator uses symlinks a ton anyways already)
#
Loqi
sknebel has 6 karma in this channel over the last year (13 in all channels)
#
btrem
Hmm. Symlinks. Never thought of that. sknebel++
#
btrem
I'm not sure how I'd do that, but it's worth a think at least.
wzns, [Alexandra_Samu] and sebbu2 joined the channel
#
[Jo]
btw i did find the shell command to get only the alt text and its `grep -Po 'alt="\K[^"]+(?=")'`
#
[tantek]
I’m sure you're not scraping HTML with a regular expression right? RIGHT?!? 😂
#
aaronpk
Just an HTML attribute, what could go wrong
#
[Jo]
i assume youre referring to things that could go badly wrong. well. its my own html and im very nice
immibis and max1 joined the channel
#
max1
Are you saving webmentions locally in a database or just as plain json?
#
max1
Probably better to save it to a database for better performance as soon the json file get's some mb's which could slow down page loads
ttybitnik and gRegor joined the channel
#
[Murray]
You can always colocate the webmention data with the markdown/html file for the page, which helps solve that issue 🙂
[snarfed] joined the channel
#
[snarfed]
obligatory zalgo he comes
#
gRegor
what is html regex
#
gRegor
haha, probably best that page doesn't show a summary
#
aaronpk
i forgot about that page
#
gRegor
Marty's reading of it linked there is also great XD