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

5.0.57 • Public • Published

ndla-code

Editor and preview for ndla code block

Installation

$ yarn add ndla-code

Usage

codeblock:

import { Codeblock } from "@ndla/code";

<Codeblock code={code} format={format} title={title} />;

editor: The user is responsible for loading prism syntaxes, the code editor does not do it for you. The highlight function is expecting a properly tokenized Prism string as its return value.

import { CodeBlockEditor } from '@ndla/code';

model = {{
  code: "string",
  title: "Text",
  format: "text",
}}

<CodeBlockEditor
  content={model}
  onSave={handleSaveFunction}
  onAbort={handleExitFunction}
/>

Readme

Keywords

Package Sidebar

Install

npm i @ndla/code

Weekly Downloads

450

Version

5.0.57

License

GPL-3.0

Unpacked Size

228 kB

Total Files

33

Last publish

Collaborators

  • kronen_ki
  • rauboti
  • mapoken
  • katrinewi
  • ndlauser
  • jonasc-knowit
  • gunnarvelle
  • jnatten