0
Syntax Highlighting?
So yesterday, I made the mistake of asking you guys to explain about 300 lines of code. The code was a syntax highlighter for code snippets. It supported HTML, CSS, and Javascript. I wanted to understand the code, but I realized that one day I'll have it figured out. So my new question is, can somebody help me make a syntax highlighter like the one I posted, but simplified? I'm going to try making it myself, but I'm open to suggestions. I'm new to coding btw so if I seem stupid, that's why xD
4 Respuestas
+ 1
I thought i had made one for you? Daniel Cooper.
It's "Somebody else" here again. Lol
+ 1
From my codes i built the common function, you could always add more tag conditions into it easily.
0
You could do something like
code = code.replace(/function/g, "<span class='function'>function</span>");
code = code.replace(/var/g, "<span class='var'>var </span>");
0
lol
It only really registered the div
it didn't highlight the script tag or even the script inside of it.
https://code.sololearn.com/Wr6Prq2nOvMZ/?ref=app
I also want support for css
i'll have to experiment a bit I guess
Calviղ