Giter Site home page Giter Site logo

majodurco / react-markdown-editor Goto Github PK

View Code? Open in Web Editor NEW

This project forked from webscopeio/react-markdown-editor

0.0 2.0 0.0 226 KB

Github-like markdown editor with emoji support

Home Page: https://webscope-react-markdown-editor.firebaseapp.com/

HTML 2.30% JavaScript 85.17% CSS 12.53%

react-markdown-editor's Introduction

react-markdown-editor

Markdown editor with Github-like autocomplete

CircleCI

demo

Install

yarn add @webscopeio/react-markdown-editor

Demo

https://webscope-react-markdown-editor.firebaseapp.com/

Why does it exist?

We needed a simple markdown editor with preview functionality and OOTB support for emojis.

Since we're very satisfied with Github's markdown editor, the goal is to get as close as possible to it's functionality.

Core characteristics

  1. Out of the box solution - It should be possible to use this plugin without futher configuration/coding - yarn install & import and you're ready to go -> If you're looking for more customizable solution, check out @webscopeio/react-textarea-autocomplete, which is more low-level.
  2. Configurable - Even though it's working OOTB, it is possible to override styles (especially with CSS modules) or pass custom properties to any of the components at the lower level (RTA, showdown)
  3. Modular - We plan to export smaller chunks of this solution either directly or as a separate npm modules in a future (markdown functionality, autocomplete functionality, etc.)
  4. TDD - We write test before functionality is implemented

Usage

import React, { Component } from 'react'

import ReactMarkdownEditor from '@webscopeio/react-markdown-editor'

export default class App extends Component {
  state = {
    value: 'Hello world',
  }

  render () {
    return (
      <div>
        <ReactMarkdownEditor
          placeholder={'Write something ...'}
          value={this.state.value}
          onChange={({ target: { value } }) => this.setState({ value })}
        />
      </div>
    )
  }
}

Properties

Props Type Description Default
value string value property ''
onChange (Event) => void onChange handler None
placeholder string Placeholder value ''
textAreaProperties Object RTA properties {}
noPreviewMessage string Message to be displayed in a preview panel if no content is present Nothing to preview
previewClass string Main class name that is used to format Markup preview markdown-body see githubb-markdown-css
classes {[key: string]: string} classes / CSS modules reference to override styling

Styling

We provide basic styles so that the plugin can be used out of the box. You can override styles by passing classes property.

Ideally, you will pass a reference to your CSS module. Check out the source code for more info. Optionally you can pass class names directly if you don't use CSS modules.

Acknowledgment

If I have seen further it is by standing on ye sholders of Giants. (Isaac Newton)

This library is here thanks to the great open source software that is used under the hood. The most important parts are:

License

MIT

react-markdown-editor's People

Contributors

jvorcak avatar

Watchers

James Cloos avatar Marián Ďurčo 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.