Documentation ¶
Overview ¶
Package code implements a code bubble which renders syntax highlighted source code based on a filename.
Index ¶
- func Highlight(content, extension, syntaxTheme string) (string, error)
- type Model
- func (m *Model) GotoTop()
- func (m Model) Init() tea.Cmd
- func (m *Model) SetBorderColor(color lipgloss.AdaptiveColor)
- func (m *Model) SetBorderless(borderless bool)
- func (m *Model) SetFileName(filename string) tea.Cmd
- func (m *Model) SetIsActive(active bool)
- func (m *Model) SetSize(w, h int)
- func (m *Model) SetSyntaxTheme(theme string)
- func (m Model) Update(msg tea.Msg) (Model, tea.Cmd)
- func (m Model) View() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Model ¶
type Model struct { Viewport viewport.Model BorderColor lipgloss.AdaptiveColor Borderless bool Active bool Filename string HighlightedContent string SyntaxTheme string }
Model represents the properties of a code bubble.
func New ¶
func New(active, borderless bool, borderColor lipgloss.AdaptiveColor) Model
New creates a new instance of code.
func (*Model) SetBorderColor ¶
func (m *Model) SetBorderColor(color lipgloss.AdaptiveColor)
SetBorderColor sets the current color of the border.
func (*Model) SetBorderless ¶
SetBorderless sets weather or not to show the border.
func (*Model) SetFileName ¶
SetFileName sets current file to highlight.
func (*Model) SetIsActive ¶
SetIsActive sets if the bubble is currently active.
func (*Model) SetSyntaxTheme ¶
SetSyntaxTheme sets the syntax theme of the rendered code.
Click to show internal directories.
Click to hide internal directories.