@defensestation/blocknote-code
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

Code block for Blocknote

Stability Badge

Code block for Blocknote.

Demo

A demo is worth a thousand words

Installation

Install via YARN

Get the package

$ yarn add @defensestation/blocknote-code

Usage

Include module at your application

import { CodeBlock, insertCode } from "@defensestation/blocknote-code";

Create schema with code block.

const schema = BlockNoteSchema.create({
   blockSpecs: {
    ...defaultBlockSpecs,
    procode: CodeBlock,
  },
});

Add slash menu item.

<BlockNoteView
    editor={editor}
    slashMenu={false}
  >
    <SuggestionMenuController
      triggerCharacter={"/"}
      getItems={async (query) =>
        filterSuggestionItems(
          [...getDefaultReactSlashMenuItems(editor), insertCode()],
          query
        )
      }
    />
  </BlockNoteView>

Package Sidebar

Install

npm i @defensestation/blocknote-code

Weekly Downloads

16

Version

1.0.4

License

none

Unpacked Size

43.3 kB

Total Files

8

Last publish

Collaborators

  • harpal_singh
  • gsingh-ds