This content originally appeared on DEV Community π©βπ»π¨βπ» and was authored by Felippe Regazio
The tool is called "Unilight". It is a simple parser and module that modifies unicode variation of string parts.
So you can highlight anywhere that doesn't accept rich editing, just have a pure string that accepts unicode variations. Works for almost any lang, take a look, this is a simple and pure STRING haha:
.......
// ππππ€ ππ€ ππ ππ©πππ‘ππ
π³ππ»π°ππΆπΌπ» example() {
π°πΌπ»ππ a = "fizz";
π°πΌπ»ππ b = "buzz";
πΏπ²πππΏπ» a+b;
}
.......
You can highlight your code here:
https://felippe-regazio.github.io/unilight/
Source code and documentation here:
https://github.com/felippe-regazio/unilight
Warning:
This is a toy project made for aesthetic reasons only (just wanted to code). I made it because I wanted to study a few things about parsers and do something with it. However, there are important weaknesses of this technique:
Systems that do not support unicode will not display the text
Since unicode variations are hidden characters, the string will always be longer than it looks
Interpreters will not run the code because they don't know these chars, it will have to be sanitized
The tool is more useful for aesthetic reasons in fact, you can highlight simple snippets on a tweet, for example. I think the most interesting thing here is: The source code and the relationships between it (if you're a beginner/intermediate it might be a good thing to see given its simplicity), and the parser (if you're more advanced in js, good luck with that).
This content originally appeared on DEV Community π©βπ»π¨βπ» and was authored by Felippe Regazio
Felippe Regazio | Sciencx (2022-11-07T18:09:24+00:00) I Created a pure Unicode Code Highlighter :P. Retrieved from https://www.scien.cx/2022/11/07/i-created-a-pure-unicode-code-highlighter-p/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.