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

@defensestation/blocknote-subscript-superscript

v0.1.0

Published

Subscript and superscript styles plus React toolbar buttons for BlockNote.

Readme

BlockNote subscript and superscript

A small BlockNote plugin that adds semantic subscript and superscript styles, along with formatting-toolbar buttons. It exports styled content as native <sub> and <sup> elements and recognises those elements when HTML is pasted into the editor.

Install

npm install @defensestation/blocknote-subscript-superscript

Use

Add the supplied style specs to the schema, then add the two buttons to a custom formatting toolbar. The editor prop is deliberately inferred from your schema, so style methods remain type-safe.

import { BlockNoteSchema, defaultStyleSpecs } from "@blocknote/core";
import { BlockNoteView } from "@blocknote/mantine";
import {
  BasicTextStyleButton,
  FormattingToolbar,
  FormattingToolbarController,
  useCreateBlockNote,
} from "@blocknote/react";
import {
  SubscriptButton,
  SuperscriptButton,
  createSubscriptSuperscriptShortcuts,
  subscriptSuperscriptStyleSpecs,
} from "@defensestation/blocknote-subscript-superscript";

const schema = BlockNoteSchema.create({
  styleSpecs: {
    ...defaultStyleSpecs,
    ...subscriptSuperscriptStyleSpecs,
  },
});

function Editor() {
  const editor = useCreateBlockNote({
    schema,
    extensions: [
      createSubscriptSuperscriptShortcuts({
        // Avoid ⌘, which commonly opens application settings on macOS.
        subscript: "Mod-Alt-,",
        superscript: "Mod-Alt-.",
      }),
    ],
  });

  return (
    <BlockNoteView editor={editor} formattingToolbar={false}>
      <FormattingToolbarController
        formattingToolbar={() => (
          <FormattingToolbar>
            <BasicTextStyleButton basicTextStyle="bold" />
            <BasicTextStyleButton basicTextStyle="italic" />
            <SubscriptButton editor={editor} />
            <SuperscriptButton editor={editor} />
          </FormattingToolbar>
        )}
      />
    </BlockNoteView>
  );
}

toggleSubscriptSuperscript(editor, "subscript") and toggleSubscriptSuperscript(editor, "superscript") are also exported for custom menus or keyboard shortcuts. Toggling either style removes the other.

Keyboard shortcuts

Use createSubscriptSuperscriptShortcuts to select the key combinations your application can safely reserve. Mod means Command on macOS and Control on Windows/Linux. The example above uses Mod-Alt-, and Mod-Alt-. to avoid the common macOS ⌘, settings shortcut.

The subscriptSuperscriptShortcuts export uses those macOS-safe defaults when you do not need custom bindings: Mod-Alt-, for subscript and Mod-Alt-. for superscript. Disable either binding with false:

createSubscriptSuperscriptShortcuts({
  subscript: false,
  superscript: "Mod-Alt-.",
});

Publishing

Pushes to main publish the version in package.json with npm's latest tag. Bump that version before a release; the workflow skips versions that are already published. Pushes to dev publish an isolated prerelease such as 0.1.0-dev.42 under npm's dev tag.

Configure npm trusted publishing for this GitHub repository, or add an NPM_TOKEN repository secret with permission to publish this package.

Local Vite development

The published package uses peer dependencies, so a normal install shares the host application's React and BlockNote runtimes. If you use npm link or a file: dependency while developing with Vite, configure Vite to deduplicate them; otherwise Vite can resolve a second React or Yjs copy from the linked package:

// vite.config.ts
import { defineConfig } from "vite";

export default defineConfig({
  resolve: {
    dedupe: [
      "react",
      "react-dom",
      "@blocknote/core",
      "@blocknote/react",
      "yjs",
    ],
  },
});