![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
sugar-high
Advanced tools
Super lightweight JSX syntax highlighter, around 1KB after minified and gzipped
npm install --save sugar-high
import { highlight } from 'sugar-high'
const codeHTML = highlight(code)
document.querySelector('pre > code').innerHTML = codeHTML
Then make your own theme with customized colors by token type and put in global CSS. The corresponding class names start with --sh-
prefix.
/**
* Types that sugar-high have:
*
* identifier
* keyword
* string
* Class, number and null
* property
* entity
* jsx literals
* sign
* comment
* break
* space
*/
:root {
--sh-class: #2d5e9d;
--sh-identifier: #354150;
--sh-sign: #8996a3;
--sh-property: #0550ae;
--sh-entity: #249a97;
--sh-jsxliterals: #6266d1;
--sh-string: #00a99a;
--sh-keyword: #f47067;
--sh-comment: #a19595;
}
Sugar high provide .sh_line
class name for each line. To display line number, define the .sh_line::before
element with CSS will enable line numbers automatically.
pre code {
counter-reset: sh-line-number;
}
.sh__line::before {
counter-increment: sh-line-number 1;
content: counter(sh-line-number);
margin-right: 24px;
text-align: right;
color: #a4a4a4;
}
Use .sh__line:nth-child(<line number>)
to highlight specific line.
.sh__line:nth-child(5) {
background: #f5f5f5;
}
You can use .sh__token--<token type>
to customize the output node of each token.
.sh__token--keyword {
background: #f47067;
}
Remark.js is a powerful markdown processor, you can use the sugar-high remark plugin with remark.js to highlight code blocks in markdown.
Check out the documentation for more details.
MIT
FAQs
Super lightweight JSX syntax highlighter
We found that sugar-high demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.