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

tiptap-markdown-textarea

v1.0.0

Published

Portable Tiptap Markdown editor for enhancing textarea fields

Readme

Tiptap Markdown Editor

Portable module that upgrades a standard <textarea> into a Tiptap + Markdown editor for host applications.

Disclaimer

This project is not affiliated with the official Tiptap project.

It is a lightweight wrapper that adds Markdown support and a portable toolbar for enhancing textarea fields.

Production Install

npm

npm install tiptap-markdown-textarea

CDN (version-pinned)

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/tiptap-markdown-textarea.css">
<script type="module">
  import { init } from 'https://cdn.jsdelivr.net/npm/[email protected]/dist/tiptap-markdown-textarea.js';
  await init('message-editor');
</script>

Quick Start (Production)

<form method="post" action="/save" id="message-form">
  <textarea id="message-editor" name="message" data-tiptap-markdown></textarea>
  <button type="submit">Save</button>
</form>

<link rel="stylesheet" href="/dist/tiptap-markdown-textarea.css">
<script type="module">
  import { init } from '/dist/tiptap-markdown-textarea.js';

  try {
    await init('message-editor', {
      height: 360,
      counter: true,
    });
  } catch (error) {
    console.error('Editor initialization failed.', error);
  }
</script>

Configuration

API

  • init(textareaId, options = {}) -> returns controller
  • initAll(selector = 'textarea[data-tiptap-markdown][id]', options = {}) -> returns controller array
  • destroy(textareaId) -> destroys one mounted editor

Controller Methods

  • getMarkdown()
  • setMarkdown(markdown)
  • focus()
  • isEmpty()
  • setDisabled(boolean)
  • setReadonly(boolean)
  • destroy()

Callbacks

  • onReady(controller)
  • onChange(markdown, controller)
  • onFocus(controller)
  • onBlur(controller)
  • onError(error, context)

Common Options

Core:

  • height
  • placeholder
  • disabled
  • readonly
  • toolbarCommands
  • messages
  • htmlAttributes

UX/perf:

  • counter (true or { mode: 'words' | 'characters' | 'both' })
  • shortcuts
  • debounceMs (default 120)
  • syntaxHighlighting (true by default)
  • syntaxHighlighting: { enabled?: boolean, languages?: string[] }
  • default highlight languages: json, js, ts, bash, markdown

Safety limits:

  • limits.maxLinkUrlLength
  • limits.maxImageUrlLength
  • limits.maxImageAltLength
  • limits.maxTableRows
  • limits.maxTableCols

Styling:

  • iconSet: 'text' | 'fontawesome'
  • classes
  • classes.toolbarButtonByAction

Error Handling Contract

init(...) and initAll(...) throw TiptapMarkdownEditorError when setup/config is invalid.

Error codes:

  • E_INVALID_TEXTAREA_ID
  • E_TEXTAREA_NOT_FOUND
  • E_FORM_NOT_FOUND
  • E_INVALID_SELECTOR
  • E_INVALID_OPTION
  • E_INIT_FAILED

Use try/catch around await init(...) / await initAll(...).

Migration and Upgrades

Legacy aliases remain in 1.x and are deprecated:

  • initTiptapMarkdownEditor(...)
  • initAllTiptapMarkdownEditors(...)

Removal is planned for 2.0.0.

Examples (Copy-Paste)

Troubleshooting

  • E_TEXTAREA_NOT_FOUND: check id and script execution timing.
  • E_FORM_NOT_FOUND: editor textarea must be inside a <form>.
  • E_INVALID_SELECTOR: validate selector passed to initAll(...).
  • Empty toolbar/icons: ensure CSS is loaded and custom class overrides are valid.
  • URL rejected in dialogs: only http/https URLs are accepted.

Compatibility and Overrides

Security

Performance

npm run bench:perf

Changelog

Development

npm install
npm run build
npm test