Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Markdown wysiwyg and markup editor

License

NotificationsYou must be signed in to change notification settings

gravity-ui/markdown-editor

Repository files navigation

Markdown Editor

@gravity-ui/markdown-editor ·npm packageCIReleasestorybook

Markdown wysiwyg and markup editor

MarkdownEditor is a powerful tool for working with Markdown, which combines WYSIWYG and Markup modes. This means that you can create and edit content in a convenient visual mode, as well as have full control over the markup.

🔧 Main features

  • Support for the basic Markdown andYFM syntax.
  • Extensibility through the use of ProseMirror and CodeMirror engines.
  • The ability to work in WYSIWYG and Markup modes for maximum flexibility.

Install

npm install @gravity-ui/markdown-editor

Required dependencies

Please note that to start using the package, your project must also have the following installed:@diplodoc/transform,react,react-dom,@gravity-ui/uikit,@gravity-ui/components and some others. Check out thepeerDependencies section ofpackage.json for accurate information.

Getting started

The markdown editor is supplied as a React hook to create an instance of editor and a component for rendering the view.
To set up styling and theme seeUIKit docs.

importReactfrom'react';import{useMarkdownEditor,MarkdownEditorView}from'@gravity-ui/markdown-editor';functionEditor({onSubmit}){consteditor=useMarkdownEditor({allowHTML:false});React.useEffect(()=>{functionsubmitHandler(){// Serialize current content to markdown markupconstvalue=editor.getValue();onSubmit(value);}editor.on('submit',submitHandler);return()=>{editor.off('submit',submitHandler);};},[onSubmit]);return<MarkdownEditorViewstickyToolbarautofocuseditor={editor}/>;}

Read more:

Development

To start the dev storybook

npm start

i18n

To set up internationalization, you just need to use theconfigure:

import{configure}from'@gravity-ui/markdown-editor';configure({lang:'ru',});

Don't forget to callconfigure() fromUIKit and other UI libraries.

Contributing


[8]ページ先頭

©2009-2025 Movatter.jp