README

GoDoc Build Status Go Report Card

mdopen

Allows to view markdown files in the default browser. For more details, see the API documentation.

CLI usage

Install:

go get github.com/romanyx/mdopen/cmd/mdopen

Create a markdown file:

echo "# Hello from markdown" > hello.md

View it in the default browser as html:

mdopen hello.md

You will see:

Example

API usage

Install:

go get github.com/romanyx/mdopen
package main

import "github.com/romanyx/mdopen"

func main() {
    f := strings.NewReader("# Hello from markdown")

    opnr := mdopen.New()
    if err := opnr.Open(f); err != nil {
        log.Fatal(err)
    }
}

Contributing

Please feel free to submit issues, fork the repository and send pull requests!

Expand ▾ Collapse ▴

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Opener

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

    Opener holds layout and command name to open default browser. Use New function to initialize corrent one.

    func New

    func New(options ...Option) *Opener

      New returns initialized Opener.

      func (*Opener) Open

      func (opnr *Opener) Open(f io.Reader) error

        Open will create a tmp file, execute layout template with given markdown into it and then open it in browser.

        type Option

        type Option func(*Opener)

          Option for initializer.

          func GithubTemplate

          func GithubTemplate() Option

            GithubTemplate option sets layout as github.com template.

            Source Files

            Directories

            Path Synopsis
            cmd
            internal