# react-mathdown

> > A configurable React Component which supports rendering math in the Markdown

Latest version **0.1.3** (published 2017-08-21) · 0 weekly downloads

## Install

```sh
npm install react-mathdown
pnpm add react-mathdown
yarn add react-mathdown
bun add react-mathdown
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.3 |
| Published | 2017-08-21 |
| First published | 2017-07-22 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+3 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | knight_42 |
| Keywords | markdown, react, mathjax |

## Links

- npm: https://www.npmjs.com/package/react-mathdown
- npm.io page: https://npm.io/package/react-mathdown

## Dependencies (2)

- [marked](https://npm.io/package/marked.md) ^0.3.6
- [prop-types](https://npm.io/package/prop-types.md) ^15.5.10

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.1.3 (latest) — 2017-08-21
- 0.1.2 — 2017-08-19
- 0.1.1 — 2017-07-25
- 0.1.0 — 2017-07-22

## README

# react-mathdown

> A configurable React Component which supports rendering math in the Markdown

## Table of Contents

- [Usage](#usage)
- [Configuration](#configuration)

## Usage

### 1. Install
```
npm i -S react-mathdown
// or
yarn add react-mathdown
```

### 2. Add MathJax to your current project

Add a script tag to your `index.html` like this:

```html
<script
  type="text/javascript"
  src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS_HTML-full">
</script>
```

### 3. Let's rock!

```js
import React, { Component } from 'react'
import MathDown from 'react-mathdown'

class App extends Component {
  constructor(props) {
    super(props);
    this.state = {
      value: '**golden ratio**: $\\frac{\\sqrt{5}+1}{2}$'
    }
  }

  onChange = (e) => this.setState({value: e.target.value})

  render() {
    return (
      <div>
        <input
          value={this.state.value}
          style={{ width: 300 }}
          onChange={this.onChange}
        />
        <MathDown value={this.state.value} />
      </div>
    )
  }
}

export default App
```

## Configuration

| Property | Description | Type | Default |
| -------- | ----------- | ---- | ------- |
| style    | style object of container | object | - |
| className | class name of container | string | - |
| jaxConfig | MathJax.Hub.config | object | { tex2jax: { inlineMath: [['$', '$']] } } |
| markedConfig | marked options | object | { gfm: true, tables: true, breaks: false, smartLists: true, smartypants: false } |
| value | markdown text to be rendered | string | |

NOTE:
* `props.jaxConfig` and `props.markedConfig` will be merged with the default value and passed to `MathJax.Hub.Config()` and `marked.setOptions()` respectively.
* `markedConfig.sanitize` will always be `false`, since we do MathJax before marked.

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