From 625146d821a0acee7318d558e05ca7a4d09ee22b Mon Sep 17 00:00:00 2001
From: Daniel Barlow <dan@telent.net>
Date: Wed, 16 Aug 2023 19:43:12 +0100
Subject: [PATCH] escape backslash in service type

---
 doc/parse-options.fnl | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/doc/parse-options.fnl b/doc/parse-options.fnl
index 56d305a..8f2eb21 100644
--- a/doc/parse-options.fnl
+++ b/doc/parse-options.fnl
@@ -44,13 +44,16 @@
     (where s (= (type s) "string")) description
     _ nil))
 
+(fn escape-backslash [s]
+  (string.gsub s "\\" "\\\\"))
+
 (fn print-option [o offset]
   (let [i (or offset 0)]
     (print (indent i (.. " * option ``" o.name "``")))
     (case (-?> o.description extract-text strip-newlines)
           descr (print (indent (+ 4 i) descr)))
     (print)
-    (print (indent (+ 4 i) (.. "**type** " o.type "\n")))
+    (print (indent (+ 4 i) (.. "**type** " (escape-backslash o.type) "\n")))
     (when o.example
       (print (indent (+ 4 i) "**example**")) (print)
       (print (indent (+ 4 i) ".. code-block:: nix"))