formatter

package
v1.35.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatHTML

func FormatHTML(info *model.ServerInfo, includeTOC bool, templateFS embed.FS) (string, error)

FormatHTML formats server info as HTML

func FormatHugo added in v1.24.0

func FormatHugo(info *model.ServerInfo, outputDir string, includeFrontmatter bool, frontmatterFormat string, customFields map[string]any, hugoConfig *HugoConfig, customInitialisms []string, templateFS embed.FS) error

FormatHugo generates a Hugo documentation site structure with hierarchical content organization. It creates a content directory with subdirectories for tools, resources, and prompts, each containing individual markdown files and section index files (_index.md).

func FormatJSON

func FormatJSON(info *model.ServerInfo) ([]byte, error)

FormatJSON formats server info as JSON

func FormatMarkdown

func FormatMarkdown(info *model.ServerInfo, includeTOC, includeFrontmatter bool, frontmatterFormat string, customFields map[string]any, customInitialisms []string, templateFS embed.FS) (string, error)

FormatMarkdown formats server info as Markdown

func FormatPDF

func FormatPDF(info *model.ServerInfo, includeTOC bool) ([]byte, error)

FormatPDF formats server info as PDF

func GenerateFrontmatter

func GenerateFrontmatter(info *model.ServerInfo, format string, customFields map[string]any, isIndexFile bool) (string, error)

GenerateFrontmatter generates frontmatter for markdown output in YAML, TOML, or JSON format.

The isIndexFile parameter controls which metadata fields are included in the generated frontmatter:

  • When true: Includes comprehensive server-level metadata such as title, version, capabilities, and item counts. Use this for main documentation index files (_index.md) or primary landing pages.
  • When false: Generates minimal frontmatter with only basic metadata (generated_at, generator). Use this for individual tool/resource/prompt pages to keep frontmatter clean and focused.

Parameters:

  • info: The MCP server information containing name, version, capabilities, and items
  • format: The frontmatter format ("yaml", "toml", or "json")
  • customFields: Optional map of custom key-value pairs to add/override in frontmatter
  • isIndexFile: Controls metadata inclusion (see above)

Returns the formatted frontmatter string with delimiters, ready to prepend to markdown content.

func ParseCustomFields

func ParseCustomFields(fields []string) map[string]any

ParseCustomFields parses custom frontmatter fields from key:value strings

Types

type HugoConfig added in v1.25.0

type HugoConfig struct {
	BaseURL       string
	LanguageCode  string
	EnterpriseKey string // Optional Presidium enterprise key
	AuthorStrict  bool   // Whether to require author field in frontmatter (default: false)
}

HugoConfig holds Hugo-specific configuration options

func (*HugoConfig) Validate added in v1.25.0

func (hc *HugoConfig) Validate() error

Validate validates the Hugo configuration and returns any errors found

Jump to

Keyboard shortcuts

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