about summary refs log tree commit diff
path: root/nix/renderMarkdown/default.nix
blob: 8759ada0fe3bc815a89f2ec0bfe8e167edf6bca0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Render a Markdown file to HTML.
{ depot, pkgs, ... }:

with depot.nix.yants;

let
  args = struct "args" {
    path = path;
    tagfilter = option bool;
  };
in
defun [ (either path args) drv ]
  (arg: pkgs.runCommand "${arg.path or arg}.rendered.html" { }
    (
      let
        tagfilter = if (arg.tagfilter or true) then "" else "--no-tagfilter";
      in
      ''
        cat ${arg.path or arg} | ${depot.tools.cheddar}/bin/cheddar --about-filter ${tagfilter} ${arg.path or arg} > $out
      ''
    ))