protodoc

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package protodoc extracts the JSON examples from docs/PROTOCOL.md so tests can bind every example to a typed value.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StripComments

func StripComments(s string) string

StripComments removes // and /* */ comments outside JSON strings.

Types

type Block

type Block struct {
	Index int    // 1-based, in document order
	Line  int    // line of the opening fence
	Text  string // content, dedented by the fence indent
}

Block is one fenced json code block of the document.

func JSONBlocks

func JSONBlocks(r io.Reader) ([]Block, error)

JSONBlocks returns every fenced json block, including indented ones.

func (Block) Values

func (b Block) Values() ([]json.RawMessage, error)

Values returns the JSON values of the block after comment removal. A block that starts with a string key (a fragment such as `"entry": {...}`) is wrapped in braces first.

Jump to

Keyboard shortcuts

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