# posthtml-jsx-svg

> JSX Renderer for PostHTML

Latest version **1.1.0** (published 2017-10-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install posthtml-jsx-svg
pnpm add posthtml-jsx-svg
yarn add posthtml-jsx-svg
bun add posthtml-jsx-svg
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2017-10-15 |
| First published | 2017-10-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | madzhup |
| Keywords | jsx, svg, html, posthtml, posthtmlrender |

## Links

- npm: https://www.npmjs.com/package/posthtml-jsx-svg
- Repository: git@github.com:madzhup/posthtml-jsx-svg
- Homepage: https://github.com/madzhup/posthtml-jsx-svg
- Issues: https://github.com/madzhup/posthtml-jsx-svg/issues
- npm.io page: https://npm.io/package/posthtml-jsx-svg

## Dependencies (1)

- [posthtml-svg-mode](https://npm.io/package/posthtml-svg-mode.md) ^1.0.0

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2017-10-15
- 1.0.0 — 2017-10-15

## README

# PostHTML JSX SVG <img align="right" width="200" height="220" title="PostHTML" src="http://posthtml.github.io/posthtml/logo.svg">

Inspired by [posthtml-jsx](https://github.com/posthtml/posthtml-jsx), use [posthtml-svg-mode](https://github.com/kisenka/svg-baker/tree/master/packages/posthtml-svg-mode) render.

## Install

```bash
npm i -D posthtml-jsx-svg
```

## Usage

```js
posthtml(plugins)
  .process(html, { render: jsx(options) })
  .then(({ html }) => console.log(html))
```

## Options

**`render`:** `{Function}`: Custom render

**`name`:** `{String|Function}`: Name of the Component. If function passed, it will be called with this options and posthtml tree as arguments

**`props`:** `{String|Array}`: Props of the Component

## Example

```js
import { readFileSync, writeFileSync } from 'fs'

import posthtml from 'posthtml'
import jsx from 'posthtml-jsx-svg'

const html = readFileSync('./index.html', 'utf8')

posthtml()
  .process(html, {
    render: jsx({
      name: 'Test'
      props: ['prop', '{ prop }', '...props']
      export: true
    })
  })
  .then((result) => writeFileSync('./Test.jsx', result.html, 'utf8'))
```

```html
<div id={id} class={container}>
  {content}
</div>
```

```js
import React from 'react';

const SvgComponent = (...prop1, prop2) => (
<div id="{id}" class="{class}">
  {ctx.content}
</div>
);

export default SvgComponent;
```

## LICENSE

[MIT](LICENSE)

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