0.3.2 • Published 6 months ago
@bebeal/rehype-code-terminal v0.3.2
@bebeal/rehype-code-terminal
A rehype plugin for rendering code terminals in place of code blocks.
Installation
npm install @bebeal/rehype-code-terminalUsage
- Use with 
rehype-starry-nightto syntax highlighted code blocks. 
import rehypeCodeTerminal from '@bebeal/rehype-code-terminal'
import rehypeStarryNight from 'rehype-starry-night'
import { common } from '@wooorm/starry-night'
import sourceZig from '@wooorm/starry-night/source.zig'
import sourceScala from '@wooorm/starry-night/source.scala'
import sourceJulia from '@wooorm/starry-night/source.julia'
import sourceHaskell from '@wooorm/starry-night/source.haskell'
export default defineConfig({
  rehypePlugins: [rehypeCodeTerminal, [rehypeStarryNight, { grammars: [...common, sourceZig, sourceScala, sourceJulia, sourceHaskell] }]],
})- You'll also need to include the styles, and inject the components
 
import '@bebeal/rehype-code-terminal/style.css'
import { InlineTerminal, Terminal } from '@bebeal/rehype-code-terminal'
<MDXProvider components={{ InlineTerminal, Terminal }}>
  ...
</MDXProvider>