# syntux

> Highlight.js optimized for browserify and react.

Latest version **0.5.0** (published 2016-08-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install syntux
pnpm add syntux
yarn add syntux
bun add syntux
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.5.0 |
| Published | 2016-08-12 |
| First published | 2015-03-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | yes |
| GitHub stars | 11 |
| Author | Dylan Piercey |
| Maintainers | dylanpiercey |

## Links

- npm: https://www.npmjs.com/package/syntux
- Repository: https://github.com/DylanPiercey/syntux
- Homepage: https://github.com/DylanPiercey/syntux#readme
- Issues: https://github.com/DylanPiercey/syntux/issues
- npm.io page: https://npm.io/package/syntux

## Dependencies (2)

- [cssmin](https://npm.io/package/cssmin.md) ^0.4.3
- [highlight.js](https://npm.io/package/highlight.js.md) ^8.6.0

## Recent versions

- 0.5.0 (latest) — 2016-08-12
- 0.4.3 — 2016-04-26
- 0.4.2 — 2016-04-23
- 0.4.1 — 2015-10-13
- 0.4.0 — 2015-10-02
- 0.3.9 — 2015-10-02
- 0.3.8 — 2015-10-02
- 0.3.7 — 2015-10-02
- 0.3.6 — 2015-10-02
- 0.3.5 — 2015-07-07
- 0.3.4 — 2015-07-07
- 0.3.3 — 2015-07-07
- 0.3.2 — 2015-07-07
- 0.3.1 — 2015-07-07
- 0.3.0 — 2015-07-07
- … 20 more at https://npm.io/package/syntux/versions

## README

# Syntux

Syntax highlighting for React without the bulk.

[![npm](https://img.shields.io/npm/dm/syntux.svg)](https://www.npmjs.com/package/syntux)

# Supported Languages
All languages and styles from [highlight.js](https://highlightjs.org).

# Installation

#### Npm
```console
npm install syntux
```

# Example
```javascript
// Require a style. (Returns a React style element).
var Theme = require('syntux/style/solarized_dark');

// Require the highlighters.
var XML = require('syntux/xml');
var CSS = require('syntux/css');
var JS = require('syntux/javascript');

// To access the underlying hljs simply require("syntux").
// Use them in a component.
var MyComponent = function () {
    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:
![Example](https://raw.githubusercontent.com/DylanPiercey/Syntux/master/example.png)

# Usage with Marked (Markdown)
```javascript
var React = require("react");
var marked = require("marked");
var syntux = require("syntux");

// Ensure needed languages are available.
require("syntusk/javascript");
require("syntusk/css");
require("syntusk/xml");

// Set code renderer.
var renderer = new marked.Renderer();

renderer.code = function(code, lang) {
    lang = lang.toLowerCase();
    code = syntux.highlight(lang, code, true).value;
    return '<pre><code class="hljs ' + lang + '">' + code + '</code></pre>';
};

marked.setOptions({ renderer: renderer });

// Use it!
marked("```javascript var x = 1;```")
```

---
_Source: https://npm.io/package/syntux · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
