Showing Line Numbers in Script/Code Blocks

Thanks for sharing, Dan.

Looks like you have put a lot of hard work into this.
But, to be honest I am not sure I understand the use case. Perhaps you could expound to help me and others better understand?

Here is a related macro, that is much simpler.

It just takes a script on the clipboard, replaces the TAB characters, and pastes into a Discourse forum (like Keyboard Maestro) with the appropriate forum codes. It uses a Typed Text trigger to support both AppleScript and JXA scripts.

MACRO: KM Forum -- Paste Script Block

I use this all the time.