plantuml

package
v0.7.10 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package plantuml provides rendering support for PlantUML diagrams.

Package plantuml provides rendering of PlantUML diagrams in Markdown content.

It detects ```plantuml code blocks in HTML content and converts them to SVG using either the PlantUML online server or a local plantuml command.

Package plantuml - plugin.go registers PlantUML rendering as an mdpress plugin.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Plugin

type Plugin struct {
	// contains filtered or unexported fields
}

Plugin implements the plugin.Plugin interface for PlantUML diagram rendering.

func NewPlugin

func NewPlugin() *Plugin

NewPlugin creates a new PlantUML plugin with default settings. If the default PlantUML server URL cannot be validated (e.g. DNS failure), the renderer is left nil; Init() must succeed before Execute() is called.

func (*Plugin) Cleanup

func (p *Plugin) Cleanup() error

Cleanup performs any cleanup after the build finishes.

func (*Plugin) Description

func (p *Plugin) Description() string

Description returns the plugin description.

func (*Plugin) Execute

func (p *Plugin) Execute(hookCtx *plugin.HookContext) (*plugin.HookResult, error)

Execute processes the HTML content to render PlantUML diagrams.

func (*Plugin) Hooks

func (p *Plugin) Hooks() []plugin.Phase

Hooks returns the list of hook phases this plugin handles. PlantUML rendering happens after HTML parsing.

func (*Plugin) Init

func (p *Plugin) Init(cfg *config.BookConfig) error

Init initializes the plugin from configuration. Expects config options:

  • server: Base URL for PlantUML server (optional, defaults to https://www.plantuml.com/plantuml)
  • local: Boolean flag to use local plantuml command (optional, defaults to false)

func (*Plugin) Name

func (p *Plugin) Name() string

Name returns the plugin name.

func (*Plugin) Version

func (p *Plugin) Version() string

Version returns the plugin version.

type Renderer

type Renderer struct {
	// contains filtered or unexported fields
}

Renderer handles the detection and conversion of PlantUML diagrams.

func NewRenderer

func NewRenderer(serverURL string, useLocal bool) (*Renderer, error)

NewRenderer creates a new PlantUML renderer. serverURL should be the base URL without the /svg path (e.g. "https://www.plantuml.com/plantuml")

func (*Renderer) ClearCache added in v0.6.5

func (r *Renderer) ClearCache()

ClearCache removes all cached PlantUML renderings, freeing memory. This should be called between rebuild cycles in long-running processes.

func (*Renderer) RenderHTML

func (r *Renderer) RenderHTML(ctx context.Context, html string) (string, error)

RenderHTML processes HTML content and replaces PlantUML code blocks with SVG output.

Jump to

Keyboard shortcuts

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