Documentation
¶
Index ¶
- Constants
- Variables
- type KeyMap
- type Model
- func (m *Model) GetAllSlides() []string
- func (m *Model) GetCurrentPage() int
- func (m Model) Init() tea.Cmd
- func (m *Model) Initial() error
- func (m *Model) PageTotal() int
- func (m *Model) Render() string
- func (m *Model) SetPage(page int)
- func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m Model) View() string
- type Search
- type TagBar
Constants ¶
View Source
const (
SEP = "\n---\n" // sep of slides
)
Variables ¶
View Source
var DefaultKeyMap = KeyMap{ Help: key.NewBinding( key.WithKeys(k.Help), key.WithHelp(k.Help, "toggle help"), ), Quit: key.NewBinding( key.WithKeys(k.Quit...), key.WithHelp(k.Quit[0], "quit"), ), FirstSlide: key.NewBinding( key.WithKeys(k.Slide.First), key.WithHelp(k.Slide.First, "first slide"), ), LastSlide: key.NewBinding( key.WithKeys(k.Slide.Last), key.WithHelp(k.Slide.Last, "last slide"), ), NextSlide: key.NewBinding( key.WithKeys(k.Slide.Next...), key.WithHelp(k.Slide.Next[0], "next slide"), ), PrevSlide: key.NewBinding( key.WithKeys(k.Slide.Prev...), key.WithHelp(k.Slide.Prev[0], "previous slide"), ), MoveTop: key.NewBinding( key.WithKeys(k.Move.Top), key.WithHelp(k.Move.Top, "move to the top"), ), MoveBottom: key.NewBinding( key.WithKeys(k.Move.Bottom), key.WithHelp(k.Move.Bottom, "move to the bottom"), ), MoveUp: key.NewBinding( key.WithKeys(k.Move.Up...), key.WithHelp(k.Move.Up[0], "move up"), ), MoveDown: key.NewBinding( key.WithKeys(k.Move.Down...), key.WithHelp(k.Move.Down[0], "move down"), ), ScrollDown: key.NewBinding( key.WithKeys(k.Scroll.Down...), key.WithHelp(k.Scroll.Down[0], "scroll down"), ), ScrollUp: key.NewBinding( key.WithKeys(k.Scroll.Up...), key.WithHelp(k.Scroll.Up[0], "scroll up"), ), Search: key.NewBinding( key.WithKeys(k.Search.Forward), key.WithHelp(k.Search.Forward, "search forward"), ), PrevSearched: key.NewBinding( key.WithKeys(k.Search.PrevMatch), key.WithHelp(k.Search.PrevMatch, "go to the previous match in the slides"), ), NextSearched: key.NewBinding( key.WithKeys(k.Search.NextMatch), key.WithHelp(k.Search.NextMatch, "go to the next match in the slides"), ), ToggleTagbar: key.NewBinding( key.WithKeys(k.Tagbar.Toggle), key.WithHelp(k.Tagbar.Toggle, "toggle tagbar"), ), }
Functions ¶
This section is empty.
Types ¶
type KeyMap ¶
type KeyMap struct {
Help key.Binding
Quit key.Binding
FirstSlide key.Binding
LastSlide key.Binding
PrevSlide key.Binding
NextSlide key.Binding
MoveTop key.Binding
MoveBottom key.Binding
MoveUp key.Binding
MoveDown key.Binding
ScrollDown key.Binding
ScrollUp key.Binding
Search key.Binding
NextSearched key.Binding
PrevSearched key.Binding
ToggleTagbar key.Binding
}
Keymap represents the keymap configuration.
type Model ¶
type Model struct {
// Filename is the markdown file to be loaded
Filename string
// Theme is the theme style for rendering markdown
Theme string
// Page is the current slide number
Page int
// Slide is the current slide content (converted to markdown)
Slide string
// Slides are all the slides in the markdown file
Slides []string
// TagBar is the tagbar configuration
TagBar *TagBar
// Search is the search input
Search *Search
// contains filtered or unexported fields
}
Model is the main model for the slides.
func (*Model) GetAllSlides ¶
GetAllSlides returns all slides.
func (*Model) GetCurrentPage ¶
GetCurrentSlide returns the current slide.
type Search ¶
type Search struct {
// IsActive indicates if search is active
IsActive bool
// TextInput is the search input
TextInput textinput.Model
// SearchResultsCache is the cache of search results
SearchResultsCache []int
// CurrentCachedIndex is the current index of the cache
CurrentCachedIndex int
}
Search is the search model.
Click to show internal directories.
Click to hide internal directories.