diff options
Diffstat (limited to 'res/about/help.gmi')
-rw-r--r-- | res/about/help.gmi | 102 |
1 files changed, 94 insertions, 8 deletions
diff --git a/res/about/help.gmi b/res/about/help.gmi index 3f21adb8..f71f5164 100644 --- a/res/about/help.gmi +++ b/res/about/help.gmi | |||
@@ -63,7 +63,7 @@ Lagrange's user interface is modeled after web browsers: | |||
63 | 63 | ||
64 | * There is a navigation bar at the top with Back and Forward buttons. | 64 | * There is a navigation bar at the top with Back and Forward buttons. |
65 | * There is a tab bar for switching tabs. The tab bar is hidden if there is only one tab open. | 65 | * There is a tab bar for switching tabs. The tab bar is hidden if there is only one tab open. |
66 | * There is a sidebar for managing bookmarks and TLS identities, and viewing history and the page outline. The sidebar is hidden by default. | 66 | * There is a sidebar for managing bookmarks and TLS identities, and viewing history and the page outline. Sidebars are hidden by default. |
67 | * There is a search bar that appears at the bottom when searching text on the page. | 67 | * There is a search bar that appears at the bottom when searching text on the page. |
68 | 68 | ||
69 | Tip: Try pressing ${CTRL+}5 now to see the page outline. | 69 | Tip: Try pressing ${CTRL+}5 now to see the page outline. |
@@ -126,17 +126,17 @@ Press ${CTRL+}T to open a new tab, and ${CTRL+}W to close the current tab. Right | |||
126 | 126 | ||
127 | The set of open tabs is restored when you launch Lagrange. | 127 | The set of open tabs is restored when you launch Lagrange. |
128 | 128 | ||
129 | ## Sidebar | 129 | ## Sidebars |
130 | 130 | ||
131 | The sidebar can be toggled via menus or by pressing ${SHIFT+}${CTRL+}L. It has five tabs: | 131 | The sidebars can be toggled via menus or by pressing ${SHIFT+}${CTRL+}L or ${SHIFT+}${CTRL+}P (for the left/right sidebar, respectively). Both sidebars have five tabs: |
132 | 132 | ||
133 | * Bookmarks: List of bookmarks that you've created. These appear first in search results for quick and easy access. | 133 | * Bookmarks: List of bookmarks that you've created. These appear first in search results for quick and easy access. |
134 | * Feeds: Entries found on subscribed feed index pages. | 134 | * Feeds: Entries found on subscribed pages. |
135 | * History: Chronological list of visited URLs. This is not a full history of all the URLs you've accessed over time — only unique URLs are shown at the latest access time. | 135 | * History: Chronological list of visited URLs. This is not a full history of all the URLs you've accessed over time — only unique URLs are shown at the latest access time. |
136 | * Identities: TLS client certificates. | 136 | * Identities: TLS client certificates. |
137 | * Outline: List of the headings in the currently open tab. Useful when reading longer documents. | 137 | * Outline: List of the headings in the currently open tab. Useful when reading longer documents. |
138 | 138 | ||
139 | ${CTRL+}1 through ${CTRL+}5 switch between the sidebar tabs, or hide the sidebar if the current tab's key is pressed. You can also press Escape to dismiss the sidebar. | 139 | ${CTRL+}1 through ${CTRL+}5 switch between the left sidebar tabs, or hide the sidebar if the current tab's key is pressed. You can also press Escape to dismiss sidebars. |
140 | 140 | ||
141 | ## Bookmarks | 141 | ## Bookmarks |
142 | 142 | ||
@@ -150,10 +150,11 @@ In addition to a title, bookmarks can have tags. Some tags have a special meanin | |||
150 | 150 | ||
151 | * Set a "homepage" tag on a bookmark to make it one of the pages that will be opened when pressing the 🏠 button. If multiple bookmarks are tagged as homepages, a random one is selected. | 151 | * Set a "homepage" tag on a bookmark to make it one of the pages that will be opened when pressing the 🏠 button. If multiple bookmarks are tagged as homepages, a random one is selected. |
152 | * A "subscribed" tag means that Lagrange will periodically fetch the bookmarked page and look for Gemini feed links. All the found links that match the required style ("YYYY-MM-DD Entry title") will appear in the Feeds sidebar tab. | 152 | * A "subscribed" tag means that Lagrange will periodically fetch the bookmarked page and look for Gemini feed links. All the found links that match the required style ("YYYY-MM-DD Entry title") will appear in the Feeds sidebar tab. |
153 | * "headings" can be used together with "subscribed" to subscribe to new headings instead of Gemini feed links. | ||
153 | 154 | ||
154 | ## Feeds | 155 | ## Feeds |
155 | 156 | ||
156 | You may be familiar with RSS and Atom XML feeds from the web. Lagrange does _not_ support RSS/Atom, only Gemini feeds. A Gemini feed is simply a regular 'text/gemini' page that contains one or more links whose labels are formatted in a particular way. | 157 | You may be familiar with RSS and Atom XML feeds from the web. Lagrange does _not_ support RSS or Atom, only Gemini feeds. A Gemini feed is simply a regular 'text/gemini' page that contains one or more links whose labels are formatted in a particular way. |
157 | 158 | ||
158 | => gemini://gemini.circumlunar.space/docs/companion/subscription.gmi See "Subscribing to Gemini pages" for more information. | 159 | => gemini://gemini.circumlunar.space/docs/companion/subscription.gmi See "Subscribing to Gemini pages" for more information. |
159 | 160 | ||
@@ -213,8 +214,6 @@ You can find a number of settings in Preferences to customize the user interface | |||
213 | 214 | ||
214 | ### Browsing behavior | 215 | ### Browsing behavior |
215 | 216 | ||
216 | The "Outline on scrollbar" option shows the page outline when the mouse cursor is moved over the scrollbar, allowing one to better navigate long documents. The outline will disappear after the mouse cursor is moved away. If you need a persistent outline, one is always available in the sidebar. | ||
217 | |||
218 | One important characteristic of Gemini is that you remain in control of what gets loaded and when. The browser will not suddenly fetch a ton of images, autoplay videos, or make surreptitious connections to any tracking servers — each network request is purposeful and manually triggered. With this in mind, the "Load image on scroll" option is provided to assist keyboard-only browsing and to facilitate a focused reading experience. When enabled, if there is an image link visible on the page and you press Space or ↓, it will be loaded and shown inline _instead_ of the view scrolling down. This allows you to read and see all the content of the page while only tapping on a single key on the keyboard. | 217 | One important characteristic of Gemini is that you remain in control of what gets loaded and when. The browser will not suddenly fetch a ton of images, autoplay videos, or make surreptitious connections to any tracking servers — each network request is purposeful and manually triggered. With this in mind, the "Load image on scroll" option is provided to assist keyboard-only browsing and to facilitate a focused reading experience. When enabled, if there is an image link visible on the page and you press Space or ↓, it will be loaded and shown inline _instead_ of the view scrolling down. This allows you to read and see all the content of the page while only tapping on a single key on the keyboard. |
219 | 218 | ||
220 | ### Window and UI options | 219 | ### Window and UI options |
@@ -315,12 +314,99 @@ Other Unix : ~/.config/lagrange/ | |||
315 | 314 | ||
316 | * bindings.txt | 315 | * bindings.txt |
317 | * bookmarks.txt | 316 | * bookmarks.txt |
317 | * feeds.txt | ||
318 | * idents.binary and idents/ | 318 | * idents.binary and idents/ |
319 | * mimehooks.txt | ||
319 | * prefs.cfg | 320 | * prefs.cfg |
320 | * state.binary | 321 | * state.binary |
321 | * trusted.txt | 322 | * trusted.txt |
322 | * visited.txt | 323 | * visited.txt |
323 | 324 | ||
325 | # MIME hooks | ||
326 | |||
327 | MIME hooks enable piping Gemini responses through external programs for arbitrary processing. This allows leveraging scripting languages and binary executables to perform format conversions, content transformation, and data analysis. | ||
328 | |||
329 | Hooks are configured using the file "mimehooks.txt" in Lagrange's config directory. Each hook has a regexp that is matched against the response MIME type and parameters, and each matching hook is offered the response body via stdin. The called external programs are free to rewrite the entire response, including the MIME type. If one of the hooks returns a valid response, it is used as the final response of the Gemini request. | ||
330 | |||
331 | Example use cases: | ||
332 | * Parsing an Atom XML feed and generating a Gemini feed index page | ||
333 | * Rendering a MIDI file using Timidity as PCM WAV | ||
334 | * Generate a graph PNG based on values in a CSV | ||
335 | * Converting HTML or Markdown to 'text/gemini' | ||
336 | * Language translations | ||
337 | |||
338 | ## Interface | ||
339 | |||
340 | When a hook is called, it is given the MIME type and parameters via command line arguments. The response body is provided via stdin. The request's URL is available in the REQUEST_URL environment variable. | ||
341 | |||
342 | The MIME type and parameters are split at semicolons, so "text/gemini; lang=ja" would be called as: | ||
343 | ``` | ||
344 | hookprogram text/gemini lang=ja | ||
345 | ``` | ||
346 | |||
347 | Output from the program (via stdout) must be a valid "20" Gemini response that includes the new MIME type: | ||
348 | ``` | ||
349 | 20 text/gemini; lang=en\r\n | ||
350 | {...body...} | ||
351 | ``` | ||
352 | |||
353 | Any output that does not follow this format is considered to mean that the hook refused to process the contents. The next hook will be offered the response instead. | ||
354 | |||
355 | ## mimehooks.txt syntax | ||
356 | |||
357 | Like other Lagrange configuration lines, mimehooks.txt has a simple line-oriented syntax. Lagrange must be restarted for changes to the configuration file to take effect. | ||
358 | |||
359 | Each hook is specified as three lines: | ||
360 | * A human-readable label (for reporting to the user) | ||
361 | * MIME type/parameter regular expression | ||
362 | * Command to execute, plus additional arguments each separated with semicolons | ||
363 | |||
364 | For example: | ||
365 | ``` | ||
366 | Convert Atom to Gemini feed | ||
367 | application/xml | ||
368 | /usr/bin/python3;/home/jaakko/atomconv.py | ||
369 | ``` | ||
370 | |||
371 | The hook program is executed directly without involving the shell. This means scripts must be invoked via the interpreter executable. | ||
372 | |||
373 | ## Example: Converting from Atom to Gemini | ||
374 | |||
375 | The following simple Python script demonstrates how a MIME hook could be used to parse an Atom XML document using Python 3 and output a Gemini feed index page based on the parsed entries. This is just a simple example; a more robust script could include more content from the Atom feed and handle errors, too. | ||
376 | ``` | ||
377 | import sys | ||
378 | import xml.etree.ElementTree as ET | ||
379 | |||
380 | def atomtag(n): | ||
381 | return '{http://www.w3.org/2005/Atom}' + n | ||
382 | |||
383 | root = ET.fromstring(sys.stdin.read()) | ||
384 | if root.tag != atomtag('feed'): | ||
385 | sys.exit(0) | ||
386 | feed_title = '' | ||
387 | feed_author = '' | ||
388 | feed_entries = [] | ||
389 | for child in root: | ||
390 | if child.tag == atomtag('title'): | ||
391 | feed_title = child.text | ||
392 | elif child.tag == atomtag('entry'): | ||
393 | feed_entries.append(child) | ||
394 | print("20 text/gemini\r") | ||
395 | print(f'# {feed_title}') | ||
396 | for entry in feed_entries: | ||
397 | entry_date = '' | ||
398 | entry_title = '' | ||
399 | entry_link = '' | ||
400 | for child in entry: | ||
401 | if child.tag == atomtag('updated'): | ||
402 | entry_date = child.text[:10] | ||
403 | elif child.tag == atomtag('title'): | ||
404 | entry_title = child.text | ||
405 | elif child.tag == atomtag('link'): | ||
406 | entry_link = child.attrib['href'] | ||
407 | print(f'=> {entry_link} {entry_date} {entry_title}') | ||
408 | ``` | ||
409 | |||
324 | # Open source licenses | 410 | # Open source licenses |
325 | 411 | ||
326 | => about:license | 412 | => about:license |