Syntax Highlighting for me, a VSCodeGuy
Published at 2024/09/06
Just a little highlighting for me, as a treat
Here I am testing whether the syntax highlighter I want to apply, Shiki, works beyond the initial example I had. It should work for these four types of code blocks: Javascript, Julia, Python, and Rust. If I want to blog and add code snippets for other languages, I’ll update the svelte.config.js
file. A couple issues are apparent: the component that the blog I am following - still Joy of Code dot xyz - uses an older function imported from Shiki that is now deprecated. I was hoping to finish this task without using any network to do it, and looking at Shiki docs would involve that outside of my editor. Silly, I know, but let’s try.
So the code should work like this: python
def funkyfunc():
location = 'FunkyTown'
print(f'Won't you take me to {location}')
javascript
function greet(name) {
console.log(`Hey ${name}! 👋`)
}
rust
struct ColorClassicStruct {
red: u64,
green: u64,
blue: u64,
}
struct ColorTupleStruct(i32,i32,i32);
#[derive(Debug)]
struct UnitLikeStruct;