import { GraphQLEnumType } from "graphql"; import type { MarkdownConverterOptions } from "../types"; import { escapeSpecialCharacters, parseMarkdown } from "./parseMarkdown"; export function convertEnumToMarkdown( enm: GraphQLEnumType, _: MarkdownConverterOptions ): string { const lines: string[] = []; lines.push(`## ${enm.name}`, `\n\n`); lines.push(enm.description || "", `\n\n`); lines.push( `
Values
`, `\n\n` ); lines.push(`| Value | Description |
|---|---|
| ${value.value} | `, `\n`); lines.push(``, `\n`);
if (value.deprecationReason) {
lines.push(
`Deprecated: ${escapeSpecialCharacters( value.deprecationReason )}`, `\n` ); } lines.push(parseMarkdown(value.description || ""), `\n`); lines.push(` | `, `\n`);
lines.push(`