Conversation
|
I don't use JavaScript much, so I'm not sure what JSX tags are. Let me look at this a bit... |
|
They are used for templates in React. Actually they are representation of a render function. Also it would be nice to have |
|
Hmmmm... I'm not sure it's a good idea to have library-specific highlighting for a highlighting a language. For a couple of reasons. ... Snip... |
|
|
||
| ## JSX tags | ||
| color cyan "<[^> ]+" | ||
| color cyan "<[a-zA-Z][a-zA-Z0-9]*>" |
There was a problem hiding this comment.
Maybe list HTML tags here? To differentiate a color of standard tags from components?
Also <[a-zA-Z][a-zA-Z0-9]*> will match <>, but <[a-zA-Z][a-zA-Z0-9]+> don't!
There was a problem hiding this comment.
Having a different color for standard tags rather than components could be nice, but don't you think listing them is overkill? I would suggest it's sufficient to say that <[a-z]+> is an HTML tag and <[A-Z][a-zA-Z0-9]*> is a component.
(Also <[a-zA-Z][a-zA-Z0-9]*> will not match <>, it will match at least <[a-zA-Z]>.)
There was a problem hiding this comment.
So what if someone uses all caps when they do their HTML??
<HTML>
<BODY>
I LIKE SCREAMING CAPS!!!
</BODY>
</HTML>dumb i agree, but I've seen this in more than one place...
There was a problem hiding this comment.
About */+ you are right, it's my bad, sorry))
About overkill: listing of JS reserved words is not overkill...
HTML has 144 tags. Reference https://developer.mozilla.org/en-US/docs/Web/HTML/Element
document.body.innerText.match(/<\w+>/g).reduce((acc, cur) => {
if (!acc.includes(cur)) {
acc.push(cur)
}
return acc
}, [])Run this code in the console on a reference page.
There was a problem hiding this comment.
In JSX, any tag that starts with a lowercase letter is assumed to be a native tag, whereas tags starting with uppercase letters are component tags.
It's not library specific now if you are talking about JSX. Earlier it was, but not now. |
|
@Piterden thank you for the info. I accidentally posted my previous thing and i had a whole set of reasons and was going to suggest "make a Again I'm not much in the js community, so some of these things i don't know. I like @Piterden 's suggestion for adding HTML tags as a different color, so if you could do that @remyoudemans (at least some of the more often used ones) I'll accept the pull request. |
serialhex
left a comment
There was a problem hiding this comment.
I think @remyoudemans suggestion is good enough. If the pr is changed to that I'll go ahead and pull it in. Sorry for the very long delay...


No description provided.