rouge-ruby / rouge

A pure Ruby code highlighter that is compatible with Pygments
https://rouge.jneen.net/
Other
3.3k stars 732 forks source link

CSS lexer doesn't know about [attr$=value] #2043

Open verhovsky opened 2 months ago

verhovsky commented 2 months ago

Name of the lexer CSS

Code sample

a {
  color: blue;
}

/* Internal links, beginning with "#" */
a[href^="#"] {
  background-color: gold;
}

/* Links with "example" anywhere in the URL */
a[href*="example"] {
  background-color: silver;
}

/* Links with "insensitive" anywhere in the URL,
   regardless of capitalization */
a[href*="insensitive" i] {
  color: cyan;
}

/* Links with "cAsE" anywhere in the URL,
with matching capitalization */
a[href*="cAsE" s] {
  color: pink;
}

/* Links that end in ".org" */
a[href$=".org"] {
  color: red;
}

/* Links that start with "https://" and end in ".org" */
a[href^="https://"][href$=".org"]
{
  color: green;
}

https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors

https://rouge.jneen.net/v4.2.1/css/YSB7CiAgY29sb3I6IGJsdWU7Cn0KCi8qIEludGVybmFsIGxpbmtzLCBiZWdpbm5pbmcgd2l0aCAiIyIgKi8KYVtocmVmXj0iIyJdIHsKICBiYWNrZ3JvdW5kLWNvbG9yOiBnb2xkOwp9CgovKiBMaW5rcyB3aXRoICJleGFtcGxlIiBhbnl3aGVyZSBpbiB0aGUgVVJMICovCmFbaHJlZio9ImV4YW1wbGUiXSB7CiAgYmFja2dyb3VuZC1jb2xvcjogc2lsdmVyOwp9CgovKiBMaW5rcyB3aXRoICJpbnNlbnNpdGl2ZSIgYW55d2hlcmUgaW4gdGhlIFVSTCwKICAgcmVnYXJkbGVzcyBvZiBjYXBpdGFsaXphdGlvbiAqLwphW2hyZWYqPSJpbnNlbnNpdGl2ZSIgaV0gewogIGNvbG9yOiBjeWFuOwp9CgovKiBMaW5rcyB3aXRoICJjQXNFIiBhbnl3aGVyZSBpbiB0aGUgVVJMLAp3aXRoIG1hdGNoaW5nIGNhcGl0YWxpemF0aW9uICovCmFbaHJlZio9ImNBc0UiIHNdIHsKICBjb2xvcjogcGluazsKfQoKLyogTGlua3MgdGhhdCBlbmQgaW4gIi5vcmciICovCmFbaHJlZiQ9Ii5vcmciXSB7CiAgY29sb3I6IHJlZDsKfQoKLyogTGlua3MgdGhhdCBzdGFydCB3aXRoICJodHRwczovLyIgYW5kIGVuZCBpbiAiLm9yZyIgKi8KYVtocmVmXj0iaHR0cHM6Ly8iXVtocmVmJD0iLm9yZyJdCnsKICBjb2xvcjogZ3JlZW47Cn0K