mdedit

package module
v0.0.0-...-cb83ad3 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2023 License: Unlicense Imports: 33 Imported by: 1

README

mdedit

MdEdit is a Vi-like markdown editor built using Gio. It is extremely early stage software. The Vi editor lacks most functionality and might be pretty buggy.

Getting Started

If you have task, goimports and gofumpt installed, you can simply run task (or task nowayland) to fmt, lint and build the project.

However, to just build the mdedit executable, run:

go build -o mdedit cmd/mdedit/main.go

# or, to build without wayland support:

go build -tags nowayland -o mdedit cmd/mdedit/main.go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type C

type C = layout.Context

type D

type D = layout.Dimensions

type DirChosenEvent

type DirChosenEvent struct {
	Path string
}

type Document

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

func (*Document) Layout

func (d *Document) Layout(gtx C, th *material.Theme) D

func (*Document) Render

func (d *Document) Render(data []byte, th *material.Theme) error

type Editor

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

func (*Editor) Focus

func (ed *Editor) Focus()

func (*Editor) HasChanged

func (ed *Editor) HasChanged() bool

func (*Editor) Layout

func (ed *Editor) Layout(gtx C, sh text.Shaper, fnt text.Font, txtSize unit.Sp, pal Palette) D

func (*Editor) SaveRequested

func (ed *Editor) SaveRequested() bool

func (*Editor) SetText

func (ed *Editor) SetText(data []byte)

func (*Editor) Text

func (ed *Editor) Text() []byte

type Explorer

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

func NewExplorer

func NewExplorer(rootDir, openToDir string) Explorer

func (*Explorer) Events

func (ex *Explorer) Events() []ExplorerEvent

func (*Explorer) Layout

func (ex *Explorer) Layout(gtx C, th *material.Theme) D

func (*Explorer) Populate

func (ex *Explorer) Populate(dir string, files []fs.FileInfo)

type ExplorerEvent

type ExplorerEvent interface{}

type FS

type FS interface {
	HomeDir() string
	WorkingDir() string
	ReadDir(fpath string) ([]fs.FileInfo, error)
	ReadFile(fpath string) ([]byte, error)
	WriteFile(fpath string, data []byte) error
}

type FilesChosenEvent

type FilesChosenEvent struct {
	Paths []string
}

type Palette

type Palette struct {
	Fg         color.NRGBA
	Bg         color.NRGBA
	LineNumber color.NRGBA
	Heading    color.NRGBA
	ListMarker color.NRGBA
	BlockQuote color.NRGBA
	CodeBlock  color.NRGBA
}

type Session

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

func NewSession

func NewSession(fsys FS, win *app.Window) Session

func (*Session) CloseActiveTab

func (s *Session) CloseActiveTab()

func (*Session) FocusActiveTab

func (s *Session) FocusActiveTab()

func (*Session) HandleKeyEvent

func (s *Session) HandleKeyEvent(e key.Event)

func (*Session) Layout

func (s *Session) Layout(gtx C, th *material.Theme) D

func (*Session) NextTab

func (s *Session) NextTab()

func (*Session) OpenFile

func (s *Session) OpenFile(fpath string)

func (*Session) OpenFileExplorerTab

func (s *Session) OpenFileExplorerTab()

func (*Session) PrevTab

func (s *Session) PrevTab()

func (*Session) SelectTab

func (s *Session) SelectTab(n int)

func (*Session) SwapTabDown

func (s *Session) SwapTabDown()

func (*Session) SwapTabUp

func (s *Session) SwapTabUp()

type SingleViewWidget

type SingleViewWidget uint8
const (
	SingleViewEditor SingleViewWidget = iota
	SingleViewDocument
)

type View

type View struct {
	Editor Editor

	Mode ViewMode

	SplitRatio float32 // portion of total space to allow the first widget

	SingleWidget SingleViewWidget
	// contains filtered or unexported fields
}

func (*View) Layout

func (vw *View) Layout(gtx C, th *material.Theme, edFnt text.Font, pal Palette) D

type ViewMode

type ViewMode uint8
const (
	ViewModeSplit ViewMode = iota
	ViewModeSingle
)

type ViewStyle

type ViewStyle struct {
	Theme      *material.Theme
	EditorFont text.Font
	Palette    Palette
	View       *View
}

func (ViewStyle) Layout

func (vs ViewStyle) Layout(gtx C) D

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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