Giter VIP home page Giter VIP logo

react-md-editor's Introduction

React Markdown Editor

A Markdown Editor for React.js, built with CodeMirror.

This is a work in progress. Format application and removal is not very robust, some formats are missing.

Demo & Examples

Live demo: JedWatson.github.io/react-md-editor

To build the examples locally, run:

npm install
npm start

Then open localhost:8000 in a browser.

Installation

The easiest way to use codemirror is to install it from NPM and include it in your own React build process (using Browserify, Webpack, etc).

You can also use the standalone build by including dist/codemirror.js in your page. If you use this, make sure you have already included React, and it is available as a global variable.

npm install codemirror --save

Usage

var React = require('react'),
	Editor = require('react-md-editor');

var App = React.createClass({
	getInitialState: function() {
		return {
			code: "# Markdown"
		};
	},
	updateCode: function(newCode) {
		this.setState({
			code: newCode
		});
	},
	render: function() {
		return <Editor value={this.state.code} onChange={this.updateCode} />
	}
});

React.render(<App />, document.getElementById('app'));

Properties

  • value String the markdown
  • options Object (newValue) options passed to the CodeMirror instance
  • onChange Function (newValue) called when a change is made

See the CodeMirror API Docs for the available options.

License

MIT. Copyright (c) 2016 Jed Watson.

react-md-editor's People

Contributors

ansont avatar archerzhao avatar gaoxiaoliangz avatar idris avatar jedwatson avatar jossmac avatar seekshiva avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.