Add markdown (commonmark) support
gitile/pages.scm
| 16 | 16 | ;;;; | |
| 17 | 17 | ||
| 18 | 18 | (define-module (gitile pages) | |
| 19 | + | #:use-module (commonmark) | |
| 19 | 20 | #:use-module (gcrypt base16) | |
| 20 | 21 | #:use-module (gcrypt hash) | |
| 21 | 22 | #:use-module (gitile repo) | |
… | |||
| 59 | 60 | (a (@ (href "/" ,repository-name "/raw/" ,(or ref "-") | |
| 60 | 61 | "/" ,path)) | |
| 61 | 62 | (img (@ (src "/images/file-type-3.svg")))))) | |
| 62 | - | (pre ,(utf8->string (get-file-content repo path #:ref ref))))) | |
| 63 | + | ,(let ((content (utf8->string (get-file-content repo path #:ref ref)))) | |
| 64 | + | (if (string-suffix? ".md" path) | |
| 65 | + | `(article (@ (class "file-content")) | |
| 66 | + | ,(commonmark->sxml content)) | |
| 67 | + | `(pre ,content))))) | |
| 63 | 68 | ||
| 64 | 69 | (define* (project-files repository-name repo #:key (ref "-") (path '())) | |
| 65 | 70 | (let* ((ref (if (equal? ref "-") #f ref)) | |
guix.scm
| 51 | 51 | (source #f) | |
| 52 | 52 | (build-system gnu-build-system) | |
| 53 | 53 | (propagated-inputs | |
| 54 | - | `(("guile-git" ,my-guile-git) | |
| 54 | + | `(("guile-commonmark" ,guile-commonmark) | |
| 55 | + | ("guile-git" ,my-guile-git) | |
| 55 | 56 | ("guile-gcrypt" ,guile-gcrypt) | |
| 56 | 57 | ("gnutls" ,gnutls) | |
| 57 | 58 | ("guile-fibers" ,guile-fibers))) |