-
-
Notifications
You must be signed in to change notification settings - Fork 72
Description
As others have echoed many times, thanks for this client -- it's certainly one of the better terminal ones!
I was looking at the TODO list, and noticed you had an item on there which I'm keen to work on, assuming it's not already being implemented elsewhere (in which case I'll look at some other feature to code), and that's adding a ToC (Table of Contents).
In adding this, I have some questions before I start submitting PRs for this. The first one is to do with the parser (in renderer.go). At the moment, the parser is stateless in that it's rendering the page line-by-line, and building up a display output which can be rendered. I'm actually wondering if we should instead have the concept of a Parser, perhaps something like:
type Parser struct {
scanner *bufio.Scanner
Lines []Line
isPre bool
tableofcontents []*Heading // see toc.go
}Where we have a bufio.Scanner representing the raw gemini lines, and that Lines is out struct of parsed content.
From there, we can introduce further types that know how to handle:
- Headings
- Links
- Quotes
Most of this is yak-shaving to then be able to build up a ToC though, which is my next point. As I see it, a ToC would have to represent two things:
- An overview of the document, with backlinks to the rendered document so that it's scrolled at the appropriate point (think HTML anchors
foo.html#whatever) - Be displayed somewhere convenient on the UI
Did you have anything in mind with regards to point 2? I was imagining a sidebar on either the left or right of the screen which can be toggled on and off, perhaps?
Point 1 is just a variation on a theme about getting the Parser into a shape where adding in these ephemeral states which fall outside of pure gemini-rendering become easier.
Let me know your thoughts, and I'll happily crack on with this.
Thanks again!
Thomas