goportabletext

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2025 License: MIT Imports: 5 Imported by: 3

README

Tests on Linux, MacOS and Windows Go Report Card GoDoc

Converts Portable Text to Markdown.

Types supported

  • block and span
  • image. Note that the image handling is currently very simple; we link to the asset.url using asset.altText as the image alt text and asset.title as the title.
  • code (see the code-input plugin). Code will be rendered as fenced code blocks with any filename provided passed on as a markdown attribute.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToMarkdown

func ToMarkdown(opts ToMarkdownOptions) error

ToMarkdown converts the given Portable Text blocks in opts.Src to Markdown and writes the result to opts.Dst.

Types

type ToMarkdownOptions

type ToMarkdownOptions struct {
	// The destination writer.
	Dst io.Writer

	// The source Portable Text blocks.
	// Can be either
	// * a io.Reader with a JSON value or array of blocks.
	// * map[string]any or a []any.
	// * a portabletext.Blocks slice (used in benchmarks only).
	Src any
}

ToMarkdownOptions provides options for the ToMarkdown function.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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