Skip to content

Commit 2fa4b64

Browse files
committed
revamp navigation
1 parent 4d7319e commit 2fa4b64

File tree

11 files changed

+212
-26
lines changed

11 files changed

+212
-26
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
description: Learn about the internals that power Lite XL.
3+
---
4+
5+
# Advanced Topics
6+
7+
This section contains deep dives and explainers for core functionalities,
8+
such as the renderer.
9+
It is more technical can be a good read for those who want to know Lite XL
10+
does text rendering, etc.
11+
12+
## In this section
13+
14+
| Topic | Description
15+
| ----- | -----------
16+
| [How Renderer Works] | Learn how Lite XL makes immediate-mode rendering fast and efficient.
17+
18+
19+
[How Renderer Works]: ./how-renderer-works.md

docs/developer-guide/commands-and-shortcuts/commands.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
description: Learn how to create and call commands programmatically in Lite XL.
33
---
44

5-
As explained in the User Guide, a lot of Lite XL's functionalities are implemented as commands.
6-
75
Each command has a predicate — a condition to check if Lite XL should run the command.
86
The predicate will return a boolean and other values to be consumed by the command function.
97

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
description: Learn how Lite XL perform tasks with commands and keyboard shortcuts.
3+
---
4+
5+
# Commands and Shortcuts
6+
7+
Most tasks in Lite XL are performed with commands, based on a simple system of
8+
predicates and user-defined actions.
9+
Commands can be bound to keyboard shortcuts,
10+
which will be run when the corresponding keys or mouse buttons are pressed.
11+
12+
A common idiom used in Lite XL is to listen to `View:on_mouse_moved()`
13+
and record the item that the cursor is hovering on;
14+
and then add a command to set the hovered item as the selected item
15+
when the left-clicks the item.
16+
This idiom does not require the user to listen to `View:on_mouse_click()` and allows
17+
unifying the mouse and keyboard handling code.
18+
19+
## In this section
20+
21+
| Topic | Description
22+
| ----- | -----------
23+
| [Commands] | Learn how to create and call commands programmatically.
24+
| [Managing Keyboard Shortcuts] | Learn in detail how to add and manage keyboard shortcuts.
25+
26+
27+
[Commands]: ./commands.md
28+
[Managing Keyboard Shortcuts]: ./managing-keyboard-shortcuts.md

docs/developer-guide/index.md

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,28 @@ Lite XL is a fork of [lite][6].
2525
As such, a lot of concepts used in lite is inherited in Lite XL.
2626
[Lite: An Implementation Overview][7] is an excellent article that explains many concepts about lite.
2727

28-
## Types of plugins
29-
30-
There are a few types of plugins.
31-
Syntaxes and colors are considered as subset of plugins.
32-
These subsets of plugins only interact with the syntax highlighter and the `style` table respectively.
33-
34-
## Interactive debugging
35-
36-
Other than using GDB to debug the C part of Lite XL, you can also debug the Lua part with [lite-debugger][8].
37-
Follow [this guide][9] to learn how it works.
38-
39-
40-
[1]: https://www.lua.org/manual/5.4/
41-
[2]: https://www.lua.org/pil/
42-
[3]: https://tylerneylon.com/a/learn-lua/
43-
[4]: http://www.tutorialspoint.com/lua/lua_overview.htm
44-
[5]: http://lua-users.org/wiki/LuaTutorial
45-
[6]: https://github.com/rxi/lite
46-
[7]: https://rxi.github.io/lite_an_implementation_overview.html
47-
[8]: https://github.com/lite-xl/lite-xl-plugins/blob/master/plugins/lite-debugger.lua?raw=1
48-
[9]: ./writing-plugins/debugging.md
28+
## In this section
29+
30+
| Topics | Descrption
31+
| ------ | ----------
32+
| [Syntaxes and Themes][8] | Learn how Lite XL loads syntax definitions and themes.
33+
| [Commands and Shortcuts][9] | Learn how Lite XL perform tasks with commands and keyboard shortcuts.
34+
| [Writing Plugins][10] | Learn how to write plugins for Lite XL.
35+
| [Using Libraries][11] | Learn how to use library functions in Lite XL.
36+
| [Samples][12] | View samples of plugins built for Lite XL.
37+
| [Advanced Topics][13] | Learn about the internals that power Lite XL.
38+
39+
40+
[1]: https://www.lua.org/manual/5.4/
41+
[2]: https://www.lua.org/pil/
42+
[3]: https://tylerneylon.com/a/learn-lua/
43+
[4]: http://www.tutorialspoint.com/lua/lua_overview.htm
44+
[5]: http://lua-users.org/wiki/LuaTutorial
45+
[6]: https://github.com/rxi/lite
46+
[7]: https://rxi.github.io/lite_an_implementation_overview.html
47+
[8]: ./syntaxes-and-themes/index.md
48+
[9]: ./commands-and-shortcuts/index.md
49+
[10]: ./writing-plugins/index.md
50+
[11]: ./using-libraries/index.md
51+
[12]: ./samples/index.md
52+
[13]: ./advanced-topics/index.md

docs/developer-guide/samples/index.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
description: View samples of plugins built for Lite XL.
3+
---
4+
5+
# Samples
6+
7+
This section contains sample plugins to illustrate various features of Lite XL.
8+
9+
## In this section
10+
11+
| Topic | Description
12+
| ----- | -----------
13+
| [Simple Plugin] | Learn to write a simple plugin that draws text in the top right corner of the editor window.
14+
| [ToolbarView] | Learn to extend a View in Lite XL for extra functionality.
15+
16+
17+
[Simple Plugin]: ./simple-plugin.md
18+
[ToolbarView]: ./toolbarview.md
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
description: Learn how Lite XL loads syntax definitions and themes.
3+
---
4+
5+
# Syntaxes and Themes
6+
7+
In Lite XL, adding support for different programming languages is accomplished by adding
8+
syntax definitions to the tokenizer.
9+
The highlighter uses the tokenizer to get a stream of tokens, and queries the visual styles
10+
from the current theme.
11+
The tokens are then rendered to the window.
12+
13+
Syntax definition and theme files are Lua files that are loaded during Lite XL initialization.
14+
Syntax definition calls `syntax.add()` while theme files manipulate the values in the `styles` table.
15+
16+
## In this section
17+
18+
| Topic | Description
19+
| ----- | -----------
20+
| [Creating Syntaxes] | Learn how to add support for other programming languages.
21+
| [Creating Themes] | Learn how to create themes.
22+
23+
24+
[Creating Syntaxes]: ./creating-syntaxes.md
25+
[Creating Themes]: ./creating-themes.md
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
description: Learn how to use library functions in Lite XL.
3+
---
4+
5+
# Using Libraries
6+
7+
Lite XL implements most of the functionalities in Lua, but it would be impossible to create
8+
a window, get input events, or perform various filesystem operations in pure Lua,
9+
without relying on functions provided by the platform.
10+
11+
Lite XL has its own bindings to [SDL2], which provides cross-platform abstractions to windowing
12+
and event handling.
13+
Other than that Lite XL also uses [PCRE2] to provide support for regular expressions as Lua only
14+
has a simple pattern-based matching engine.
15+
Finally, Lite XL provides an API for running starting and managing programs, as well as handling
16+
the input / output of the program without blocking the editor.
17+
18+
## In this section
19+
20+
| Topic | Description
21+
| ----- | -----------
22+
| [Using Regular Expressions] | Learn to use regular expressions in plugins or user configuration.
23+
| [Interacting with the OS] | Learn how to interact with the OS, such as the clipboard and querying high-resolution time.
24+
| [Child Processes] | Learn how to use the Process API to start and manage child processes.
25+
26+
27+
[SDL2]: https://libsdl.org
28+
[PCRE2]: https://www.pcre.org
29+
[Using Regular Expressions]: ./using-regular-expressions.md
30+
[Interacting with the OS]: ./interacting-with-the-os.md
31+
[Child Processes]: ./child-processes.md
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
description: Learn how to write plugins for Lite XL.
3+
---
4+
5+
# Writing Plugins
6+
7+
Lite XL allows users to load Lua files to add or modify functionalities of the editor.
8+
In general, a plugin is a Lua file or a directory that contains an `init.lua` file
9+
serving as the entrypoint.
10+
Plugins can load other Lua files or native libraries that can be used to call system functions,
11+
but are responsible for managing their own dependencies.
12+
13+
!!! tip
14+
[Plugin managers] provide dependency resolution capabilities for plugins,
15+
and automates the installation of native libraries on different platforms.
16+
If you aren't using a plugin manager, you should definitely consider using one.
17+
18+
## Overriding existing functionality
19+
20+
Lite XL heavily uses the idiom of overriding existing function that does a certain task.
21+
For instance, to run something when the user saves a file, you can override `Doc:save()`
22+
to add your own functionality before or after calling the original `Doc:save()` function.
23+
This design makes plugin code generally easier to tinker with, but gets complex when the user
24+
installs a bunch of plugins that doesn't interact with each other well.
25+
This is a trade-off [lite] and Lite XL made for the sake of simplicity.
26+
27+
## Native libraries
28+
29+
Lite XL, since v2.1.0, supports loading shared libraries
30+
(also known as dynamically-linked libraries on Windows) to provide functionalities
31+
that are not available with Lite XL's own native bindings.
32+
Lite XL uses [Lua's convention] for these libraries, but extends the convention to support
33+
statically-linked Lua in Lite XL.
34+
35+
!!! warning
36+
Using native libraries in v2.1.0 is **not recommended**, as the native plugin API
37+
was missing several Lua symbols that will cause a crash when called.
38+
This behavior is fixed in v2.1.1.
39+
40+
## In this section
41+
42+
| Topic | Description
43+
| ----- | -----------
44+
| [Classes and Objects] | Learn how Lite XL implements OOP in Lua.
45+
| [Documents] | Learn about how to operate on files opened in the editor.
46+
| [Views] | Learn about Views, one of the core concepts for building UIs.
47+
| [Background Tasks] | Learn how to use background tasks to perform long-running operations.
48+
| [Debugging] | Learn how to debug Lite XL with the debugger plugin, and other related tips.
49+
50+
51+
[Plugin managers]: ../../user-guide/managing-plugins.md#plugin-managers
52+
[lite]: https://github.com/rxi/lite
53+
[Lua's convention]: https://www.lua.org/manual/5.4/manual.html#pdf-package.searchers
54+
[Classes and Objects]: ./classes-and-objects.md
55+
[Documents]: ./documents.md
56+
[Views]: ./views.md
57+
[Background Tasks]: ./background-tasks.md
58+
[Debugging]: ./debugging.md

mkdocs.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ theme:
3333
- navigation.instant.progress
3434
- navigation.tracking
3535
- navigation.tabs
36-
- navigation.sections
3736
- navigation.prune
3837
- navigation.indexes
3938
- navigation.top
@@ -133,26 +132,32 @@ nav:
133132
- "Developer Guide":
134133
- developer-guide/index.md
135134
- "Syntaxes and Themes":
135+
- developer-guide/syntaxes-and-themes/index.md
136136
- "Creating Syntaxes": developer-guide/syntaxes-and-themes/creating-syntaxes.md
137137
- "Creating Themes": developer-guide/syntaxes-and-themes/creating-themes.md
138138
- "Commands and Shortcuts":
139+
- developer-guide/commands-and-shortcuts/index.md
139140
- "Commands": developer-guide/commands-and-shortcuts/commands.md
140141
- "Managing Keyboard Shortcuts": developer-guide/commands-and-shortcuts/managing-keyboard-shortcuts.md
141142
- "Writing Plugins":
143+
- developer-guide/writing-plugins/index.md
142144
- "Classes and Objects": developer-guide/writing-plugins/classes-and-objects.md
143145
- "Documents": developer-guide/writing-plugins/documents.md
144146
- "Views": developer-guide/writing-plugins/views.md
145147
- "Background Tasks": developer-guide/writing-plugins/background-tasks.md
146148
- "Debugging": developer-guide/writing-plugins/debugging.md
147149
- "Using Libraries":
150+
- developer-guide/using-libraries/index.md
148151
- "Using Regular Expressions": developer-guide/using-libraries/using-regular-expressions.md
149152
- "Interacting with the OS": developer-guide/using-libraries/interacting-with-the-os.md
150153
- "Child Processes": developer-guide/using-libraries/child-processes.md
151154
- "Samples":
155+
- developer-guide/samples/index.md
152156
- "Simple Plugin": developer-guide/samples/simple-plugin.md
153-
- "ToolbarView": developer-guide/samples/views-toolbarview.md
157+
- "ToolbarView": developer-guide/samples/toolbarview.md
154158
- "Advanced Topics":
155-
- "How Renderer Works": developer-guide/advanced-topics/renderer-internals.md
159+
- developer-guide/advanced-topics/index.md
160+
- "How Renderer Works": developer-guide/advanced-topics/how-renderer-works.md
156161
- "About":
157162
- "Contributors": about/contributors.md
158163
- "FAQ": about/faq.md

0 commit comments

Comments
 (0)