markgen

package module
Version: v0.0.0-...-848271e Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2016 License: GPL-3.0 Imports: 13 Imported by: 0

README

MarkGen

Markdown Generator in Go Lang

How it works

to run markgen, run the command markgen

markgen README.md
listening :6060 ...

And this will open a browser window which shows the content of a file. The files are the served in https://localhost:6060/file name

When you modify the file, markgen will send the modified data to the browser through a websocket connection. You don't even need to refresh the page.

To install, Run

$ go get github.com/vyasgiridhar/markgen/markgen

Contribution

I welcome every kind of contribution.

If you have any problem using markgen, please file an issue in Issues.

If you'd like to contribute on source, please upload a pull request in Pull Requests.

Documentation

Index

Constants

View Source
const (
	ListeningTestInterval = 500
	MaxListeningTestCount = 10
)
View Source
const (
	WatcherInterval = 500
	DataChanSize    = 10
)
View Source
const (
	WriteTimeout = 5 * time.Second
	BufferSize   = 2048
)
View Source
const (
	Version = "0.1"
)

Variables

View Source
var DefaultStyle = `` /* 7099-byte string literal not displayed */
View Source
var MdConverter = NewMarkdownConverter()

MdConverter : Global Converter

Functions

func Template

func Template(w http.ResponseWriter, filepath string)

Types

type DataChan

type DataChan struct {
	Raw chan *[]byte
	Req chan bool
}

type MarkGen

type MarkGen struct {
	Server *MarkdownServer
	// contains filtered or unexported fields
}

func NewMarkgen

func NewMarkgen(port int) *MarkGen

func (*MarkGen) Run

func (m *MarkGen) Run(files ...string)

func (*MarkGen) Stop

func (m *MarkGen) Stop()

type MarkdownConverter

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

MarkdownConverter : class

func NewMarkdownConverter

func NewMarkdownConverter() *MarkdownConverter

NewMarkdownConverter : Returns a new MarkdownConverter

func (*MarkdownConverter) Convert

func (md *MarkdownConverter) Convert(raw []byte) []byte

Convert : Returns the converted html

func (*MarkdownConverter) UseBasic

func (md *MarkdownConverter) UseBasic()

UseBasic : Sets the Converter used

type MarkdownServer

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

func NewMarkdownServer

func NewMarkdownServer(port int) *MarkdownServer

func (*MarkdownServer) Addr

func (m *MarkdownServer) Addr() string

func (*MarkdownServer) Listen

func (m *MarkdownServer) Listen()

func (*MarkdownServer) ListenAndServe

func (m *MarkdownServer) ListenAndServe()

func (*MarkdownServer) ServeHTTP

func (m *MarkdownServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*MarkdownServer) ServeStatic

func (m *MarkdownServer) ServeStatic(w http.ResponseWriter, path string)

func (*MarkdownServer) Stop

func (m *MarkdownServer) Stop()

type Watcher

type Watcher struct {
	C *DataChan
	// contains filtered or unexported fields
}

func NewWatcher

func NewWatcher(path string) *Watcher

func (*Watcher) Start

func (w *Watcher) Start()

func (*Watcher) Stop

func (w *Watcher) Stop()

type Websocket

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

func NewWebsocket

func NewWebsocket(path string) *Websocket

func (*Websocket) Reader

func (w *Websocket) Reader(c *goWs.Conn, closed chan<- bool)

func (*Websocket) Serve

func (ws *Websocket) Serve(w http.ResponseWriter, r *http.Request)

func (*Websocket) Writer

func (w *Websocket) Writer(c *goWs.Conn, closed <-chan bool)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL