From 7b014bd9f721d113b3b62a193ac220126a7e83dc Mon Sep 17 00:00:00 2001 From: Evan Jacobs Date: Sun, 6 Dec 2015 23:26:11 -0500 Subject: [PATCH] Add to README --- README.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 312e1058..00733708 100644 --- a/README.md +++ b/README.md @@ -4,13 +4,32 @@ Enables the safe parsing of markdown into proper React JSX objects, so you don't The only exception is arbitrary HTML in the markdown (kind of an antipattern), which will still use the unsafe method. +Uses [mdast](https://github.com/wooorm/mdast) under the hood to parse markdown into a consistent AST format. + Requires React >= 0.14. +## Usage + +```js +import converter from 'markdown-to-jsx'; +import React from 'react'; +import {render} from 'react-dom'; + +render(converter('# Hello world!'), document.body); +``` + +[mdast options](https://github.com/wooorm/mdast#mdastprocessvalue-options-done) can be passed as the second argument: + +```js +converter('# Hello world[^2]!\n\n[^2]: A beautiful place.', {footnotes: true}); +``` + + ## Development Checklist - [x] Base library - [x] Unit testing -- [ ] Ship 1.0.0 to npm +- [x] Ship 1.0.0 to npm - [ ] _stretch goal_ - don't use `dangerouslySetInnerHTML` for arbitrary HTML in the markdown ## Known Issues