about summary refs log tree commit diff
path: root/users/tazjin/renderMarkdown.nix
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2020-08-10T21·48+0100
committertazjin <mail@tazj.in>2020-08-10T23·24+0000
commit452b8c7e2338670826aab4f822b7d8ed1099cc81 (patch)
tree90ee74b8e0883425e2c96323676c284ca53d6f18 /users/tazjin/renderMarkdown.nix
parent916dba43e7d1dcfdde8e07117d138737f71ec036 (diff)
refactor(tazjin/blog): Extract post rendering to utility function r/1635
To use cheddar for both the feed & web views, the rendering function
is extracted a level up - this prevents duplicate renderer calls.

Change-Id: I31812c5c3f905f2f84914c6a8ab7c14602227be1
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1710
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
Diffstat (limited to 'users/tazjin/renderMarkdown.nix')
-rw-r--r--users/tazjin/renderMarkdown.nix9
1 files changed, 9 insertions, 0 deletions
diff --git a/users/tazjin/renderMarkdown.nix b/users/tazjin/renderMarkdown.nix
new file mode 100644
index 000000000000..58f29c30e0f3
--- /dev/null
+++ b/users/tazjin/renderMarkdown.nix
@@ -0,0 +1,9 @@
+# Render a Markdown file to HTML.
+{ depot, ... }:
+
+with depot.nix.yants;
+
+defun [ path drv ] (file: depot.third_party.runCommandNoCC "${file}.rendered.html" {} ''
+  cat ${file} | ${depot.tools.cheddar}/bin/cheddar --about-filter ${file} > $out
+'')
+