0

Any way to select specific text in paragraph to be styled?

I want evertyhing between "<" and ">" to be yellow for example, how do I do that?

10th Mar 2021, 2:19 PM
Karak10
Karak10 - avatar
5 Réponses
10th Mar 2021, 3:26 PM
Abhay
Abhay - avatar
+ 1
Karak10 Boolean is a function that has a default value of False , so it removes all the empty characters from the array. Remove ".filter(Boolean) " and console.log the text , you will understand what i mean. And since it is an array, so need to index the first item which i corrected.
10th Mar 2021, 3:44 PM
Abhay
Abhay - avatar
0
Abhay what does filter(Boolean) do?
10th Mar 2021, 3:39 PM
Karak10
Karak10 - avatar
0
/* are you trying to make some code syntax hilighting? if so, you should use: */ src = '<tag foo="bar">&bull; content</tag>'; esc = src.replace(/[<&]/g, c => '&'+{'<':'lt','&':'amp'}[c]+';'); // esc == '&lt;tag foo="bar">&amp;bull content&lt;/tag>'; html = esc.replace(/&lt;(.+?)>/g,'&lt;<span style="color:red">$1</span>>'); // html == '&lt;<span style="color:red">tag foo="bar"</span>>&amp;bull content&lt;<span style="color:red">/tag</span>>'; document.write(html);
10th Mar 2021, 4:40 PM
visph
visph - avatar
0
I have been keeping notes of stuff I learn and I write down my code above each project I make so that I can easily read it any time, I have been doing that a long time now and I have been using a green background but I wanted to make it a little more readable by making it colorful like in VSC editor for example. I think I found a way to do that, it seems to be working well and I think it's flexible too: https://code.sololearn.com/WgX3Q77Gxk5V/?ref=app
10th Mar 2021, 4:55 PM
Karak10
Karak10 - avatar