npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

neo-md

v1.3.2

Published

A modern, highly-configurable, and highly-secure React markdown editor component. Built with React and Tailwind CSS, it provides dual-pane live preview capabilities, syntax highlighting, and an extensive Props API for controlled or uncontrolled states.

Downloads

1,040

Readme

React Markdown Editor

A modern, highly-configurable, and highly-secure React markdown editor component. Built with React and Tailwind CSS, it provides dual-pane live preview capabilities, syntax highlighting, and an extensive Props API for controlled or uncontrolled states.

Markdown Editor Screenshot

Features

  • Markdown Toolbar - Built-in formatting toolbar with buttons for bold, italic, strikethrough, headings (H1-H3), lists, blockquote, code blocks, links, images, tables, and horizontal rules. Wraps selected text or inserts templates with smart cursor repositioning.
  • Bidirectional Scroll Sync - Proportional scroll synchronization between editor and preview panes. Scrolling either pane keeps the other in lockstep.
  • ASCII & Diagram Support - Precise whitespace preservation in plain text code blocks (```), ensuring text-based diagrams and ASCII art render exactly as typed without space collapsing.
  • XSS Prevention - Raw HTML rendering in the editor pane is secured via isomorphic-dompurify.
  • Syntax Highlighting - Fully customizable color themes for the editor pane with support for headings, bold, italic, links, code blocks, lists, tables, and more.
  • Controlled & Uncontrolled Support - Plug it into external state naturally like a standard input element, or let it manage its own.
  • Deep Customizability - Apply your own className structures mapping to the editor pane, preview pane, and toolbar.
  • Ref Forwarding - Programmatically trigger focus or grab values using useImperativeHandle and forwardRef.
  • Custom Renderers - Inject your own custom React components directly into the react-markdown DOM rendering pipeline.
  • Live Preview - Real-time rendering of markdown content with split-pane editing.
  • Dark Mode Support - Built-in Tailwind theming compatible with system preferences.

Demo

Live Demo | GitHub

Installation

npm install neo-md
# or
yarn add neo-md
# or
pnpm add neo-md
# or
bun add neo-md

You must also have react and react-dom installed, as they are peer dependencies.

Usage

Basic Implementation (Uncontrolled)

By default, the editor works out of the box with zero configuration necessary.

import { MarkdownEditor } from "neo-md";

// Important: import the CSS!
import "neo-md/react-markdown-editor.css";

function App() {
  return (
    <div className="h-screen py-8">
      <MarkdownEditor />
    </div>
  );
}

Advanced Implementation (Controlled)

Control the text value, track the current pane view mode, and alter the default toolbar state using the rich Props API.

import { useState, useRef } from "react";
import { MarkdownEditor, MarkdownEditorRef } from "neo-md";
import "neo-md/react-markdown-editor.css";

function App() {
  const [markdown, setMarkdown] = useState("# Initial Text");
  const [view, setView] = useState<"edit" | "preview" | "split">("split");
  const editorRef = useRef<MarkdownEditorRef>(null);

  const focusEditor = () => editorRef.current?.focus();

  const customRenderers = {
    h1: ({ children }) => (
      <h1 className="text-4xl text-blue-500">{children}</h1>
    ),
  };

  return (
    <div className="h-screen py-8">
      <button onClick={focusEditor}>Focus Textarea</button>

      <MarkdownEditor
        ref={editorRef}
        value={markdown}
        onChange={setMarkdown}
        viewMode={view}
        onViewModeChange={setView}
        components={customRenderers}
        showWordCount={false}
        enableCopy={false}
        className="my-custom-wrapper"
        placeholder="Type something amazing..."
      />
    </div>
  );
}

API Reference

The MarkdownEditor component accepts the following props:

| Prop | Type | Default | Description | | --------------------- | -------------------------------- | -------------------- | ----------------------------------------------------- | | value | string | undefined | The controlled markdown text. | | defaultValue | string | (default template) | Initial text for uncontrolled mode. | | onChange | (value: string) => void | undefined | Callback fired when text changes. | | viewMode | "edit" \| "preview" \| "split" | undefined | The controlled view mode. | | defaultViewMode | "edit" \| "preview" \| "split" | "split" | Initial view mode for uncontrolled mode. | | onViewModeChange | (mode) => void | undefined | Callback fired when a toolbar tab is clicked. | | className | string | "" | Classes applied to the root container. | | editorClassName | string | "" | Classes applied to the editor pane wrapper. | | previewClassName | string | "" | Classes applied to the preview pane wrapper. | | showToolbar | boolean | true | Shows the top toolbar block. | | showWordCount | boolean | true | Shows the character counter badge. | | showMarkdownToolbar | boolean | true | Shows the markdown formatting toolbar. | | enableDownload | boolean | true | Toggles the "Download" button. | | enableCopy | boolean | true | Toggles the "Copy" button. | | enableScrollSync | boolean | true | Toggles bidirectional scroll sync between panes. | | placeholder | string | "Start typing..." | Textbox placeholder text. | | readOnly | boolean | false | Disables text input and hides the formatting toolbar. | | maxLength | number | undefined | Hard cap on textarea character length. | | components | Components | {} | Complete react-markdown DOM rendering overrides. | | syntaxColors | SyntaxHighlightColors | defaultColors | Custom color theme for syntax highlighting. |

Exposed Methods (MarkdownEditorRef)

Via forwardRef, parents can trigger the following imperatives on the editor:

  • focus(): Forces browser focus onto the underlying <textarea>.
  • getValue(): Retrieves the current internal markdown string, particularly useful if you run uncontrolled mode and just want the value on submit.

Contributing

Contributions are welcome! Please see our Contributing Guide for detailed information on how to get started, development workflow, and coding guidelines.

License

This project is licensed under the MIT License.