md2min

package module
v0.0.0-...-39cd6e9 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2017 License: MIT Imports: 9 Imported by: 25

README

md2min

convert markdown file to minimal html file, using github css.

install

go get github.com/fairlyblank/md2min

If you want to build standalone execution:

cd $(GOPATH)/github.com/fairlyblank/md2min/main
go build -o md2min

usage

As standalone execution:

Usage: md2min [-nav=h2] name.md
  name.md: markdown file name
  -nav="none": navigate level ["none", "h1", "h2", "h3", "h4", "h5", "h6"]

As package, please review main.go.

Generally:

1. Prepare input byte slice and output writer
bytes, _ := ioutil.ReadAll(filename)
wr, _ := os.Create(newname)
2. Initialize package

Without navigator:

md := md2min.New("none")

Using "<h2>" tag as navigator:

md := md2min.New("h2")
3. Parse
md.Parse(bytes, wr)

examples

md2min ./example/example.md

will generate html without navigator.

md2min -nav=h2 ./example/example.md

will generate html with "<h2>" title navigator.

About

md2min is written in Google Go.

md2min is open source software released under the MIT License.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MdContent

type MdContent struct {
	ListMenu              string
	Content               string
	ContentStyle          string
	MenuStyle             string
	MenuWrapStyle         string
	ScrollBar             string

MdContent composes the structure of the parsed markdown document.

func New

func New(level string) *MdContent

New sets the level of navigation elements

func (*MdContent) Parse

func (md *MdContent) Parse(input []byte, wr io.Writer) error

Parse is the workhorse that actually reads in the input bytes, applies template to the content and writes it to io.Writer wr.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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