GraphqlMarkdown.Page (Graphql Markdown v1.2.0)

Copy Markdown View Source

Renders the sections of a schema (queries, mutations, objects, enums, ...) as nested lists of markdown lines.

GraphqlMarkdown.SinglePage and GraphqlMarkdown.MultiPage produce the same sections and only differ in how they are laid out, which a GraphqlMarkdown.Page.Layout captures: the heading level of a section and the way a type reference becomes a link.

Summary

Types

A nested list of lines, consumed by MarkdownHelpers.document/1.

Functions

The YAML front matter of a page with the given title, followed by a blank line, or nothing when the :front_matter option is not set.

Builds a layout from the layout-specific fields and the rendering options (:depth, :backlinks).

Renders one section: its heading followed by one entry per operation or type, or None when the schema has nothing in that section.

Section names, in the order they are rendered.

The document title as a level-one heading.

The document title: the :title option or "Graphql Schema".

The table of contents: one list item per section that exists in the schema, with a nested item per operation or type in it.

Types

lines()

@type lines() :: [String.t() | lines()]

A nested list of lines, consumed by MarkdownHelpers.document/1.

Functions

front_matter(title, options)

@spec front_matter(String.t(), keyword()) :: lines()

The YAML front matter of a page with the given title, followed by a blank line, or nothing when the :front_matter option is not set.

layout(schema_details, options, fields)

Builds a layout from the layout-specific fields and the rendering options (:depth, :backlinks).

section(name, schema_details, layout)

Renders one section: its heading followed by one entry per operation or type, or None when the schema has nothing in that section.

sections()

@spec sections() :: [String.t()]

Section names, in the order they are rendered.

title(options)

@spec title(keyword()) :: String.t()

The document title as a level-one heading.

title_text(options)

@spec title_text(keyword()) :: String.t()

The document title: the :title option or "Graphql Schema".

toc(schema_details, layout)

The table of contents: one list item per section that exists in the schema, with a nested item per operation or type in it.

Links come from the layout's page_link.