tmd

package module
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2025 License: MIT Imports: 7 Imported by: 0

README

This is a lib for formatting TapirMD documents and generating HTML pages from TapirMD documents.

TapirMD homepage: https://tmd.tapirgames.com

Documentation

Overview

The package is a simple implementation which is mainly for "tmd fmt" and "tmd gen" commands.

The APIs provided in the lib package is not concurrently safe.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HtmlGenOptions

type HtmlGenOptions struct {
	// Enabled custom app name list.
	// Comma or semocolon seperated.
	// Now, only "html" is supported.
	EnabledCustomApps string `json:"enabledCustomApps"`
	// A suffix which will be appended to all HTML id attribute values.
	IdentSuffix string `json:"identSuffix"`
	// A suffix which will be appended to all auto-generated HTML id attribute values.
	AutoIdentSuffix string `json:"autoIdentSuffix"`
	// Whether or not render the root block.
	RenderRoot bool `json:"renderRoot"`
}

The options used in HTML generation.

type Lib added in v0.0.6

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

All methods of Lib are not concurently safe.

func NewLib added in v0.0.6

func NewLib() (*Lib, error)

NewLib creates a Lib. If it succeeds, call Lib.Destroy method to release the resouce and Lib.Render method to render a TMD document.

func (*Lib) Destroy added in v0.0.6

func (lib *Lib) Destroy()

Destroy releases the resource allocated for a Lib.

func (*Lib) Format added in v0.0.6

func (lib *Lib) Format() (formattedData []byte, err error)

Format formats the current set input TMD.

func (*Lib) FormatTmd added in v0.0.6

func (lib *Lib) FormatTmd(tmdData []byte) (formattedData []byte, err error)

FormatTmd formats a TMD document.

func (*Lib) GenerateHtml added in v0.0.6

func (lib *Lib) GenerateHtml(options HtmlGenOptions) (htmlData []byte, err error)

GenerateHtml converts the current set input TMD into HTML.

func (*Lib) GenerateHtmlFromTmd added in v0.0.6

func (lib *Lib) GenerateHtmlFromTmd(tmdData []byte, options HtmlGenOptions) (htmlData []byte, err error)

GenerateHtmlFromTmd converts a TMD document into HTML.

func (*Lib) SetInputTmd added in v0.0.6

func (lib *Lib) SetInputTmd(tmdData []byte) error

SetInputTmd prepares the input TMD data for later using.

func (*Lib) Version added in v0.0.6

func (lib *Lib) Version() (version []byte, err error)

Version returns the version of library.

Directories

Path Synopsis
This is an example program which uses the tmd.go lib.
This is an example program which uses the tmd.go lib.

Jump to

Keyboard shortcuts

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