Syntux
Syntax highlighting for React without the bulk.
Supported Languages
All languages and styles from highlight.js.
Installation
Npm
npm install syntux
Example
// Require a style. (Returns a React style element).var Theme = ; // Require the highlighters.var XML = ;var CSS = ;var JS = ; // To access the underlying hljs simply require("syntux").// Use them in a component.var { return <div> Theme <XML> '<a href="example.html"> Click me </a>' </XML> <CSS> 'body { background-color: green }' </CSS> <JS> 'var x = { y: "hi" };' </JS> </div> ;});
Which (when rendered) will output:
Usage with Marked (Markdown)
var React = ;var marked = ;var syntux = ; // Ensure needed languages are available.;;; // Set code renderer.var renderer = ; renderer { lang = lang; code = syntuxvalue; return '<pre><code class="hljs ' + lang + '">' + code + '</code></pre>';}; marked; // Use it!