html

package
v0.0.0-...-917641f Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package html implements rich text to HTML conversion

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Format

func Format(v changes.Value) string

Format converts any value to HTML

Example
package main

import (
	"fmt"

	"github.com/dotchain/dot/x/rich"
	"github.com/dotchain/dot/x/rich/data"
	"github.com/dotchain/dot/x/rich/html"
)

func main() {
	s := rich.NewText("hello", data.FontBold)
	fmt.Println("html =", html.Format(s))
}
Output:

html = <b>hello</b>

func FormatBuilder

func FormatBuilder(b *strings.Builder, v changes.Value, f Formatter)

FormatBuilder converts any value to HTML

If a formatter is provided, it is used for embedded objects

Types

type Formatter

type Formatter func(b *strings.Builder, v changes.Value)

Formatter is a generic html formatter

Jump to

Keyboard shortcuts

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