about summary refs log tree commit diff
path: root/web/panettone/src/packages.lisp
diff options
context:
space:
mode:
authorsterni <sternenseemann@systemli.org>2021-01-14T01·07+0100
committersterni <sternenseemann@systemli.org>2021-01-25T21·02+0000
commit82e07fc046cff2151f9d18a003c6331202d58c8b (patch)
treec528dde5bed5899aa53fbc7bba761bf8abb23969 /web/panettone/src/packages.lisp
parent7e408c874ac9b84f62bd48a3a6f2b57bae866d29 (diff)
feat(panettone): render a subset of markdown in issue subjects r/2144
This is achieved by implementing a simple markdown renderer in CL which
has the following limitations:

* Only supports inline `code`, *emphasize 1*, _emphasize 2_ and
  ~~strikethrough~~.
* Does not support nested markup.

This allows for a relatively simple renderer which doesn't need to parse
markdown into a in-memory data structure first. The rendered result is
directly written to a stream to integrate well with cl-who which is also
reused for rendering tags and xml-escaping strings.

Fixes #90.

Change-Id: Ice88ed770b1fab6365f3b93e8663e25077befa0b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2389
Tested-by: BuildkiteCI
Reviewed-by: glittershark <grfn@gws.fyi>
Reviewed-by: tazjin <mail@tazj.in>
Diffstat (limited to 'web/panettone/src/packages.lisp')
-rw-r--r--web/panettone/src/packages.lisp8
1 files changed, 7 insertions, 1 deletions
diff --git a/web/panettone/src/packages.lisp b/web/panettone/src/packages.lisp
index 87285fa34d16..c5fe79b7bc81 100644
--- a/web/panettone/src/packages.lisp
+++ b/web/panettone/src/packages.lisp
@@ -7,6 +7,11 @@
   (:use :cl :lass)
   (:export :styles))
 
+(defpackage panettone.inline-markdown
+  (:use :cl)
+  (:import-from :alexandria :define-constant)
+  (:export :render-inline-markdown))
+
 (defpackage panettone.irc
   (:use :cl :usocket)
   (:export :send-irc-notification))
@@ -42,7 +47,8 @@
 (defpackage panettone
   (:use :cl :klatre :easy-routes :iterate
         :panettone.util
-        :panettone.authentication)
+        :panettone.authentication
+        :panettone.inline-markdown)
   (:import-from :defclass-std :defclass/std)
   (:import-from :alexandria :if-let :when-let :switch :alist-hash-table)
   (:import-from :cl-ppcre :split)