# react-mde A simple yet powerful and extensible Markdown Editor editor for React. React-mde is built on top of [Draft.js](https://draftjs.org/). ## Demos - [Demos](http://andrerpena.me/react-mde/). ## Installing npm i --save react-mde ## Dependencies React-mde currently depends on: - [Draft.js](https://draftjs.org/). This facilitates features that would otherwise be quite difficult. The best examples being history management, mentions and pasting files. npm i --save draft-js - [Font Awesome 5.*](https://fontawesome.com/) for the icons. This is not a hard dependency and can be changed (see the **Customizing Icons** section below). To use Font Awesome icons, install [using your preferred method](https://fontawesome.com/how-to-use/svg-with-js). The easiest is just add this to ``: It is possible to use React-mde with Font Awesome 4 (and possibly earlier versions) – see below under 'Customizing Icons'. ## Optional dependencies - [Showdown](https://github.com/showdownjs/showdown). React-mde is not opinionated as to how to transform markdown into HTML and this can be done both in client-side, like StackOverflow, or in server-side, like GitHub. The easiest way is to use Showdown and process it in client-side. If you decide to do so, install Showdown: npm i --save showdown ## Using React-mde is a completely controlled component. Minimal example using Showdown: ```jsx import * as React from "react"; import ReactMde, {ReactMdeTypes} from "../src"; import * as Showdown from "showdown"; export interface AppState { mdeState: ReactMdeTypes.MdeState; } export class App extends React.Component<{}, AppState> { converter: Showdown.Converter; constructor(props) { super(props); this.state = { mdeState: null, }; this.converter = new Showdown.Converter({tables: true, simplifiedAutoLink: true}); } handleValueChange = (mdeState: ReactMdeTypes.MdeState) => { this.setState({mdeState}); } render() { return (
Promise.resolve(this.converter.makeHtml(markdown))} />
); } } ``` ### Customizing Icons By default, React-mde will use Font Awesome class names to render icons (see above for how to install). The default icon provider returns icons that look like the following: ```jsx