Skip to Content
rehype-code-group

Exports

Every public entry point of the package and what it exports.

The package is ESM-only and ships TypeScript declarations for every entry point.

rehype-code-group

import rehypeCodeGroup, {
  commonLabelResolver,
  type AssetOptions,
  type ClassNames,
  type LabelResolver,
  type RehypeCodeGroupOptions,
} from "rehype-code-group";
ExportKindDescription
defaultfunctionThe rehype plugin. Takes RehypeCodeGroupOptions.
commonLabelResolverfunctionThe default label resolver, with five emoji shortcodes.
RehypeCodeGroupOptionstypeThe options object.
AssetOptionstypeThe type of the assets option.
ClassNamestypeThe class-name keys used by customClassNames.
LabelResolvertype(label: string) => string

rehype-code-group/remark

import remarkCodeGroup from "rehype-code-group/remark";

A remark plugin that moves [label] fence metadata onto the ::: code-group line. Run it before remark-rehype. See Fence-meta labels.

The module also exports rewriteLabelMetadata and its LabelEditor type. They are the shared core that the Sätteri plugin reuses, and aren't meant for direct use.

rehype-code-group/package-managers

import remarkPackageManagers, {
  type PackageManager,
  type PackageManagerOptions,
} from "rehype-code-group/package-managers";

A remark plugin that expands npm2yarn fences into package-manager groups. Run it before the remark companion. See Package-manager tabs.

rehype-code-group/emoji

import { fullEmojiResolver } from "rehype-code-group/emoji";

A label resolver with the full GitHub emoji shortcode catalog, from node-emoji.

rehype-code-group/satteri

import {
  commonLabelResolver,
  satteriCodeGroup,
  satteriCodeGroupLabels,
  type AssetOptions,
  type ClassNames,
  type LabelResolver,
  type RehypeCodeGroupOptions,
} from "rehype-code-group/satteri";

The Sätteri hast and mdast plugins, with the same option types as the main entry. Needs satteri 0.10.5 to 0.11.x. See Sätteri.

rehype-code-group/client

import {
  initCodeGroups,
  type CodeGroupChangeDetail,
} from "rehype-code-group/client";

The browser client. Importing it in a browser sets up every group in document. initCodeGroups(root?) sets up a root and returns a cleanup function. See Browser client.

rehype-code-group/styles.css

import "rehype-code-group/styles.css";

The default stylesheet, identical to the one inline mode embeds. A type declaration is included, so TypeScript accepts the import.

Edit on GitHub