lib/utils: fix literalLua multiline rendering

`lib.generators.toPretty` has bespoke handling for rendering nix strings
using either the `" "` or `'' ''` syntax, based on some heuristics.

Using `toPretty` instead of `toJSON` improves how literal-lua examples
render in the docs.
This commit is contained in:
Matt Sturgeon 2025-04-24 19:07:34 +01:00
parent 62ecd39b40
commit e6e5369535
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299

View file

@ -169,7 +169,7 @@ rec {
# Pass the value through mkRaw for validation
raw = mkRaw r;
# TODO: consider switching to lib.generators.mkLuaInline ?
exp = "lib.nixvim.mkRaw " + builtins.toJSON raw.__raw;
exp = "lib.nixvim.mkRaw " + lib.generators.toPretty { } raw.__raw;
in
lib.literalExpression exp;