GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com โ€” GitHub - gravity-ui/markdown-editor: Markdown wysiwyg and markup editor

BranchesTags
Open more actions menu

Latest commit

 

History

1,174 Commits
1,174 Commits

Folders and files

NameName
Last commit message
Last commit date
.claude
.claude
 
 
.github
.github
 
 
.release-please
.release-please
 
 
demo
demo
 
 
docs
docs
 
 
infra
infra
 
 
packages
packages
 
 
.editorconfig
.editorconfig
 
 
.gitignore
.gitignore
 
 
.npmrc
.npmrc
 
 
.nvmrc
.nvmrc
 
 
AGENTS.md
AGENTS.md
 
 
CODEOWNERS
CODEOWNERS
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE.txt
LICENSE.txt
 
 
README-ru.md
README-ru.md
 
 
README.md
README.md
 
 
commitlint.config.mjs
commitlint.config.mjs
 
 
eslint.config.mjs
eslint.config.mjs
 
 
nx.json
nx.json
 
 
package.json
package.json
 
 
pnpm-lock.yaml
pnpm-lock.yaml
 
 
pnpm-workspace.yaml
pnpm-workspace.yaml
 
 
prettier.config.mjs
prettier.config.mjs
 
 
stylelint.config.mjs
stylelint.config.mjs
 
 

Repository files navigation

Markdown Editor

@gravity-ui/markdown-editor ยท npm package CI Release storybook

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 and YFM 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 the peerDependencies section of package.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 see UIKit docs.

import React from 'react';
import {useMarkdownEditor, MarkdownEditorView} from '@gravity-ui/markdown-editor';

function Editor({onSubmit}) {
  const editor = useMarkdownEditor({allowHTML: false});

  React.useEffect(() => {
    function submitHandler() {
      // Serialize current content to markdown markup
      const value = editor.getValue();
      onSubmit(value);
    }

    editor.on('submit', submitHandler);
    return () => {
      editor.off('submit', submitHandler);
    };
  }, [onSubmit]);

  return <MarkdownEditorView stickyToolbar autofocus editor={editor} />;
}

Read more:

  • How to connect the editor in the Create React App
  • How to add preview for markup mode
  • How to add HTML extension
  • How to add Latex extension
  • How to add Mermaid extension
  • How to write extension
  • How to add GPT extension
  • How to add text binding extension in markdown

Development

  1. Install Nodejs environment, version is specified in .nvmrc file. We recommend using NVM or a similar tool.
  2. Install pnpm, version is specified in package.json in "packageManager" property.
  3. Install dependencies: pnpm i
  4. Run storybook dev-server: pnpm start

i18n

To set up internationalization, you just need to use the configure:

import {configure} from '@gravity-ui/markdown-editor';

configure({
  lang: 'ru',
});

Don't forget to call configure() from UIKit and other UI libraries.

Contributing

  • Contributor Guidelines

License

Distributed under the MIT License. See LICENSE for details.

For AI agents

A dual-mode Markdown editor for React that combines a WYSIWYG mode (ProseMirror) and a raw markup mode (CodeMirror), with support for basic Markdown and YFM.

When to use

  • Editing Markdown/YFM content with a switchable visual (WYSIWYG) and source (markup) view.
  • You need an extensible editor: custom marks, nodes, toolbar items, and extensions (HTML, LaTeX, Mermaid, GPT) via the ProseMirror/CodeMirror engines.
  • Rendering the editor UI: create the instance with useMarkdownEditor and render it with MarkdownEditorView.

When not to use

  • Read-only rendering of Markdown to HTML with no editing โ€” transform it with @diplodoc/transform and render the output instead.
  • Plain multiline text input โ€” use TextArea from @gravity-ui/uikit.
  • Rich-text that is not Markdown/YFM โ€” this editor is Markdown-first.

Common pitfalls

  • It is a hook plus a view, not one component. Create the instance with useMarkdownEditor(...) and pass it to <MarkdownEditorView editor={editor} />; there is no single <MarkdownEditor> you render directly.
  • Read the value via the instance, not a controlled value prop. Call editor.getValue() (e.g. on the submit event) to serialize to Markdown; the editor manages its own state.
  • Peer dependencies are required. Your project must provide @diplodoc/transform, @gravity-ui/uikit, @gravity-ui/components, react, and react-dom โ€” check the peerDependencies in package.json.
  • Styles and i18n come from uikit. Set up theming/styles per the uikit docs and call configure({lang}) from both this package and @gravity-ui/uikit.

Documentation for AI agents

Agent-readable documentation for the installed version is located in node_modules/@gravity-ui/markdown-editor/build/docs/INDEX.md.

About

Markdown wysiwyg and markup editor

preview.gravity-ui.com/md-editor/

Topics

codemirrordiplodocgfmmarkdownprosemirrorreactwysiwygyfm

Resources

Readme
MIT license

Contributing

Contributing
Activity
Custom properties

Stars

428 stars

Watchers

13 watching

Forks

49 forks
Report repository

Releases

Used by

Contributors

Languages

You are visitor 01402503 โ€” GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800ร—600. No cookies required.