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

31st Jul 2018, 8:14 PM
Daniel Cooper
Daniel Cooper - avatar
4 Answers
+ 1
I thought i had made one for you? Daniel Cooper. It's "Somebody else" here again. Lol
1st Aug 2018, 2:27 AM
CalviŐ˛
CalviŐ˛ - avatar
+ 1
From my codes i built the common function, you could always add more tag conditions into it easily.
1st Aug 2018, 2:47 AM
CalviŐ˛
CalviŐ˛ - avatar
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>");
31st Jul 2018, 8:31 PM
Toni Isotalo
Toni Isotalo - avatar
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Ő˛
1st Aug 2018, 2:39 AM
Daniel Cooper
Daniel Cooper - avatar