Skip to content

Code Blocks

Render syntax-highlighted source with a filename and copy action.

On this page

Usage

Use a fenced code block with a language and optional filename. The Markdown renderer supplies DocsCode automatically.

nuxt.config.ts
title: Documentation for your project
description: Everything you need to get started.
links:
  - label: Get started
    to: /getting-started/introduction
md
export default defineAppConfig({
  indocio: {
    docs: {
      content: { width: '42rem' },
      sidebar: { enabled: true, width: 240, collapsible: false },
      toc: { enabled: true, position: 'content', depth: 3 },
      breadcrumbs: true,
      footer: true,
      navigation: true,
      search: true,
      actions: { copyLink: true },
    },
    spaces: { switcher: 'dropdown' },
  },
})

Direct component usage

example.ts
<script setup lang="ts">
import type { DocsConfig } from '@igrislabs/indocio/types'

defineProps<{ settings: DocsConfig; page?: unknown }>()
</script>

<template>
  <footer class="mt-12 border-t border-border pt-6 text-sm">
    Your team's documentation. <a href="https://example.com/support">Get help</a>.
  </footer>
</template>
md
pnpm install
pnpm dev
pnpm check
pnpm build
PropTypeDefault
codestringRequired
filenamestringUnset
languagestringInferred from the filename, otherwise vue
headerbooleantrue

Use Code tabs to group examples, Code Tree to browse source files, and Package Commands for install commands.

Markdown and MDC highlighting

Use md, markdown, or mdc for Markdown examples. Headings, emphasis, links, MDC component names and attributes, named slots, and YAML props receive syntax colors. Code fences inside the example keep their own language highlighting, including filenames and aliases such as typescript.

md
## Example

::callout{title="Before you start" color="info"}
Write your documentation in Markdown.
::

```ts [example.ts]
export const project = 'Indocio'
```

Indocio · Built with Nuxt Content, IPEX, and Akaza UI.