Skip to content

Docs Code Samples

Just a code block:

console.log('Hello world!')

Code block with a filename and highlights:

example.js
console.log('This could come from a file or CMS!');

Code blocks with tabs and different languages:

<h1>Hello world! My name is {{ $name }}</h1>

Steps:

  1. Import the component into your MDX file:

    import { Steps } from '@astrojs/starlight/components';
  2. Wrap <Steps> around your ordered list items.


Love these asides too:


See docs for starlight and expressive code for more examples.