Skip to content

BBCode-generating syntax highlighter based on Shiki for vBulletin and other old forum software. Uses standard VS Code themes and TextMate grammar.

License

Notifications You must be signed in to change notification settings

OmarAssadi/Jennie

Repository files navigation

Jennie

Jennie is a syntax highlighter targeted at older forum software whose operators either cannot or will not add native highlighting support.

Jennie was built with vBulletin in mind for Rune-Server. Other forum software may work, however vBulletin is relatively unique in that [CODE]...[/CODE] tags continue to parse and render inner bbcode, which allows us to simply wrap tokens in [COLOR="#HEXCOLOR"][/COLOR] tags and then insert the output into a [CODE] block for a native-feeling highlighted snippet.

Jennie supports standard Visual Studio Code themes and TextMate grammar, allowing Jennie to understand and highlight any language which has either a corresponding VS Code extension or TextMate grammar.

Additionally, as Jennie uses the same tokenizer as VS Code, given the same blocks of text, the highlighted output will be more or less identical between the two. The end result is often significantly better than what Prism or highlight.js would provide, particularly with complex embedded grammar, like those found in templating engines (e.g., Laravel's Blade and Microsoft's Razor templates) or embedded regular expressions and SQL statements.

Jennie also makes use of @Microsoft's TypeScript port of @yoeo's guesslang for automatic programming language detection, allowing the user to simply hit the REST endpoint with a block of text and, in the majority of cases, receive the correct highlighted output without needing to specify any information about the input.

Why Jennie?

Talking about picking a name for the project

Demonstration

Below, you can find some screenshots of Jennie in action.

  1. C, Quake III's fast inverse square root
  2. Laravel Blade with embedded PHP, regex, and SQL; random "code" for demonstration purposes.

vBulletin (Dark Plus and BlueFox)

Code demo vBulletin

NexusPHP (Solarized Light)

Code demo NexusPHP

Roadmap

  • Tokenize code with TextMate grammars
  • Parse VS Code themes and map tokens
  • Render bbcode from themed tokens
  • Automatically detect input language
  • Some sort of frontend
  • Pure clientside port
  • Setup guide

Acknowledgements

  • shikijs/shiki - Used as a wrapper around [microsoft/vscode-textmate] vs-textmate. Initially I wrote my own wrapper, but after discovering shiki, I quickly switched as it already provided all the utilities I needed out of the box.
  • microsoft/vscode-language - Used for automatic language detection
  • Spooky - Inspiration for the project

License

  • Licensed under the ISC license.

Releases

No releases published

Packages

No packages published