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

@duskmoon-dev/el-markdown-input

v1.5.4

Published

A form-associated custom element providing a full-featured markdown editor.

Readme

@duskmoon-dev/el-markdown-input

A form-associated custom element providing a full-featured markdown editor.

Features

  • Write / Preview tabs — switch between editing and rendered output
  • Syntax highlighting — backdrop technique with Prism.js (lazy CDN load)
  • File upload — drag-and-drop, clipboard paste, or file picker with progress
  • Autocomplete@mention and #reference with keyboard navigation
  • Status bar — live word / character count with optional max-words cap
  • Form participation — native <form> submission via ElementInternals
  • LiveView hook — first-class Phoenix LiveView integration

Installation

bun add @duskmoon-dev/el-markdown-input

Basic Usage

<script type="module">
  import { register } from '@duskmoon-dev/el-markdown-input';
  register();
</script>

<form method="post">
  <el-dm-markdown-input name="body" placeholder="Write markdown…"></el-dm-markdown-input>
  <button type="submit">Save</button>
</form>

Attributes

| Attribute | Type | Default | Description | |--------------|---------|-----------------|-----------------------------------------------| | name | string | "" | Form field name | | value | string | "" | Initial markdown content | | placeholder| string | "Write markdown…" | Textarea placeholder | | disabled | boolean | false | Disables editing | | upload-url | string | — | POST endpoint returning { url: string } | | max-words | number | — | Soft word cap in status bar | | dark | boolean | false | Dark Prism theme + dark CSS variable defaults |

Public API

el.getValue(): string
el.setValue(str: string): void
el.insertText(str: string): void
el.setSuggestions(list: Suggestion[]): void

Events

| Event | Detail | When | |-------------------|-------------------------------------------------|-----------------------------| | change | { value: string } | On every input | | upload-start | { file: File } | File accepted for upload | | upload-done | { file: File, url: string, markdown: string } | Upload completed | | upload-error | { file: File, error: string } | Upload failed | | mention-query | { trigger: "@", query, resolve } | User typed @word | | reference-query | { trigger: "#", query, resolve } | User typed #word |

CSS Custom Properties

| Property | Default (light) | Purpose | |-------------------|-------------------------|----------------------------| | --md-border | var(--color-outline) | Editor border | | --md-border-focus | var(--color-primary) | Focus ring colour | | --md-bg | var(--color-surface) | Editor background | | --md-bg-toolbar | var(--color-surface-variant) | Toolbar background | | --md-text | var(--color-on-surface) | Primary text colour | | --md-text-muted | var(--color-on-surface-variant) | Muted text colour | | --md-accent | var(--color-primary) | Tab active indicator | | --md-radius | 6px | Border radius | | --md-upload-bar | var(--color-primary) | Upload progress bar |

File Upload

<el-dm-markdown-input upload-url="/api/uploads"></el-dm-markdown-input>

The endpoint must accept POST multipart/form-data with field file and respond with:

{ "url": "https://cdn.example.com/file.png" }

Autocomplete

el.addEventListener('mention-query', async (e) => {
  const users = await fetchUsers(e.detail.query);
  e.detail.resolve(users.map(u => ({
    id: u.handle,
    label: u.name,
    subtitle: u.email
  })));
});

Phoenix LiveView

// app.js
import { MarkdownInputHook, register } from '@duskmoon-dev/el-markdown-input';
register();

let liveSocket = new LiveSocket('/live', Socket, {
  hooks: { MarkdownInput: MarkdownInputHook }
});
<el-dm-markdown-input
  id="body-input"
  name="body"
  data-value={@content}
  phx-hook="MarkdownInput"
/>