markdownview

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MarkdownView

type MarkdownView struct {
	Content      string
	Rendered     string
	GlamourStyle string
	ViewMode     ViewMode
	Renderer     *glamour.TermRenderer
	Styles       lipgloss.Style
	Viewport     viewport.Model
	NeedsRender  bool
}

MarkdownView represents the model for a markdown component

func NewMarkdownView

func NewMarkdownView(content string, glamourStyle string, viewMode ViewMode) (*MarkdownView, error)

NewMarkdownView initializes a new MarkdownView

func (*MarkdownView) Init

func (m *MarkdownView) Init() tea.Cmd

Init initializes the MarkdownView component

func (*MarkdownView) Resize

func (m *MarkdownView) Resize(width, height int)

Resize adjusts the component based on new terminal dimensions

func (*MarkdownView) SetContent

func (m *MarkdownView) SetContent(content string) error

SetContent updates the Markdown content and triggers re-rendering

func (*MarkdownView) Update

func (m *MarkdownView) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles incoming messages and updates the model accordingly

func (*MarkdownView) View

func (m *MarkdownView) View() string

View renders the MarkdownView component

type ViewMode

type ViewMode int

ViewMode defines the mode of the MarkdownView

const (
	Static     ViewMode = iota // No scrolling
	Scrollable                 // Enable scrolling
)

Jump to

Keyboard shortcuts

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