elvdoc

package
v0.20.1 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: BSD-2-Clause Imports: 8 Imported by: 1

Documentation

Overview

Package elvdoc extracts doc comments of Elvish variables and functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractAllFromFS added in v0.20.0

func ExtractAllFromFS(fsys fs.FS) (map[string]Docs, error)

ExtractFS extracts elvdocs of all modules found under fsys, and returns a map from the symbol prefix of a module ("" for builtin, "$mod:" for any other $mod).

See ExtractFromFS for how modules correspond to files.

func HighlightCodeBlock added in v0.20.0

func HighlightCodeBlock(info, code string) ui.Text

HighlightCodeBlock highlights a code block from Markdown. It handles thea elvish and elvish-transcript languages.

Types

type Docs

type Docs struct {
	Fns  []Entry
	Vars []Entry
}

Docs records doc comments.

func Extract

func Extract(r io.Reader, symbolPrefix string) (Docs, error)

Extract extracts the elvdoc of one module from an Elvish source.

func ExtractFromFS added in v0.20.0

func ExtractFromFS(fsys fs.FS, symbolPrefix string) (Docs, error)

ExtractFromFS extracts elvdoc of a module from fsys. The symbolPrefix is used to look up which files to read:

  • "": eval/*.elv (the builtin module)
  • "edit:": edit/*.elv
  • "$mod:": mods/$symbolPrefix/*.elv

If symbolPrefix is not empty and doesn't end in ":", this function panics.

type Entry

type Entry struct {
	Name string
	// ID to use in HTML
	ID      string
	Content string
}

Entry is a doc comment entry.

Jump to

Keyboard shortcuts

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