Online demo
https://harrychen0506.github.io/react-markdown-editor-lite/
Default configuration
Pluggable bars
npm install react-markdown-editor-lite --save
# or
yarn add react-markdown-editor-lite
Following steps:
// import react, react-markdown-editor-lite, and a markdown parser you like
import React from 'react';
import * as ReactDOM from 'react-dom';
import MarkdownIt from 'markdown-it';
import MdEditor from 'react-markdown-editor-lite';
// import style manually
import 'react-markdown-editor-lite/lib/index.css';
// Register plugins if required
// MdEditor.use(YOUR_PLUGINS_HERE);
// Initialize a markdown parser
const mdParser = new MarkdownIt(/* Markdown-it options */);
// Finish!
function handleEditorChange({ html, text }) {
console.log('handleEditorChange', html, text);
}
export default props => {
return (
<MdEditor style={{ height: '500px' }} renderHTML={text => mdParser.render(text)} onChange={handleEditorChange} />
);
};
If you are using a server-side render framework, like Next.js, Gatsby, please use client-side render for this editor.
For example, Next.js has next/dynamic, Gatsby has loadable-components
Following is a example for Next.js:
import dynamic from 'next/dynamic';
import 'react-markdown-editor-lite/lib/index.css';
const MdEditor = dynamic(() => import('react-markdown-editor-lite'), {
ssr: false,
});
export default function() {
return <MdEditor style={{ height: '500px' }} renderHTML={/* Render function */} />;
}
With plugins:
import dynamic from 'next/dynamic';
import 'react-markdown-editor-lite/lib/index.css';
const MdEditor = dynamic(
() => {
return new Promise(resolve => {
Promise.all([
import('react-markdown-editor-lite'),
import('./my-plugin'),
/** Add more plugins, and use below */
]).then(res => {
res[0].default.use(res[1].default);
resolve(res[0].default);
});
});
},
{
ssr: false,
},
);
export default function() {
return <MdEditor style={{ height: '500px' }} renderHTML={/* Render function */} />;
}
Full example see here
Since 1.1.0, You can add script
and link
tags in your browser and use the global variable ReactMarkdownEditorLite
.
You can download these files directly from
Note: you should import react before ReactMarkdownEditorLite
.
For example, in webpack, you import ReactMarkdownEditorLite by script
tag in your page, and write webpack config like this:
externals: {
react: 'React',
'react-markdown-editor-lite': 'ReactMarkdownEditorLite'
}
前言 笔者在18年年末的时候接到一个开发任务——搭建一个AI项目的开放平台,其中的产品文档为转化为HTML格式的markdown文档。考虑到文档的即时更新,将文档信息做成了Ajax接口的形式。因此管理后台只需将textarea表单的内容通过markdown解析器进行HTML格式转化,然后将markdown内容和经转化的HTML文档都保存到数据库即可。 基本需求完成后,为了更好的用户体验,考虑将常用
介绍 由于需要用到react下的markdown编辑器功能,网上开源的react markdown编辑器不多,没有找到合适的,索性自己写一个。markdown编辑器主要功能就是预览,for-editor是一款react下的markdown编辑器,拥有预览,快捷添加标签,上一步,下一步功能,行号等功能,后续逐步完善更多功能。 预览 for-editor预览 for-editor源码地址 欢迎issu
react-markdown-editor 是 React.js 和 TypeScript 实现的 Markdown 编辑器。 Markdown 编辑器带预览功能 安装 npm i @uiw/react-markdown-editor 文档 文档实例预览:demo preview (����中国镜像网站) 使用 import MarkdownEditor from '@uiw/react-mark
Windows下全功能的Markdown编辑器(x86桌面版),软件截图如下: MarkDownEditor与该平台其他主流编辑器的比较如图: 主要功能其实在上面的表格里面都有介绍,我就捡几个重要的feature说: 支持Markdown,Strict Markdown,Github Markdown,PHP Markdown Extra,MultiMarkdown,CommonMark这6中Ma
markdown-editor 是基于 Web 的实时的 Markdown 编辑器,支持 Github 风格 Markdown 格式,提供语法高亮效果。
rich-markdown-editor A React and Prosemirror based editor that powers Outline and can also be used for displaying content in a read-only fashion.The editor is WYSIWYG and includes formatting tools whi
Arya - 在线 Markdown 编辑器 �� 基于 Vue、Vditor,所构建的在线 Markdown 编辑器,支持绘制流程图、甘特图、时序图、任务列表、echarts 图表、五线谱,以及 PPT 预览、视频音频解析、HTML 自动转换为 Markdown 等功能。markdown.lovejade.cn 背景初衷 早期就有关注到由黑客派所出品的 Vditor:一款为未来而构建的下一代 M
martor Martor is a Markdown Editor plugin for Django, supported for Bootstrap & Semantic-UI. Features Live Preview Integrated with Ace Editor Supported with Bootstrap and Semantic-UI Supported Multipl