Intro to the new site

date:: Jul 9th, 2024

I just pushed a new backend for this site. I love having a quick direct connection to my site: being able to write content and publish it with a quick press of a key. Previously, I was using logseq for this but while writing my latest post I got frustrated with how slow it is.

I use this site not just for writing content, but also quick sketches of interactive code. I can easily make a code block interactive by tagging it to run inline in the page, making it easy to develop quick ideas. For this to work, publishing needs to be instant and the editing experience is vital. In logseq, it took 3-4 seconds to publish content (some of this is due to how I wired up the process) but worse is the editing experience in large posts with lots of code was very slow and frustrating.

My new setup uses obsidian to write content which I've found extremely polished and fast. A big difference is logseq is an "outliner" and obsidian treats content as a simple file of text. I'll miss certain features of outliners but overall the UX improvement is very much worth it.

New site allows code with syntax highlighting (just as before):

function calc(x) {
  return x + 6 * 10000;
}

I can make code blocks easily run by adding the run tag to a codeblock. It looks like this:

```js run
function calc(x) {
  return x + 5 * 10;
}

return calc(10);
```

If I want to show something from the code I can just return the value and it appears in the DOM:

Alternatively I could use a render function within the code block to do the same thing: render(calc(10)). It's a little more verbose, but the benefit with this is I can render multiple things and at different places in the call stack.

I also took the time to support math which is rendered with katex. For example $g(\\sqrt{a^2 + b^2})$ renders as this: g(a2+b2)g(\sqrt{a^2 + b^2}).

This new workflow will be instrumental in my AI studies, which was the primary motivation for this rehaul. Watch this space: I have a feed if you want to keep up to date.