2024-07-30 09:03:10 +02:00
|
|
|
@import ../template.nml
|
2024-07-30 16:40:14 +02:00
|
|
|
%<make_doc({"Styles"}, "User-Defined", "User-Defined Styles")>%
|
2024-07-29 21:28:06 +02:00
|
|
|
|
2024-11-03 11:52:26 +01:00
|
|
|
#{custom_style} Defining a custom style
|
2024-08-05 09:04:09 +02:00
|
|
|
```Lua
|
|
|
|
function undercustom_start(color)
|
|
|
|
nml.raw.push("inline", "<span style=\"border-bottom: 1px dashed " .. color .. "\">")
|
|
|
|
end
|
|
|
|
|
|
|
|
function undercustom_end()
|
|
|
|
nml.raw.push("inline", "</span>")
|
|
|
|
end
|
|
|
|
|
2024-10-31 00:27:54 +01:00
|
|
|
nml.custom_style.define_toggled("Undercustom Red", "~", function() undercustom_start("red") end, undercustom_end)
|
|
|
|
nml.custom_style.define_paired("Undercustom Green", "[|", "|]", function() undercustom_start("green") end, undercustom_end)
|
2024-08-05 09:04:09 +02:00
|
|
|
>%
|
|
|
|
```
|
|
|
|
|
|
|
|
%<[main]
|
|
|
|
function undercustom_start(color)
|
|
|
|
nml.raw.push("inline", "<span style=\"border-bottom: 1px dashed " .. color .. "\">")
|
|
|
|
end
|
|
|
|
|
|
|
|
function undercustom_end()
|
|
|
|
nml.raw.push("inline", "</span>")
|
|
|
|
end
|
|
|
|
|
2024-10-31 00:27:54 +01:00
|
|
|
nml.custom_style.define_toggled("Undercustom Red", "~", function() undercustom_start("red") end, undercustom_end)
|
|
|
|
nml.custom_style.define_paired("Undercustom Green", "[|", "|]", function() undercustom_start("green") end, undercustom_end)
|
2024-08-05 09:04:09 +02:00
|
|
|
>%
|
|
|
|
Results in the following:
|
|
|
|
* ``Plain Text,~Dashed underline~`` → ~Dashed underline~
|
|
|
|
* ``Plain Text,[|Dashed underline|]`` → [|Dashed underline|]
|
|
|
|
|
|
|
|
# Limitations
|
|
|
|
|
|
|
|
* Custom styles cannot be removed and will be defined through the entire document
|
|
|
|
* Custom styles defined from lua must have their `start` and `end` functions in the `main` lua kernel.
|