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

View file

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