Skip to content

Commit

Permalink
docs: fix Lua syntax highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
b0o committed Apr 11, 2024
1 parent 49cd56c commit ccc8345
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions doc/incline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ render~
statusline will be temporalily hidden. It will be shown again as soon as
`render` returns a non-nil result.

*incline-render-spec*
Expressed in pseudocode, a loose specification of the `config.render` option:
>
type render_props = {
Expand Down Expand Up @@ -174,7 +175,7 @@ render~
| render_fn
| render_preset_name
<
For example: >
For example: >lua
render = function()
return {
{ "foo", guifg = "blue" },
Expand Down Expand Up @@ -318,7 +319,7 @@ window.winhighlight~
Map values are a highlight group name to use as the override, or a table of
|highlight-args|.

For example, `A` and `B` are equivalent: >
For example, `A` and `B` are equivalent: >lua

-- A
incline.setup {
Expand Down Expand Up @@ -346,7 +347,7 @@ window.winhighlight.active~
Type: `table`
Valid: `map[string](string | hl_args)`
Transform: `extend` (|incline-config-transforms| |incline-transform-extend|)
Default: >
Default: >lua
{
Search = 'None',
EndOfBuffer = 'None',
Expand All @@ -369,7 +370,7 @@ window.winhighlight.inactive~
Type: `table`
Valid: `map[string](string | hl_args)`
Transform: `extend` (|incline-config-transforms| |incline-transform-extend|)
Default: >
Default: >lua
{
Search = 'None',
EndOfBuffer = 'None',
Expand Down Expand Up @@ -423,7 +424,7 @@ window.options~
Type: `table`
Valid: `map[string]string`
Transform: `extend` (|incline-config-transforms| |incline-transform-extend|)
Default: >
Default: >lua
{
wrap = false,
signcolumn = false,
Expand Down Expand Up @@ -549,7 +550,7 @@ highlight.groups~
Type: `table`
Valid: `map[string](string | hl_args)`
Transform: `extend` (|incline-config-transforms| |incline-transform-extend|)
Default: >
Default: >lua
{
InclineNormal = 'NormalFloat',
InclineNormalNC = 'NormalFloat',
Expand Down Expand Up @@ -588,7 +589,7 @@ highlight.groups~

------------------------------------------------------------------------------
2.3 Default Configuration *incline-default-config*
>
>lua
{
debounce_threshold = {
falling = 50,
Expand Down Expand Up @@ -676,7 +677,7 @@ default value.
For example, the `window.options` field has a default transform of `extend`.
This means that user-configured options extend the default options rather than
replacing them. For example:
>
>lua
> -- Before:
> -- Print out the default value of window.options
> print(vim.inspect(require'incline.config'.window.options)
Expand Down Expand Up @@ -711,14 +712,14 @@ Built-in transforms~
replace~
Fully replaces the default value of the configuration option. This is the
default transform if none is specified in the option's documentation.
>
>lua
require'incline.config'.replace
<
*incline-transform-extend*
extend~
Extends the default value of the option. Only valid for options with default
values that are list-like or dict-like tables.
>
>lua
require'incline.config'.extend
<
*incline-transform-override*
Expand All @@ -727,17 +728,17 @@ It is possible to override the default transform by explicitly specifying the
one you want to use. To do this, use one of the transform functions exported
by `incline.config`.

That is, instead of: >
That is, instead of: >lua
local incline = require'incline'`
incline.setup { window = { options = { winblend = 10 } }`
<
You can use: >
You can use: >lua
local incline = require'incline'
local config = require'incline.config'
incline.setup { window = { options = config.replace { winblend = 10 } }
<
Another example, following the example from the previous section:
>
>lua
> -- Before:
> -- Print out the default value of window.options
> print(vim.inspect(require'incline.config'.window.options)
Expand Down Expand Up @@ -789,24 +790,27 @@ Color Helpers
Converts a hex color string to a table of RGB values in the range [0, 1].
Leading `#` is optional.

Example: >
Example: >lua
incline.helpers.hex_to_rgb('#ff00cc') -- { 0.8, 0.0, 1.0 }
<


`incline.helpers.rgb_to_hex(rgb)` *incline.helpers.rgb_to_hex()*
Converts a table of RGB values in the range [0, 1] to a hex color string.

Example: >
Example: >lua
incline.helpers.rgb_to_hex({ 0.8, 0.0, 1.0 }) -- '#ff00cc'
<


`incline.helpers.relative_luminance(color)` *incline.helpers.relative_luminance()*
Calculates the relative luminance of a color. Color can be a hex string or a
table of RGB values in the range [0, 1], like those returned by
|incline.helpers.hex_to_rgb()|.

Example: >
Example: >lua
incline.helpers.relative_luminance('#ff00cc') -- 0.25619...
<


`incline.helpers.contrast_color(color, [opts])` *incline.helpers.contrast_color()*
Expand All @@ -824,7 +828,7 @@ Color Helpers
light or dark color. Must be in the range [0, 1].
Default: 0.179, as per the W3C recommendation.

Example: >
Example: >lua
incline.helpers.contrast_color('#ff00cc') -- '#00ff33'
<

Expand Down Expand Up @@ -915,7 +919,7 @@ window.options.winhighlight~
Use window.winhighlight instead of window.options.winhighlight.
Note that the accepted format has changed as well.

This: >
This: >lua
incline.setup {
window = {
options = {
Expand All @@ -924,7 +928,7 @@ window.options.winhighlight~
}
}
<
Becomes this: >
Becomes this: >lua
incline.setup {
window = {
winhighlight = {
Expand Down

0 comments on commit ccc8345

Please sign in to comment.