diff --git a/nixos/lib/make-options-doc/default.nix b/nixos/lib/make-options-doc/default.nix
index 7595b66771a5..3a5e1f2023d5 100644
--- a/nixos/lib/make-options-doc/default.nix
+++ b/nixos/lib/make-options-doc/default.nix
@@ -78,16 +78,13 @@ let
title = args.title or null;
name = args.name or (lib.concatStringsSep "." args.path);
in ''
-
-
-
- ${lib.optionalString (title != null) "${title} aka "}pkgs.${name}
-
-
- ${lib.optionalString (args ? comment) "${args.comment}"}
-
+ - [`${lib.optionalString (title != null) "${title} aka "}pkgs.${name}`](
+ https://search.nixos.org/packages?show=${name}&sort=relevance&query=${name}
+ )${
+ lib.optionalString (args ? comment) "\n\n ${args.comment}"
+ }
'';
- in "${lib.concatStringsSep "\n" (map (p: describe (unpack p)) packages)}";
+ in lib.concatMapStrings (p: describe (unpack p)) packages;
optionsNix = builtins.listToAttrs (map (o: { name = o.name; value = removeAttrs o ["name" "visible" "internal"]; }) optionsList);
diff --git a/nixos/lib/make-options-doc/mergeJSON.py b/nixos/lib/make-options-doc/mergeJSON.py
index e78056f3f59f..686c57ef7be0 100644
--- a/nixos/lib/make-options-doc/mergeJSON.py
+++ b/nixos/lib/make-options-doc/mergeJSON.py
@@ -239,6 +239,9 @@ def convertMD(options: Dict[str, Any]) -> str:
convertCode(name, option, 'example')
convertCode(name, option, 'default')
+
+ if 'relatedPackages' in option:
+ option['relatedPackages'] = convertString(name, option['relatedPackages'])
except Exception as e:
raise Exception(f"Failed to render option {name}: {str(e)}")