docs

package
v0.0.0-...-89828b6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Provides documentation data.

Index

Constants

This section is empty.

Variables

View Source
var Dark = styles.Get("xcode-dark")
View Source
var Formatter = html.New(FormatterOptions...)
View Source
var Light = styles.Get("xcode")

Functions

func Write

func Write(output, source string) error

Write JSON file to output from source. source may be a creator-docs-formatted directory, or an HTTP URL to a git repository.

Types

type Class

type Class struct {
	Category string `json:",omitempty"`
	Doc
}

type Constant

type Constant struct {
	Name string
	Type string
	Tags []string `json:",omitempty"`
	Doc
}

type Constructor

type Constructor struct {
	Name       string
	Parameters []Parameter
	Tags       []string `json:",omitempty"`
	Doc
}

type Context

type Context struct {
	// Base URL for external doc website.
	BaseURL url.URL
	// Path within base corresponding to renderer object.
	Path string
	// Base URL for external image CDN.
	BaseImageURL url.URL

	// Heading level to use.
	Level int
	// Heading levels for summary section.
	SummaryLevel int
	// Heading levels for description section.
	DescriptionLevel int
}

Extra context for renderer.

func (Context) AppendPath

func (ctx Context) AppendPath(s ...string) Context

Returns ctx with s appended to the Path.

func (Context) SetLevels

func (ctx Context) SetLevels(summ, desc int) Context

Returns ctx with heading levels set.

func (Context) UseLevel

func (ctx Context) UseLevel(level int) Context

Returns ctx with used heading level set.

type Doc

type Doc struct {
	Summary            string   `json:",omitempty"`
	Description        string   `json:",omitempty"`
	DeprecationMessage string   `json:",omitempty"`
	CodeSamples        []string `json:",omitempty"`
}

func (*Doc) RenderHTML

func (d *Doc) RenderHTML(ctx Context) error

type Enum

type Enum struct {
	Doc
}

type EnumItem

type EnumItem struct {
	Doc
}

type Function

type Function struct {
	Name       string
	Parameters []Parameter
	Returns    []Return
	Tags       []string `json:",omitempty"`
	Doc
}

type Member

type Member struct {
	Doc
}

type Method

type Method struct {
	Name       string
	Parameters []Parameter
	Returns    []Return
	Tags       []string `json:",omitempty"`
	Doc
}

type Operation

type Operation struct {
	Operation  string
	TypeA      string
	TypeB      string
	ReturnType string
	Tags       []string `json:",omitempty"`
	Doc
}

type Parameter

type Parameter struct {
	Name    string
	Type    string
	Default any
	Summary string `json:",omitempty"`
}

type Property

type Property struct {
	Name string
	Type string
	Tags []string `json:",omitempty"`
	Doc
}

type Renderer

type Renderer interface {
	// Recursively replace markdown fields with rendered HTML.
	RenderHTML(ctx Context) error
}

type Return

type Return struct {
	Type    string
	Summary string `json:",omitempty"`
}

type Root

type Root struct {
	Class    map[id.Class]*Class
	Member   map[id.Class]map[id.Member]*Member
	Enum     map[id.Enum]*Enum
	EnumItem map[id.Enum]map[id.EnumItem]*EnumItem
	Type     map[id.Type]*Type
}

func (*Root) RenderHTML

func (r *Root) RenderHTML(ctx Context) error

type Transformer

type Transformer struct {
	Method XFM
	Path   []string
}

type Type

type Type struct {
	Constants      []Constant    `json:",omitempty"`
	Constructors   []Constructor `json:",omitempty"`
	Functions      []Function    `json:",omitempty"`
	Properties     []Property    `json:",omitempty"`
	Methods        []Method      `json:",omitempty"`
	MathOperations []Operation   `json:",omitempty"`
	Tags           []string      `json:",omitempty"`
	Doc
}

func (*Type) RenderHTML

func (t *Type) RenderHTML(ctx Context) error

type XFM

type XFM func(outer any, key string) error

Receives a JSON object and a key, and transforms its value.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL