package markless
import "shirakumo.org/markless"
Markless document format parser and converter for Go.
This package provides the following features:
- Parsing of standard Markless to an abstract syntax tree (AST)
- Conversion of the AST to HTML
- Full standard Markless test suite coverage
- Customisation of supported directives and features for safety
- Support for user-defined syntax extensions
For basic usage of the library, see ParseString and ToHTML. For an overview and formal specification of the language, see the official spec.
This project also provides a standalone command line interface application that can compile markless source files to HTML files for indpendent use. See shirakumo.org/markless/main.
Index
- func Parse(in io.Reader, p *parser.Parser) (pe *parser.Parser, err error)
- func ParseFile(path string, p *parser.Parser) (pe *parser.Parser, err error)
- func ParseString(in string, p *parser.Parser) (pe *parser.Parser, err error)
- func ToHTML(p *parser.Parser) string
Functions
func Parse
func Parse(in io.Reader, p *parser.Parser) (pe *parser.Parser, err error)
Parse a Markless document from an io.Reader. If p is nil, a new parser is constructed for you via parser.NewDefault. If the parse should fail because the document is invalid, the returned error describes the failure and will be an instance of directives.Error. If successful the parser is returned, from which the resulting AST can be extracted via parser.Root.
If you require further control over usable directives, embed types, and so on, construct a parser instance yourself via parser.New and pass it into this function.
func ParseFile
func ParseFile(path string, p *parser.Parser) (pe *parser.Parser, err error)
Parse a Markless document from a file. See Parse.
func ParseString
func ParseString(in string, p *parser.Parser) (pe *parser.Parser, err error)
Parse a Markless document from a string. See Parse.
func ToHTML
func ToHTML(p *parser.Parser) string
Converts the document from the given parser to HTML. This is a shorthand for parser.Root and html.ConvertString.
Directories
| ast | Conversion to a component-type agnostic AST format. |
| colors | Contains colour information for standardised colour names. |
| components | Component types to represent the abstract syntax tree of a parsed Markless document. |
| compounds | This package holds type representations for components.Option s in the components.Compound component. |
| directives | This package holds the various syntax pieces of Markless documents, called Directive s. |
| embeds | This package holds type representations for components.Option s in the components.Embed component as well as shims for the various embed types themselves. |
| html | Converts Markless components.Component s to HTML via Convert. |
| instructions | This package holds type representations for components.Instruction s. |
| main | Simple CLI for Markless Converts Markless documents into HTML. |
| parser | The standard Parser implementation according to the interface required for directives. |
| sizes | Contains size information for standardised size names. |