added decktext parser and spec
This commit is contained in:
@@ -188,6 +188,21 @@ Exports the following functions:
|
||||
- `totp(key, time_step, digits=6)`: generate a `digits`-long TOTP code from (bytes-only) key, using `time_step` as the basis (30 seconds is default and the most common)
|
||||
- `get_epoch()`: a helper platform-agnostic function to get the current Unix timestamp in seconds
|
||||
|
||||
### `deck.text`
|
||||
|
||||
A library that implements a [DeckText](decktext-spec.md) format parser. Exports a single class, `DeckText`, with the following methods:
|
||||
|
||||
- `doc = DeckText(src=None)` constructor: initialize a DeckText document object from the passed source
|
||||
- `doc.load(src)`: load DeckText source into the existing document object.
|
||||
|
||||
After the source is loaded, the document object exposes two properties: `title` and `pages`.
|
||||
|
||||
The `title` property is a normal string that represents the document's title (read from the `<title>` HTML tag).
|
||||
|
||||
The `pages` property contains a list of DeckText pages in the form of `{content, links}` dictionary, where `content` is the rendered (ready-to-display) page content and `links` is the list of links present on the page.
|
||||
|
||||
Each link is in the form of `(url, label)` tuple. The client using this class for DeckText page rendering is supposed to provide a UI to visit the links based on this list.
|
||||
|
||||
### `deck.llm`
|
||||
|
||||
A helper library for interaction with remote LLM (large language model) endpoints that expose OpenAI-compatible API. As of now, it only exports a single class, `LLMChat`, to encapsulate all the interaction.
|
||||
|
||||
Reference in New Issue
Block a user