Travis Arnold

@souporserious.com

design / systems / compilers / react founder https://www.renoun.dev/

🎉 Registration is now open for my latest course, Whimsical Animations! This course will teach you everything you need to know to design and build stunning, creative animations and interactions. It’s time to make the web less generic and boring! 😄

Whimsical Animations

Learn how to create charming interactions and delightful touches using the magic of CSS, JavaScript, SVG, and Canvas. I’m sharing all my tricks in this one!

whimsy.joshwcomeau.com

Annotations for code blocks usually require writing regexes to target specific source code and don't stay in sync easily. Working on something new using inline JSX comments. Highly flexible, declarative, and exposes annotations as renderers you can do whatever you want with.

The following source text with "warn" highlighted in yellow and "error" highlighted in red: console.warn('Warning') console.error('Error')import { CodeBlock } from 'renoun'

export function Annotations() {
  return (
    <CodeBlock
      language="ts"
      annotations={{
        highlight: ({ children, color }) => (
          <span
            style={{
              padding: '0 0.05em',
              borderRadius: '0.25rem',
              backgroundColor: color,
            }}
          >
            {children}
          </span>
        ),
      }}
    >
      {`
        console./* <highlight color='rgba(255,213,0,0.35)'> */warn/* </highlight> */('Warning')
        console./* <highlight color='rgba(255,0,0,0.35)' /> */error('Error')
      `}
    </CodeBlock>
  )
}

renoun has taken a long time to build because I run into every single issue it's trying to solve for the documentation site. It feels good to finally talk about now though, I'm really happy with where the API is. The changelog is quite the history of where it has been so far 😄 renoun.dev/changelog

renoun - The Documentation Toolkit for React

The renoun toolkit uses your React framework to keep documentation polished, in sync, and on brand.

renoun.dev