markdown

package
v0.0.0-...-0aed529 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package markdown provides an markdown bubble which can render markdown in a pretty manor.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenderMarkdown

func RenderMarkdown(width int, content string) (string, error)

RenderMarkdown renders the markdown content with glamour.

Types

type Bubble

type Bubble struct {
	Viewport    viewport.Model
	BorderColor lipgloss.AdaptiveColor
	Active      bool
	Borderless  bool
	FileName    string
	ImageString string
}

Bubble represents the properties of a code bubble.

func New

func New(active, borderless bool, borderColor lipgloss.AdaptiveColor) Bubble

New creates a new instance of markdown.

func (*Bubble) GotoTop

func (b *Bubble) GotoTop()

GotoTop jumps to the top of the viewport.

func (Bubble) Init

func (b Bubble) Init() tea.Cmd

Init initializes the code bubble.

func (*Bubble) SetBorderColor

func (b *Bubble) SetBorderColor(color lipgloss.AdaptiveColor)

SetBorderColor sets the current color of the border.

func (*Bubble) SetBorderless

func (b *Bubble) SetBorderless(borderless bool)

SetBorderless sets weather or not to show the border.

func (*Bubble) SetFileName

func (b *Bubble) SetFileName(filename string) tea.Cmd

SetFileName sets current file to render, this returns a cmd which will render the text.

func (*Bubble) SetIsActive

func (b *Bubble) SetIsActive(active bool)

SetIsActive sets if the bubble is currently active.

func (*Bubble) SetSize

func (b *Bubble) SetSize(w, h int) tea.Cmd

SetSize sets the size of the bubble.

func (Bubble) Update

func (b Bubble) Update(msg tea.Msg) (Bubble, tea.Cmd)

Update handles updating the UI of a code bubble.

func (Bubble) View

func (b Bubble) View() string

View returns a string representation of the markdown bubble.

Jump to

Keyboard shortcuts

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