React Js Markdown

Posted on  by admin

Gource visualization of markdown-js (A Markdown parser for javascript. Markdown-to-jsx provides very efficeint functionality to interact with markdown in React component. It allows replacing/overriding of any HTML element with your Custom Component for markdown, here is the doc.

  1. React.js Markdown Editor Step By Step - Mikhail Evdokimov
  2. Videos For React Js Markdown
  3. Javascript - React.js Load Markdown File From System As ...
  4. How To Create A ReactJS App That Renders The Markdown File’s ...

React Native Markdown Package is a library for implementing markdown syntax in React Native.

Getting started

React-markdown uses a syntax tree to build the virtual dom which allows for updating only the changing DOM instead of completely overwriting. React-markdown is 100% CommonMark (optionally GFM) compliant and has extensions to support custom syntax. A basic hello world. See full list on npmjs.com.

To install this library, you can easily run this command from your project folder.

npm i react-native-markdown-package --save

Check this simple app for implementation example Example app

How to use

What you need to do is import the react-native-markdown-package module and then use the<Markdown/> tag.

How to use?

Here we are, take a look at this simple implementation:

Properties

styles

Default style properties will be applied to the markdown. You could replace it with your preference by adding styles property like the example above.

onLink

This prop will accept a function. This is a callback function for any link inside markdown syntax, so you could costumize the handler for onClick event from the link.

onLinkCallback should be a function that returns a promise.

NOTE :Email link (mailto) could be tested on real device only, it won't be able to test on Simulator as discuss in this StackOverflow

Thanks To

I'm very thankful to the contributors who help me to make this libary better:

React.js Markdown Editor Step By Step - Mikhail Evdokimov

This project was actually forked from lwansbrough , with some enhancements below :

  1. Styling method.

    Now you can easily add styling on each syntax, e.g. add different color either in strong, header, or another md syntax. All default styles in this package is also already moved to new file styles.js.

  2. Refactoring some codes to adopt ES6 style.

    Refactor index.js using ES6. :)

  3. Support Sublist.

    In the previous library, you couldn't add sublist. It was not supported. But now, this feature already added here. Please follow the instruction above...

  4. Latest release:

    • add Proptypes Support, (1.0.1)

    • Fix deprecated View.proptypes and update Readme (1.0.3)

    • Upgrade dependency, lodash, avoid vulnerabilities (1.1.0)

    • Fix performance issue, import only necessarry function from lodash (1.1.1)

    • Finalize Blockquote feature (1.2.0)

    • Update Docs (1.2.1)

    • Allow user to include plain text from variable using back tick (1.3.3)

    • New feature, codeblock (1.4.0)

    • New feature, on link handler (1.4.3)

    • Bug fix, Strike through issue (1.4.4)

    • Default Style for outer View, remove deprecated ComponentWillMount (1.5.0)

    • Allow user to replace default rules, update default font family for codeBlock on android (v1.6.0)

    • Update to use latest simple-markdown (v1.7.0)

    • Update to use latest simple-markdown (v1.8.0)

Happy Coding... ;)

Summary:In frontend development, we frequently need good WYSIWYG editors to take advanced inputs from the user. This post is the collection of best WYSIWYG editor components for React JS. Some of them also support markdown syntax.

React JS is the fastest-growing frontend framework but it is still relatively new as compared to Vanilla JS. The reason why I compared them is that there are plenty of WYSIWYG editors for Vanilla JS.

But because of React JS advanced internal mechanism, it is never recommended to use Vanilla JS scripts on top of that. The primary reason is that it makes the DOM unpredictable.

This is the main reason why I researched too much on finding the best WYSIWYG editor for React JS.

This is a curated list of best WYSIWYG editor components and libraries for React JS. Some of them also support Markdown syntax.

Best WYSIWYG Editors for React JS

Rich Markdown Editor

This is the editor that we use at HolyCoders. It is currently the best WYSIWYG editor with markdown support for React JS.

It is based on Prosemirror and outputs plain markdown which you can further convert to HTML using other tools.

The editor is very minimal and simple to use, plugged with advanced features.

Here is the list of features in Rich Markdown Editor for React JS.

  • Markdown support
  • Smart toolbars on the left side and top of selected text
  • Clean and minimal design
  • Paste rich contents
  • Advanced table editing
  • Custom embeds
  • Image uploader
  • Customizable
  • Todo List
  • Custom info, warning and tip notices

This editor is best suited for simple writing purposes.

Draft JS

This is not actually an editor but a framework to build WYSIWYG editors in React JS. It was worth adding in the list because of the features it provides.

If you want to invest some time this can be a custom solution suited for your own specific needs.

Before moving to the current solution I was developing a custom Draft JS editor for HolyCoders. Frustrated from the bugs, inactive plugins community and the amount of time it took in development it was good to hold the project.

Alloy Editor

Alloy editor is another amazing WYSIWYG editor for React JS. It is based on CKEditor and has a minimal and clean UI design.

It does not have Markdown support but allows basic formatting through toolbars.

Here is the list of features which Alloy editor provides.

  • Smart toolbars on the left and top of selected text
  • Paste images and Drag and Drop support
  • Insert images from device camera
  • Paste rich-text
  • Modern UI
  • Plugin Architecture

React Draft WYSIWYG

Videos For React Js Markdown

React Draft WYSIWYG is built on top of Draft JS. It is much like most of the traditional WYSIWYG editors, the big toolbar on the top and editing area below that.

If you want an advanced WYSIWYG text editor in React JS then this may be a good option. It is packed with almost all formatting features.

Here are some of the features of React Draft WYSIWYG editor.

  • Add/Remove controls or custom controls in the toolbar
  • Customize the toolbar
  • Emoji Support
  • Mentions and hashtag support
  • Image upload and alignment
  • RTL Support
  • Internationalization support
React

React Jodit WYSIWYG Editor

Jodit editor is another feature-packed WYSIWYG editor in our list. You can view the demo here.

The documentation says it is written in pure Typescript without any extra libraries.

The editor has plenty of options in the toolbar. The plugin support enables you to extend its functionality according to your own needs.

The UI looks pretty modern which is customizable.

React Froala WYSIWYG Editor

Froala Editor is a very beautiful and modern WYSIWYG editor. It is feature-packed WYSIWYG editor suitable for almost all-purpose. The best part of this editor is very clean and minimal UI design.

React Froala WYSIWYG Editor is published under MIT license but you need to purchase a separate license if you want to use some specific plugins.

Here are some features of React Froala WYSIWYG editor.

  • Plugins Support (Some plugins are paid)
  • Highly Customizable
  • Lots of formatting options
  • Clean and Modern design

React Quill WYSIWYG Editor

React Quill is yet another WYSIWYG in our list. The demo is enough to explain its features.React Js Markdown

It has also traditional WYSIWYG UI design with the toolbar on the top. The editor has many formatting options which makes it quite useful.

Javascript - React.js Load Markdown File From System As ...

The most interesting feature is that it is lightweight and its support for older browsers.

Dante 2

How To Create A ReactJS App That Renders The Markdown File’s ...

If you are a fan of the medium editor then this editor is for you. The editor is minimal and similar to the medium editor.

You can see the demo here. After selecting the test you will see the toolbar which contains some most useful options.

The editor is not yet stable. It has some markdown support but that too is buggy. The worst part is the license, you need to purchase a license if your applications source code is not public.

React Page Editor

This is a very powerful WYSIWYG editor for React JS. The block structure makes it unique in itself.

You can view the demo here.

I have found this editor a bit heavy compared to others. The features that it provides comes at a cost of performance.

It is not the fastest one but definitely one of the most advanced React JS WYSIWYG editors.

TinyMCE WYSIWYG Editor

If you have used WordPress then there are high chances you already know this editor.

It is much more focused on an enterprise solution. You will need to purchase a license for some plugins and advanced customizations.

The editor is open source and if you don’t need to use their premium plugins then you can use it for free.

Conclusion

These were some of the best React JS WYSIWYG editors which I found during my research for HolyCoders.

If you know any other good React JS editors feel free to share them in comments.

You can choose the best whichever suits your need.

If you are building a blog or simple text editing with markdown support I will recommend Rich markdown editor for React JS. It is the same editor that we use at HolyCoders.

For e-commerce and advanced applications, Froala editor will work great if you want to spend some money. The other option will be to develop a custom editor on top of Draft JS but as I have mentioned it will take a lot of time and energy.