mdattr

package
v0.0.0-...-648588a Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2016 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package mdattr parses Markdown file attributes.

In an effort to provide attributes associated with Markdown files this package parses them at the start of the file.

The overal format is ([s] is whitespace):

+[s]name[s]=[s]value[s]

That is, prefixed and suffixed whitespace is stripped. For example, given a Markdown document in the form of:

+Name   = Graham Joira
+  VarTwo = 2
+Var3   = The quick brown fox jumped over the lazy dog..

# Header 1
Paragraph 1!

## Header 2
Paragraph 2!

Parse would return the attribute map (note lack of whitespace on end of "Joira "):

map[string]string{
    "Name": "Graham Joira",
    "VarTwo": "2",
    "Var3": "The quick brown fox jumped over the lazy dog..",
}

And Parse would return the data (note preceding newline removal):

# Header 1
Paragraph 1!

## Header 2
Paragraph 2!

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(r io.Reader) (attrs map[string]string, data []byte, err error)

Parse parses the reader for attributes and returns a map of attributes and a data slice which simply strips the attributes and preceding whitespace of the given reader.

Any IO errors encountered during scanning are returned, along with a nil map and data slice.

Types

This section is empty.

Jump to

Keyboard shortcuts

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