Guides
Blocks
Plugins

Code

A code block contains multiple lines of codes. You can also define the language that can then be used to colorize the code. Check the HLJS Plugin for more information.

Block Type: "code"
Require Client: No
Parameters:
  • Caption
  • Rich Text
  • Language
<div class="notion-code">
  <pre>
    <code class="language-typescript">
      import { defineDatabase, makeSource } from 'contentlayer-source-notion';
      
      export const Block = defineDatabase(() =&gt; ({
        name: 'Block',
        databaseId: '&lt;databaseId&gt;',
      }));

      export default makeSource({
        client,
        renderer,
        databaseTypes: [Block],
      });
      </code>
    </pre>
  <legend>Morborum corpus in mundi ad labes capite</legend>
</div>


import { defineDatabase, makeSource } from 'contentlayer-source-notion';

export const Block = defineDatabase(() => ({
  name: 'Block',
  databaseId: '<databaseId>',
}));

export default makeSource({
  client,
  renderer,
  databaseTypes: [Block],
});