Friday, 18 October 2024

So, I found out about this JavaScript library called highlight.js, and I think I might include it here in this site. The main reason being that if I want to share some code on this site, for example, sharing a part of a project I am working on, I can do something like this:

using System;
using UnityEngine;
using UnityEngine.Serialization;
using UnityAvatar = UnityEngine.Avatar;

namespace ModelViewer {
	[RequireComponent( typeof(Animator) )]
	public class Avatar : MonoBehaviour {

	[Serializable]
	public struct MeshAddon {
		public string key;

		public Renderer[] renderers;
	}

	[Serializable]
	public struct CameraPos {
		public string key;

		public Transform anchor;
	}

	public string Name {
		get {
			return name;
		}
	}

	public MeshAddon[] Meshes {
		get {
			return meshes;
		}
	}

	public CameraPos[] CameraAnchors {
		get {
			return camAnchors;
		}
	}



	[FormerlySerializedAs( "avatarName" )]
	[SerializeField]
	private string name;

	[FormerlySerializedAs( "addons" )]
	[SerializeField]
	private MeshAddon[] meshes;
	[SerializeField]
	private CameraPos[] camAnchors;

	private UnityAvatar unityAvatar;

	private void Start() {
		unityAvatar = GetComponent<Animator>().avatar;
	}
}

Edit on 12.03.2025:

At the time of editing, the site is using a different library. It does not use the JS lib.


Edit on 30.03.2025:

Recently been thinking of this, and might use highlight.js or another library in junction with the current way to turn markdown into HTML.

An unhandled error has occurred. Reload 🗙