Skip to main content

rendererHelpers

CATEGORY_STYLE_CLASS​

Defined in: packages/core/src/rendererHelpers.ts:38

CSS class names used for styling different categories in the generated documentation. These are applied to the generated index metafiles for different section types.

Example​

// When generating API section metafiles
await generateIndexMetafile(dirPath, typeCat, {
styleClass: CATEGORY_STYLE_CLASS.API,
});

Enumeration Members​

API​

API: "graphql-markdown-api-section";

Defined in: packages/core/src/rendererHelpers.ts:42

CSS class applied to API sections (operations)

DEPRECATED​

DEPRECATED: "graphql-markdown-deprecated-section";

Defined in: packages/core/src/rendererHelpers.ts:47

CSS class applied to deprecated entity sections


SidebarPosition​

Defined in: packages/core/src/rendererHelpers.ts:62

Enum defining sidebar position values for ordering categories in the documentation sidebar. Used to control the relative position of categories in the navigation.

Example​

// Position deprecated entities at the end of the sidebar
await generateIndexMetafile(dirPath, DEPRECATED, {
sidebarPosition: SidebarPosition.LAST,
});

Enumeration Members​

FIRST​

FIRST: 1;

Defined in: packages/core/src/rendererHelpers.ts:66

Position at the beginning of the sidebar

LAST​

LAST: 999;

Defined in: packages/core/src/rendererHelpers.ts:71

Position at the end of the sidebar


API_GROUPS​

const API_GROUPS: Required<ApiGroupOverrideType>;

Defined in: packages/core/src/rendererHelpers.ts:94

Default group names for API types and non-API types. This constant provides the base folder structure for organizing GraphQL schema entities. Can be overridden via ApiGroupOverrideType in configuration.

Example​

// Default structure
const defaultGroups = API_GROUPS;
// { operations: "operations", types: "types" }

// With custom override
const customGroups = { ...API_GROUPS, operations: "queries-and-mutations" };

See​

getApiGroupFolder For usage with type categorization


DEPRECATED​

const DEPRECATED: "deprecated";

Defined in: packages/core/src/rendererHelpers.ts:24

Constant representing the string literal for deprecated entities. Used for grouping deprecated schema entities when the deprecated option is set to "group".

Example​

// When using the deprecated grouping option
if (isDeprecated(type)) {
const groupName = DEPRECATED;
// Handle deprecated type
}

getApiGroupFolder()​

function getApiGroupFolder(type, groups?): string;

Defined in: packages/core/src/rendererHelpers.ts:115

Determines the appropriate folder for a GraphQL schema entity based on its type.

Parameters​

type​

unknown

The GraphQL schema entity to categorize

groups?​

Maybe<boolean | ApiGroupOverrideType>

Optional custom group naming configuration

Returns​

string

The folder name where the entity should be placed

Example​

// With default groups
const folder = getApiGroupFolder(queryType); // Returns "operations"

// With custom groups
const folder = getApiGroupFolder(objectType, { operations: "queries" }); // Returns appropriate folder

isHierarchy()​

function isHierarchy(
options,
hierarchy,
): options is ConfigDocOptions & {
deprecated?: Maybe<TypeDeprecatedOption>;
} & {
force?: boolean;
hierarchy?: Maybe<
Partial<Record<TypeHierarchyValueType, TypeHierarchyTypeOptions>>
>;
} & { hierarchy: TypeHierarchyObjectType };

Defined in: packages/core/src/rendererHelpers.ts:162

Type guard function that checks if the provided options include a specific hierarchy configuration.

Parameters​

options​

Maybe<RendererDocOptions>

The renderer options to check

hierarchy​

TypeHierarchyValueType

The hierarchy type to check for

Returns​

options is ConfigDocOptions & { deprecated?: Maybe<TypeDeprecatedOption> } & { force?: boolean; hierarchy?: Maybe<Partial<Record<TypeHierarchyValueType, TypeHierarchyTypeOptions>>> } & { hierarchy: TypeHierarchyObjectType }

True if the options contain the specified hierarchy configuration

Example​

if (isHierarchy(options, TypeHierarchy.FLAT)) {
// Handle flat hierarchy structure
}

stripNumericPrefix()​

function stripNumericPrefix(folderName): string;

Defined in: packages/core/src/rendererHelpers.ts:144

Strips numeric prefix from a folder name if categorySort is enabled. Converts folder names like "01-query" back to "query" for category identification.

This is needed when extracting category names from file paths that were created with categorySort enabled. The regex matches leading two-digit numbers followed by a hyphen.

Parameters​

folderName​

string

The folder name to strip (e.g., "01-query", "02-mutations")

Returns​

string

The folder name without prefix (e.g., "query", "mutations")

Example​

stripNumericPrefix("01-query"); // Returns "query"
stripNumericPrefix("02-mutations"); // Returns "mutations"
stripNumericPrefix("objects"); // Returns "objects" (no prefix to strip)