diff --git a/contentlayer.config.ts b/contentlayer.config.ts index 6f06de853..d299d37a0 100644 --- a/contentlayer.config.ts +++ b/contentlayer.config.ts @@ -46,6 +46,10 @@ const Doc = defineDocumentType(() => ({ }, description: 'The languages of the content, used by guides', }, + start_steps: { + type: 'markdown', + description: 'The start steps of the doc, used by guides', + }, }, computedFields: { slug: { diff --git a/docs/guides/go/realtime-messaging.mdx b/docs/guides/go/realtime-messaging.mdx index bdf5cf9d9..a9eef89f9 100644 --- a/docs/guides/go/realtime-messaging.mdx +++ b/docs/guides/go/realtime-messaging.mdx @@ -5,6 +5,11 @@ tags: - Key Value Store languages: - go +start_steps: | + git clone --depth 1 https://github.com/nitrictech/examples + cd examples/v1/websocket-app + go mod tidy + nitric start --- # Building a chat app in Go with WebSockets and Nitric diff --git a/src/app/[[...slug]]/layout.tsx b/src/app/[[...slug]]/layout.tsx index 02783991c..49b95ad76 100644 --- a/src/app/[[...slug]]/layout.tsx +++ b/src/app/[[...slug]]/layout.tsx @@ -7,6 +7,7 @@ import { Button } from '@/components/ui/button' import { GitHubIcon } from '@/components/icons/GitHubIcon' import Breadcrumbs from '@/components/Breadcrumbs' import FeedbackForm from '@/components/FeedbackForm' +import { Code } from '@/components/mdx' export default function DocLayout({ children, @@ -22,10 +23,21 @@ export default function DocLayout({ return <>{children} } + const startSteps = doc.start_steps && ( + + ) + return (
-
+
{children} @@ -55,7 +67,7 @@ export default function DocLayout({ })}
- +
) diff --git a/src/components/code/Code.tsx b/src/components/code/Code.tsx index fee41a4e9..4e0c12ffa 100644 --- a/src/components/code/Code.tsx +++ b/src/components/code/Code.tsx @@ -6,9 +6,11 @@ import { highlight } from './highlight' export async function Code({ codeblock, + hideBashPanel, }: { codeblock: RawCode isPanel?: boolean + hideBashPanel?: boolean }) { const highlighted = await highlight(codeblock) @@ -18,7 +20,11 @@ export async function Code({ return ( -
+      
     
   )
 }
diff --git a/src/components/code/Pre.tsx b/src/components/code/Pre.tsx
index 0e7c0c48e..3563e40f9 100644
--- a/src/components/code/Pre.tsx
+++ b/src/components/code/Pre.tsx
@@ -20,11 +20,13 @@ type Props = {
   highlighted: HighlightedCode
   showPanel?: boolean
   className?: string
+  hideBashPanel?: boolean
 } & HandlerProps
 
 const Pre: React.FC = ({
   highlighted,
   showPanel,
+  hideBashPanel,
   enableTransitions,
   className,
 }) => {
@@ -40,7 +42,7 @@ const Pre: React.FC = ({
 
   const showFileNamePanel = showPanel && !!title
 
-  const isBash = highlighted.lang === 'shellscript'
+  const isBash = highlighted.lang === 'shellscript' && !hideBashPanel
 
   return (
     <>
diff --git a/src/components/layout/DocToC.tsx b/src/components/layout/DocToC.tsx
index 83c7b9812..55828d359 100644
--- a/src/components/layout/DocToC.tsx
+++ b/src/components/layout/DocToC.tsx
@@ -1,7 +1,7 @@
 'use client'
 
 import type { Doc } from '@/content'
-import { useRef, useLayoutEffect, useState, useEffect } from 'react'
+import { useState, useEffect } from 'react'
 import Link from 'next/link'
 import { DocTracingBeam } from './DocTracingBeam'
 import { Button } from '../ui/button'
@@ -15,7 +15,13 @@ interface Toc {
   depth: number
 }
 
-const DocToC = ({ doc }: { doc: Doc }) => {
+const DocToC = ({
+  doc,
+  startSteps,
+}: {
+  doc: Doc
+  startSteps?: React.JSX.Element | undefined
+}) => {
   const initial = 14
   const sectionSize = 28
   const offset = 10
@@ -58,8 +64,8 @@ const DocToC = ({ doc }: { doc: Doc }) => {
   }, [])
 
   return (
-    
-