CodeWindow reference

Below is an example of a CodeWindow block.

function hello(name, options) {
  if (a) {
    return false

  const greeting = "hi, " + name
  return true

Literate code

The LitCodeWindow element allows for code to be interspersed with text.

import 'react' from React
import 'react-dom' from ReactDOM

it('works', () => {
  ReactDOM.render(<div>hello!</div>, document.body)

JSX support — JSX fragments like these often need Babel to be integrated with Jest. This just works with Vitest.


Another example

export async function getStaticPaths() {
  const posts = await Astro.glob('../content/posts/**/*.md');
    ({ Content, file, frontmatter }) => {
      const slug = file.split('/').at(-2);
      const { title } = frontmatter
      return {
        params: { slug },
        props: { Content, title },

This fetches using Astro.glob(). Content is an Astro component that will be passed on as props.

const { title, Content } = Astro.props

  <Content />

The component will be rendered here.

Another example

const node = document.createElement('div')

This returns a single node.


def index
  @page = params[:page].to_i
  @articles =

NoMethodError (undefined method to_i for ["1"]:Array)
Did you mean? to_s