reinhart1010.id Site Update: (Awesome) Code Previews!
Tags: showdev
Published: 2022-01-05 07:55:36

---
title: reinhart1010.id Site Update: (Awesome) Code Previews!
published: true
date: 2021-10-23 07:29:53 UTC
tags: showdev
canonical_url: https://reinhart1010.id/2021/10/23/reinhart1010-id-site-update-awesome-code-previews/
---

 **Code previews are one of the features WordPress sucked.** At least, in their default Block Editor (aka. Gutenberg). Let’s say that you’re writing a C program which commonly uses preprocessor tags such as `#include`, and for some reason WordPress automatically puts that into a clickable link because it recognize that as a tag instead.

But the problem doesn’t stop there. As you might already know, this site heavily uses a monospace font, because we’re proud to not just write, but also `print()` in programming languages. But, when it comes into embedding inline code snippets, they might not be clearly visible on our site because, you know, most of our content is already in monospace.

This is why we decided to treat `inline code` the same way as **bold text** , ’cause again, we’re **bold** enough to `print()`! If you’re reading our posts through [our RSS feeds](https://reinhart1010.id/contact/) or your favorite browser’s Reader View, you can still see the differences between texts which are meant to be `inline code` and the ones written in **bold**.

**But wait, there’s one more!** Longer code previews, now powered by [**this specific WordPress plugin**](https://wordpress.org/plugins/syntax-highlighting-code-block/) as well as [**Highlight.js**](https://highlightjs.org/), will render beautifully on this website. Light or dark, SYSTEM or root, they’re still beautiful to see on supported browsers. Firefox users will need to wait for a while since the support for blurred backgrounds (specifically CSS’ `backdrop-filter`) are still under development.

![](https://reinhart1010.id/wp-content/uploads/2021/10/Screen-Shot-2021-10-23-at-12.15.25-PM-1024x615.png)

![](https://reinhart1010.id/wp-content/uploads/2021/10/Screen-Shot-2021-10-23-at-12.16.14-PM-1024x615.png)

The code behind this wizardry is based on a lesser-known CodePen demo by Reinhart himself, which you can check out below. The goal behind it is just to define a better, glass-based Card component style for dark user interfaces, trying to be as futuristic as possible.

<iframe sandbox="allow-scripts" security="restricted" title="ZEYZgPR" loading="lazy" src="https://codepen.io/Reinhart_Previano/embed/preview/ZEYZgPR?default-tabs=css%2Cresult&amp;height=600&amp;host=https%3A%2F%2Fcodepen.io&amp;slug-hash=ZEYZgPR#?secret=IMViRjslkE" data-secret="IMViRjslkE" scrolling="no" frameborder="0" height="600"></iframe>

And this time, we decided to use a modified version of [Atom](https://atom.io)‘s (infamous) **One Light** and **One Dark** color schemes. And Reinhart has written [a dedicated blog post](https://reinhart1010.id/2021/09/11/kisah-sebuah-ide-yang-dianaktirikan-karena-visual-studio-code/) about his affection with Atom. That love, however, was start to tear apart as editors such as Visual Studio and Kate gain more features and advantages than a humble IDE like Atom.

## Try it yourself

Well, that’s the end of our announcement. If you would like to see how that beautiful, futuristic code preview look on your device here’s a simple Hello, World program written in plain old C language. Thanks and have a nice day!

```

`#include <stdio.h>

void say(char c){
  printf("%c", c);
}

int main(int argc, char *argv[]){
  printf("%c", 72),
  printf("%c", 'e'),
  int i;
  for (i = 0; i < 2; i++){
    printf("l");
  }
  puts("o,");
  char sentence[7] = ['W', 'o', 'r', 'l', 'd', '!', '\n'];
  for (i = 0; i < 7; i++) say(sentence[i]);
  return 0;
}
`
<small id="shcb-language-1"><span>Code language:</span> <span>C++</span> <span>(</span><span>cpp</span><span>)</span></small>
```

The post [reinhart1010.id Site Update: (Awesome) Code Previews!](https://reinhart1010.id/2021/10/23/reinhart1010-id-site-update-awesome-code-previews/) appeared first on [Reinhart Previano Koentjoro](https://reinhart1010.id).