markjgsmith

2023/08/21 #

Having a template engine should be standard in all operating systems. It should be possible no matter where you are located or what you are doing to render out a template and get back the resulting string of text in a way that you can use it to accomplish the task you are doing. #

Text template rendering should be standard in all operating systems

It should be possible no matter where you are located or what you are doing to render out a template and get back the resulting string of text in a way that you can use it to accomplish the task you are doing.

Seems like an easy ask, but it's actually quite tricky because the UI is different depending on where you are and what you are doing. What that means is that it's not obvious how you get or provide the required inputs to the template rendering, but also how you use the resulting string.

Are you on the command line in a shell? Or on the Desktop? Or maybe you are in an app?

Where are the inputs you need to insert into the template? How are you going to get those? Manually type them? Auto generate them by running a script?

What are you going to do with the rendered string? Copy and paste it? Stick it in a file? Perhaps insert it into a form?

Once you stop to think about it for a few minutes, it's not at all obvious how to implement a system wide feature like template rendering.

The most obvious way might be to make it an enhancement to the standard copy / paste feature of the operating system. Have a way to run a script to fetch data, pass it into a template you select, and get back the rendered output on the clipboard ready to do with it as you please.

That would be really useful to me right now. I already have a title for this post. It's right there in the frontmatter. What I want to be able to do is select the title using the standard operating system copy feature, then run it through a template that would transform it as follows:

Text template rendering should be standard in all operating systems

would get transformed to:

text-template-rendering-should-be-standard-in-all-operating-systems

That would give me the text slug which I could use in the filename of this blog post's markdown file.

2023-08-21-081100-text-template-rendering-should-be-standard-in-all-operating-systems.md

You would probably need to have a library of utility functions you could use in your templates. In this case we would need some sort of slugify utility function as well as datetime manipulation functions.

I could continue using whatever editor I was using as normal, using it's 'Save As' feature, but no need to mess about getting the filename correct. In a couple of clicks it would be correct every time. It's small features like this that have the potential to remove huge bariers. #

I think that maybe I've found the solution to the notes shouldn't have titles, but actually sometimes they need titles problem. Instead of a full on title, which looks weird next to a bullet point, just use bold text for the start of the sentence.

I noticed Politico does this in their newsletters and I think it looks quite nice. Sort of breaks up the wall of text, giving your eye something to focus on as you skim. I did it with the previous note. That one actually turned into a blog post. So that was quite nice. #

The thing that's very silly about all this overthinking of notes and titles and blog posts is that although it's definitely freeing to just start writting without worrying about a title, I do sort of end up creating a title anyway when I commit the file to the git repo.

For example the previous note item had commit message "Just use bold" and I'll probably call this one "Overthink silliness". So perhaps having to come up with a title isn't so difficult. Or maybe it's just that since the emphasis isn't on the title, it ceases to be a problem. If I really get stuck I could just not enter a commit message. No big deal. #

Today’s links:

For enquiries about my consulting, development, training and writing services, aswell as sponsorship opportunities contact me directly via email. More details about me here.