mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
lib/options: use code-block for multiline defaults
Detect whether a plugin default is multiline using `hasInfix "\n"`. Also remove `multiline=false` from the `toPretty` call.
This commit is contained in:
parent
9b340f8bab
commit
cedc1e4799
1 changed files with 6 additions and 5 deletions
|
@ -64,12 +64,13 @@ rec {
|
||||||
# Assume a string default is already formatted as intended,
|
# Assume a string default is already formatted as intended,
|
||||||
# historically strings were the only type accepted here.
|
# historically strings were the only type accepted here.
|
||||||
# TODO consider deprecating this behavior so we can properly quote strings
|
# TODO consider deprecating this behavior so we can properly quote strings
|
||||||
if isString defaultValue then
|
if isString defaultValue then defaultValue else generators.toPretty { } defaultValue;
|
||||||
defaultValue
|
|
||||||
else
|
|
||||||
generators.toPretty { multiline = false; } defaultValue;
|
|
||||||
in
|
in
|
||||||
"Plugin default: `${default}`";
|
"Plugin default:"
|
||||||
|
+ (
|
||||||
|
# Detect whether `default` is multiline or inline:
|
||||||
|
if hasInfix "\n" default then "\n\n```nix\n${default}\n```" else " `${default}`"
|
||||||
|
);
|
||||||
|
|
||||||
mkDesc =
|
mkDesc =
|
||||||
default: desc:
|
default: desc:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue