Code
Verified

Write monospaced code with syntax highlighting in a range of programming and markup languages

By @hashβ€’V0.2.1
{}

The Code block uses a custom code editing component to support syntax highlighting for 15 programming languages (listed below).

An optional caption can be added below the code snippet and a "Copy" button copies the whole code snippet to the clipboard.

Programmatic Usage

The block stores its state locally in the following properties, (view the Code Block entity type to see these in context):

Whenever the code editing textarea is blurred, the caption input is blurred, or the language selection is changed, the Graph Module's updateEntity method is called to save the local data to the embedding application.

Supported language syntax

  • C#
  • CSS
  • Dart
  • Erlang
  • Go
  • Haml
  • Java
  • JavaScript
  • JSON
  • React JSX
  • Markup
  • Python
  • Ruby
  • Rust
  • TypeScript

Ready to build your own blocks?

Anyone can contribute

Anyone can create blocks and contribute to this growing, open-source registry of blocks. Read our quickstart guide to start building your own blocks.

Read the quickstart guide