### Code Block Plugin

The Code Block plugin lets users insert formatted code snippets.

> **Note:** There is no `pluginCodeBlockViewer` — code blocks render natively without a viewer plugin.

#### Editor

```tsx widget
import { pluginCodeBlock, RicosEditor } from '@wix/ricos';
import React from 'react';

export default () => (
  // @essential-start
  <RicosEditor placeholder={'Add a code block...'} plugins={[pluginCodeBlock()]} />
  // @essential-end
);
```

#### Viewer

```tsx widget
import '@wix/ricos/css/ricos-viewer.global.css';
import { type RicosDocument, RicosViewer } from '@wix/ricos';
import React from 'react';

const content = {
  nodes: [
    {
      type: 'CODE_BLOCK',
      id: 'example-id',
      nodes: [
        {
          type: 'TEXT',
          id: '',
          textData: {
            text: "console.log('Hello, world!');\nconsole.log(new Date);",
          },
        },
      ],
      codeBlockData: {},
    },
  ],
} as RicosDocument;

// @essential-start
export default () => <RicosViewer content={content} />;
// @essential-end
```
