DlCodeInline

Display inline code that stays on one line

The DlCodeInline inline component renders a semantic <code> snippet with the same look as Markdown backticks, but keeps the text on a single line. Use it when backtick code would wrap in prose.

The Why

DocLayer styles regular inline code to wrap inside paragraphs and lists, so long identifiers can break across lines. DlCodeInline applies a small, overridable UI layer so authors can opt into fully inline code without custom HTML or inline style attributes.

Features

  • 📎 semantic <code> output; inherits global theme
  • 📝 works with default slot or code prop
  • đź§© theme-friendly visual adjustments

Usage

Use :dl-code-inline (or the special shorthand :dl-code-i) as an inline component with the snippet in the default slot or the code prop.

:dl-code-inline[content.config.ts]<!-- or -->:dl-code-i[content.config.ts]
:dl-code-inline{code="content.config.ts"}<!-- or -->:dl-code-i{code="content.config.ts"}

Result: content.config.ts and content.config.ts

Formatting

  • Markdown backticks are best for short inline mentions in running text.
  • DlFormat parses lightweight Markdown (bold, italic, nested backticks) into HTML, preserving the same styling and behavior as the original Markdown.
  • DlCodeInline is for a literal code string that must stay on one line and should not be reformatted. Try to not overuse it, as it still holds cost of the rendering.
  • Tables applies no-wrapped code by default, so DlCodeInline is not needed there.

Props

Here are the properties you can use with the DlCodeInline component. Each property should be set on an individual component instance; they do not affect the global configuration. More about defining properties in MDC components you can read here.

nametypedefaultdescription
lazybooleanfalse

Whether to lazy load the component.

codestringundefined

Inline code snippet. Use when the default slot is impractical (tables, pipes, or other MDC edge cases).

iuiRecord<string, string>undefined

Special property dedicated to inline components, can be used to add TW classes for certain component markup elements.

Slots

namedescription
default

Code snippet text. Ignored when the code prop is provided.

Styling

Styling from Markdown

Every DocLayer component can be styled directly within your Markdown file using dedicated slot/property configuration. This allows you to customize the appearance of the component's markup elements without modifying global styles. More about components styling you can read here.

Below you'll find the default set of Tailwind classes for the component's dedicated markup elements.

<script lang="ts">const ui = defineDoclayerComponentUi({  base: ['max-w-none', 'whitespace-nowrap!'],});</script>

DlCodeInline relies on global code styles for colors, padding, and borders. The component UI only adds layout overrides. However if you need a local override, the :iui prop stands as a great outlet for that.

Accessibility

DlCodeInline renders a native <code> element with an accessible name. Keep snippets short and meaningful; use surrounding prose to explain longer references.