1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015 Mathieu Lirzin <mthl@openmailbox.org>
3 ;;; Copyright © 2015 David Thompson <davet@gnu.org>
4 ;;; Copyright © 2016, 2019 Efraim Flashner <efraim@flashner.co.il>
5 ;;; Copyright © 2017 Nikita <nikita@n0.is>
6 ;;; Copyright © 2017, 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
9 ;;; This file is part of GNU Guix.
11 ;;; GNU Guix is free software; you can redistribute it and/or modify it
12 ;;; under the terms of the GNU General Public License as published by
13 ;;; the Free Software Foundation; either version 3 of the License, or (at
14 ;;; your option) any later version.
16 ;;; GNU Guix is distributed in the hope that it will be useful, but
17 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;;; GNU General Public License for more details.
21 ;;; You should have received a copy of the GNU General Public License
22 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24 (define-module (gnu packages markup)
25 #:use-module (guix licenses)
26 #:use-module (guix download)
27 #:use-module (guix git-download)
28 #:use-module (guix packages)
29 #:use-module (guix build-system gnu)
30 #:use-module (guix build-system trivial)
31 #:use-module (guix build-system cmake)
32 #:use-module (guix build-system perl)
33 #:use-module (gnu packages compression)
34 #:use-module (gnu packages)
35 #:use-module (gnu packages perl)
36 #:use-module (gnu packages python)
37 #:use-module (gnu packages web))
39 (define-public hoedown
46 (url "https://github.com/hoedown/hoedown")
48 (file-name (git-file-name name version))
51 "1kr3hxjg2dgmwy9738qgj3sh3f5cygx0zxskkfhrg7x19bq9yd26"))))
52 (build-system gnu-build-system)
54 '(#:make-flags (list "CC=gcc" (string-append "PREFIX=" %output))
55 #:phases (modify-phases %standard-phases
56 (delete 'configure)) ; no configure script
57 #:test-target "test"))
59 `(("python" ,python-2)
61 (synopsis "Markdown processing library")
62 (description "Hoedown is a standards compliant, fast, secure markdown
63 processing library written in C.")
64 (home-page "https://github.com/hoedown/hoedown")
67 (define-public markdown
75 "http://daringfireball.net/projects/downloads/"
76 (string-capitalize name) "_" version ".zip"))
78 (base32 "0dq1pj91pvlwkv0jwcgdfpv6gvnxzrk3s8mnh7imamcclnvfj835"))))
79 (build-system trivial-build-system)
81 '(#:modules ((guix build utils))
84 (use-modules (guix build utils))
85 (let ((source (assoc-ref %build-inputs "source"))
86 (out (assoc-ref %outputs "out"))
87 (perlbd (string-append (assoc-ref %build-inputs "perl") "/bin"))
88 (unzip (string-append (assoc-ref %build-inputs "unzip")
91 (with-directory-excursion out
95 (rename-file "Markdown_1.0.1/Markdown.pl" "bin/markdown")
96 (rename-file "Markdown_1.0.1/Markdown Readme.text"
98 (patch-shebang "bin/markdown" (list perlbd))
99 (delete-file-recursively "Markdown_1.0.1"))
101 (native-inputs `(("unzip" ,unzip)))
102 (inputs `(("perl" ,perl)))
103 (home-page "http://daringfireball.net/projects/markdown")
104 (synopsis "Text-to-HTML conversion tool")
106 "Markdown is a text-to-HTML conversion tool for web writers. It allows
107 you to write using an easy-to-read, easy-to-write plain text format, then
108 convert it to structurally valid XHTML (or HTML).")
109 (license (non-copyleft "file://License.text"
110 "See License.text in the distribution."))))
112 (define-public discount
119 "http://www.pell.portland.or.us/~orc/Code/"
120 "discount/discount-" version ".tar.bz2"))
123 "199hwajpspqil0a4y3yxsmhdp2dm73gqkzfk4mrwzsmlq8y1xzbl"))))
124 (build-system gnu-build-system)
126 `(#:test-target "test"
128 (string-append "LFLAGS=-L. -Wl,-rpath="
129 (assoc-ref %outputs "out") "/lib"))
131 (modify-phases %standard-phases
132 (add-before 'configure 'set-AC_PATH
134 ;; The default value is not suitable, so override using an
135 ;; environment variable. This just affects the build, and not the
136 ;; resulting store item.
137 (setenv "AC_PATH" (getenv "PATH"))
140 (lambda* (#:key inputs outputs #:allow-other-keys)
142 (invoke "./configure.sh"
143 (string-append "--prefix=" (assoc-ref outputs "out"))
145 (synopsis "Markdown processing library, written in C")
147 "Discount is a markdown implementation, written in C. It provides a
148 @command{markdown} command, and a library.")
149 (home-page "https://www.pell.portland.or.us/~orc/Code/discount/")
152 (define-public perl-text-markdown-discount
154 (name "perl-text-markdown-discount")
160 "mirror://cpan/authors/id/S/SE/SEKIMURA/Text-Markdown-Discount-"
165 "1xx7v3wnla7m6wa3h33whxw3vvincaicg4yra1b9wbzf2aix9rnw"))
167 (search-patches "perl-text-markdown-discount-unbundle.patch"))))
168 (build-system perl-build-system)
171 (modify-phases %standard-phases
172 (add-before 'build 'set-ldflags
173 (lambda* (#:key inputs #:allow-other-keys)
174 (substitute* "Makefile"
177 "OTHERLDFLAGS = -lmarkdown -Wl,-rpath="
178 (assoc-ref inputs "discount")
182 `(("discount" ,discount)))
184 "https://metacpan.org/release/Text-Markdown-Discount")
186 "Fast function for converting Markdown to HTML using Discount")
188 "Text::Markdown::Discount is a Perl extension to the Discount markdown
192 use Text::Markdown::Discount;
193 my $html = markdown($text)
195 (license perl-license)))
204 (url "https://github.com/jgm/cmark")
206 (file-name (git-file-name name version))
209 "0r7jpqhgnssq444i8pwji2g36058vfzwkl70wbiwj13h4w5rfc8f"))
210 (modules '((guix build utils)))
213 ;; Mimic upstream commit 68c3a91166347 to fix a test failure
214 ;; when using Python 3.8. Remove for versions > 0.29.
215 ;; See <https://github.com/commonmark/cmark/issues/313>.
216 (substitute* "test/normalize.py"
219 (build-system cmake-build-system)
221 '(#:test-target "test"))
222 (native-inputs `(("python" ,python)))
223 (synopsis "CommonMark Markdown reference implementation")
224 (description "CommonMark is a strongly defined, highly compatible
225 specification of Markdown. cmark is the C reference implementation of
226 CommonMark. It provides @code{libcmark} shared library for parsing
227 CommonMark to an abstract syntax tree (@dfn{AST}) and rendering the document
228 as HTML, groff man, LaTeX, CommonMark, or an XML representation of the
229 AST. The package also provides the command-line program @command{cmark}
230 for parsing and rendering CommonMark.")
231 (home-page "https://commonmark.org")
232 ;; cmark is distributed with a BSD-2 license, but some components are Expat
233 ;; licensed. The CommonMark specification is Creative Commons CC-BY-SA 4.0
234 ;; licensed. See 'COPYING' in the source distribution for more information.
235 (license (list bsd-2 expat cc-by-sa4.0))))
245 (url "https://github.com/Gottox/smu")
246 (commit (string-append "v" version))))
247 (file-name (git-file-name name version))
249 (base32 "1jm7lhnzjx4q7gcwlkvsbffcy0zppywyh50d71ami6dnq182vvcc"))))
250 (build-system gnu-build-system)
252 `(#:make-flags (list "CC=gcc"
253 (string-append "PREFIX="
254 (assoc-ref %outputs "out")))
255 #:tests? #f ; no tests included
257 (modify-phases %standard-phases
258 (delete 'configure))))
259 (home-page "https://github.com/Gottox/smu")
260 (synopsis "Simple markup")
262 "Smu is a very simple and minimal markup language. It is
263 designed for using in wiki-like environments. Smu makes it very
264 easy to write your documents on the fly and convert them into HTML.
265 Smu is capable to parse very large documents. As long as you avoid an huge
266 amount of indents it scales just great.
268 Smu was started as a rewrite of Markdown but became something more
269 lightweight and consistent. The biggest difference between Markdown
270 and smu is that smu doesn't support reference style links.")