document

package
v0.0.0-...-c96734c Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: BSD-2-Clause Imports: 11 Imported by: 2

Documentation

Overview

A markdown processor. Converts markdown to an internal format that may be rendered later as HTML or treated as data

The markdown does follow mostly the de-facto rules, but not all.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanToLower

func CleanToLower(s string) string

func Normalize

func Normalize(s string) string

TODO Needs optimization

func ToScreamingDelimited

func ToScreamingDelimited(s string, delimiter uint8, ignore string, screaming bool) string

ToScreamingDelimited converts a string to SCREAMING.DELIMITED.SNAKE.CASE (in this case `delimiter = '.'; screaming = true`) or delimited.snake.case (in this case `delimiter = '.'; screaming = false`)

Types

type Document

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

func New

func New(s string) (*Document, error)

New parses a markdown+ text string and returnes a Document object.

func (*Document) CompareStructure

func (doc *Document) CompareStructure(ref *Document) (bool, string)

Compare the structure of two documents. All headers of ref need to be in doc. Order is not important, but nesting is.

func (*Document) Data

func (doc *Document) Data() *ogdl.Graph

Data returns the Document as OGDL data

func (*Document) Html

func (doc *Document) Html() string

Html returnes the Document in HTML format

func (*Document) HtmlNoHeader

func (doc *Document) HtmlNoHeader() string

Html returnes the Document in HTML format, but skip the first header

func (doc *Document) HtmlWithLinks(urlbase string) string

Html returnes the Document in HTML format

func (*Document) Para1

func (doc *Document) Para1() string

Return the first paragraph of this document

func (*Document) Part

func (doc *Document) Part(path string) *Document

Part returns the part of the document indicated by the given path.

func (*Document) Raw

func (doc *Document) Raw() *ogdl.Graph

func (*Document) Structure

func (doc *Document) Structure() *ogdl.Graph

Structure returns (only) the headers as OGDL data

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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