about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-01-30 22:09:53 +0100
committerbptato <nincsnevem662@gmail.com>2024-01-30 22:13:42 +0100
commit053e0be996d48e3aa550a3d8d46c92700e6ff469 (patch)
tree92faf4e9fa71d7a4b6dd1a6d5df9a892efcbedee /src
parentd2feac8a4798fb09441376f107e9b97bc4141e52 (diff)
downloadchawan-053e0be996d48e3aa550a3d8d46c92700e6ff469.tar.gz
Add default md2html converter
Diffstat (limited to 'src')
-rw-r--r--src/config/config.nim35
1 files changed, 21 insertions, 14 deletions
diff --git a/src/config/config.nim b/src/config/config.nim
index 59cdad50..96b78bb7 100644
--- a/src/config/config.nim
+++ b/src/config/config.nim
@@ -356,20 +356,9 @@ proc getMailcap*(config: Config): tuple[mailcap: Mailcap, errs: seq[string]] =
   let gopherPath = gopherPath0.unquote().get
   const geminiPath0 = ChaPath("${%CHA_LIBEXEC_DIR}/gmi2html")
   let geminiPath = geminiPath0.unquote().get
-  var mailcap = @[
-    MailcapEntry(
-      mt: "text",
-      subt: "gopher",
-      cmd: gopherPath,
-      flags: {HTMLOUTPUT}
-    ),
-    MailcapEntry(
-      mt: "text",
-      subt: "gemini",
-      cmd: geminiPath,
-      flags: {HTMLOUTPUT}
-    )
-  ]
+  const mdPath0 = ChaPath("${%CHA_LIBEXEC_DIR}/md2html")
+  let mdPath = mdPath0.unquote().get
+  var mailcap: Mailcap = @[]
   var errs: seq[string]
   var found = false
   for p in config.external.mailcap:
@@ -381,6 +370,24 @@ proc getMailcap*(config: Config): tuple[mailcap: Mailcap, errs: seq[string]] =
       else:
         errs.add(res.error)
       found = true
+  mailcap.add(MailcapEntry(
+      mt: "text",
+      subt: "gopher",
+      cmd: gopherPath,
+      flags: {HTMLOUTPUT}
+  ))
+  mailcap.add(MailcapEntry(
+    mt: "text",
+    subt: "gemini",
+    cmd: geminiPath,
+    flags: {HTMLOUTPUT}
+  ))
+  mailcap.add(MailcapEntry(
+    mt: "text",
+    subt: "markdown",
+    cmd: mdPath,
+    flags: {HTMLOUTPUT}
+  ))
   if not found:
     mailcap.insert(MailcapEntry(
       mt: "*",