Render descriptions as Markdown (#667)

* Render descriptions as Markdown

Following https://github.com/NixOS/nixpkgs/pull/237557, DocBook
descriptions are not supported any more.

We cannot use options.json any more because it still has DocBook
descriptions in 22.11, so read the options from the modules directly.

* Bump VERSION
This commit is contained in:
Naïm Favier 2023-06-28 17:44:44 +02:00 committed by GitHub
parent b5acb880d1
commit f31c2a395e
Failed to generate hash of commit
3 changed files with 10 additions and 14 deletions

View file

@ -1 +1 @@
40
42

View file

@ -156,7 +156,10 @@ rec {
all = packages ++ apps ++ options;
# nixpkgs-specific, doesn't use the flake argument
nixos-options = lib.mapAttrsToList (name: option: option // { inherit name; })
(builtins.fromJSON (builtins.unsafeDiscardStringContext (builtins.readFile
"${(import <nixpkgs/nixos/release.nix> {}).options}/share/doc/nixos/options.json")));
nixos-options = readNixOSOptions {
module = import <nixpkgs/nixos/modules/module-list.nix> ++ [
<nixpkgs/nixos/modules/virtualisation/qemu-vm.nix>
{ nixpkgs.hostPlatform = "x86_64-linux"; }
];
};
}

View file

@ -117,18 +117,11 @@ impl Serialize for DocString {
S: Serializer,
{
match self {
DocString::String(db) => {
serializer.serialize_str(&db.render_docbook().unwrap_or_else(|e| {
warn!("Could not render DocBook content: {}", e);
db.to_owned()
}))
}
DocString::DocFormat(DocFormat::MarkdownDoc(md)) => {
serializer.serialize_str(&md.render_markdown().unwrap_or_else(|e| {
DocString::String(md) | DocString::DocFormat(DocFormat::MarkdownDoc(md)) => serializer
.serialize_str(&md.render_markdown().unwrap_or_else(|e| {
warn!("Could not render Markdown content: {}", e);
md.to_owned()
}))
}
})),
}
}
}