0.1.3 • Published 8 years ago

react-markdown-light v0.1.3

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

react-markdown-editor

A markdown editor using React/Reflux.

Build Status Code Climate License Latest Version Total Downloads

##TLDR Demo here: http://jrm2k6.github.io/react-markdown-editor/

Installation

npm install --save react-markdown-editor

Features

From the UI:

  • Bold
  • Italic
  • Header
  • Subheader
  • Link
  • Unordered List
  • Inline Images

Of course it is a regular markdown editor (using the nice markdown-js library), so you are not limited to the UI.

Usage

To render the component:

var React = require('react');
var MarkdownEditor = require('react-markdown-editor').MarkdownEditor;

var TestComponent = React.createClass({
	render: function() {
		return (
			<MarkdownEditor initialContent="Test" iconsSet="font-awesome"/>
		);
	}
});

React.render(<TestComponent />, document.getElementById('content'));

<MarkdownEditor /> takes two required props:

- initialContent which is the text you want the textarea to contain on initialization.
- iconsSet which is the icons provider you want to use. It can either be font-awesome or materialize-ui

Optional props:

  • onContentChange, function to be called on each content change (as the property name says!)

You can also listen to content changes on the editor. If you are using Reflux, by listening to the changes on MarkdownEditorContentStore. To be able to do so, just require('react-markdown-editor').MarkdownEditorContentStore;

Dependencies

You can modify the styles directly by modifying the styles declared in dist/MarkdownEditor.js. The pre-existing styles assume that you are using Bootstrap and Font Awesome.

TODO

  • Better solution for styles
  • Cross-browsers testing
  • Move to Redux

Example

cd Example
npm install
webpack
open index.html

Issues/Contribution

You can open an issue on the github repo, or contact me directly by email.

Help

Please, if you are using this package, let me know. I am interested to know what you think of it, even if it was on a tiny side-project.

Screenshots

Editing tab Preview tab