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, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
8 ;;; Copyright © 2020 EuAndreh <eu@euandre.org>
10 ;;; This file is part of GNU Guix.
12 ;;; GNU Guix is free software; you can redistribute it and/or modify it
13 ;;; under the terms of the GNU General Public License as published by
14 ;;; the Free Software Foundation; either version 3 of the License, or (at
15 ;;; your option) any later version.
17 ;;; GNU Guix is distributed in the hope that it will be useful, but
18 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;;; GNU General Public License for more details.
22 ;;; You should have received a copy of the GNU General Public License
23 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25 (define-module (gnu packages markup)
26 #:use-module (guix licenses)
27 #:use-module (guix download)
28 #:use-module (guix git-download)
29 #:use-module (guix packages)
30 #:use-module (guix build-system gnu)
31 #:use-module (guix build-system trivial)
32 #:use-module (guix build-system cmake)
33 #:use-module (guix build-system perl)
34 #:use-module (guix utils)
35 #:use-module (gnu packages compression)
36 #:use-module (gnu packages)
37 #:use-module (gnu packages perl)
38 #:use-module (gnu packages pkg-config)
39 #:use-module (gnu packages python)
40 #:use-module (gnu packages web))
42 (define-public hoedown
49 (url "https://github.com/hoedown/hoedown")
51 (file-name (git-file-name name version))
54 "1kr3hxjg2dgmwy9738qgj3sh3f5cygx0zxskkfhrg7x19bq9yd26"))))
55 (build-system gnu-build-system)
57 '(#:make-flags (list "CC=gcc" (string-append "PREFIX=" %output))
58 #:phases (modify-phases %standard-phases
59 (delete 'configure)) ; no configure script
60 #:test-target "test"))
62 `(("python" ,python-2)
64 (synopsis "Markdown processing library")
65 (description "Hoedown is a standards compliant, fast, secure markdown
66 processing library written in C.")
67 (home-page "https://github.com/hoedown/hoedown")
70 (define-public markdown
78 "http://daringfireball.net/projects/downloads/"
79 (string-capitalize name) "_" version ".zip"))
81 (base32 "0dq1pj91pvlwkv0jwcgdfpv6gvnxzrk3s8mnh7imamcclnvfj835"))))
82 (build-system trivial-build-system)
84 '(#:modules ((guix build utils))
87 (use-modules (guix build utils))
88 (let ((source (assoc-ref %build-inputs "source"))
89 (out (assoc-ref %outputs "out"))
90 (perlbd (string-append (assoc-ref %build-inputs "perl") "/bin"))
91 (unzip (string-append (assoc-ref %build-inputs "unzip")
94 (with-directory-excursion out
98 (rename-file "Markdown_1.0.1/Markdown.pl" "bin/markdown")
99 (rename-file "Markdown_1.0.1/Markdown Readme.text"
101 (patch-shebang "bin/markdown" (list perlbd))
102 (delete-file-recursively "Markdown_1.0.1"))
104 (native-inputs `(("unzip" ,unzip)))
105 (inputs `(("perl" ,perl)))
106 (home-page "http://daringfireball.net/projects/markdown")
107 (synopsis "Text-to-HTML conversion tool")
109 "Markdown is a text-to-HTML conversion tool for web writers. It allows
110 you to write using an easy-to-read, easy-to-write plain text format, then
111 convert it to structurally valid XHTML (or HTML).")
112 (license (non-copyleft "file://License.text"
113 "See License.text in the distribution."))))
115 (define-public discount
122 "http://www.pell.portland.or.us/~orc/Code/"
123 "discount/discount-" version ".tar.bz2"))
126 "024mxv0gpvilyfczarcgy5m7h4lv6qvhjfpf5i73qkxhszjjn9mi"))))
127 (build-system gnu-build-system)
129 `(#:test-target "test"
130 #:parallel-build? #f ; libmarkdown won't be built in time
132 (string-append "LFLAGS=-L. -Wl,-rpath="
133 (assoc-ref %outputs "out") "/lib"))
135 (modify-phases %standard-phases
136 (add-before 'configure 'set-AC_PATH
138 ;; The default value is not suitable, so override using an
139 ;; environment variable. This just affects the build, and not the
140 ;; resulting store item.
141 (setenv "AC_PATH" (getenv "PATH"))
144 (lambda* (#:key inputs outputs #:allow-other-keys)
145 (let ((out (assoc-ref outputs "out")))
146 (setenv "CC" ,(cc-for-target))
147 ;; The ‘validate-runpath’ phase fails otherwise.
148 (setenv "LDFLAGS" (string-append "-Wl,-rpath=" out "/lib"))
149 (invoke "./configure.sh"
150 (string-append "--prefix=" out)
153 `(("pkg-config" ,pkg-config)))
154 (synopsis "Markdown processing library, written in C")
156 "Discount is a markdown implementation, written in C. It provides a
157 @command{markdown} command, and a library.")
158 (home-page "https://www.pell.portland.or.us/~orc/Code/discount/")
161 (define-public perl-text-markdown-discount
163 (name "perl-text-markdown-discount")
169 "mirror://cpan/authors/id/S/SE/SEKIMURA/Text-Markdown-Discount-"
174 "1xx7v3wnla7m6wa3h33whxw3vvincaicg4yra1b9wbzf2aix9rnw"))
176 (search-patches "perl-text-markdown-discount-unbundle.patch"))))
177 (build-system perl-build-system)
180 (modify-phases %standard-phases
181 (add-before 'build 'set-ldflags
182 (lambda* (#:key inputs #:allow-other-keys)
183 (substitute* "Makefile"
186 "OTHERLDFLAGS = -lmarkdown -Wl,-rpath="
187 (assoc-ref inputs "discount")
191 `(("discount" ,discount)))
193 "https://metacpan.org/release/Text-Markdown-Discount")
195 "Fast function for converting Markdown to HTML using Discount")
197 "Text::Markdown::Discount is a Perl extension to the Discount markdown
201 use Text::Markdown::Discount;
202 my $html = markdown($text)
204 (license perl-license)))
213 (url "https://github.com/jgm/cmark")
215 (file-name (git-file-name name version))
218 "0r7jpqhgnssq444i8pwji2g36058vfzwkl70wbiwj13h4w5rfc8f"))
219 (modules '((guix build utils)))
222 ;; Mimic upstream commit 68c3a91166347 to fix a test failure
223 ;; when using Python 3.8. Remove for versions > 0.29.
224 ;; See <https://github.com/commonmark/cmark/issues/313>.
225 (substitute* "test/normalize.py"
228 (build-system cmake-build-system)
230 '(#:test-target "test"))
231 (native-inputs `(("python" ,python)))
232 (synopsis "CommonMark Markdown reference implementation")
233 (description "CommonMark is a strongly defined, highly compatible
234 specification of Markdown. cmark is the C reference implementation of
235 CommonMark. It provides @code{libcmark} shared library for parsing
236 CommonMark to an abstract syntax tree (@dfn{AST}) and rendering the document
237 as HTML, groff man, LaTeX, CommonMark, or an XML representation of the
238 AST. The package also provides the command-line program @command{cmark}
239 for parsing and rendering CommonMark.")
240 (home-page "https://commonmark.org")
241 ;; cmark is distributed with a BSD-2 license, but some components are Expat
242 ;; licensed. The CommonMark specification is Creative Commons CC-BY-SA 4.0
243 ;; licensed. See 'COPYING' in the source distribution for more information.
244 (license (list bsd-2 expat cc-by-sa4.0))))
254 (url "https://github.com/Gottox/smu")
255 (commit (string-append "v" version))))
256 (file-name (git-file-name name version))
258 (base32 "1jm7lhnzjx4q7gcwlkvsbffcy0zppywyh50d71ami6dnq182vvcc"))))
259 (build-system gnu-build-system)
261 `(#:make-flags (list "CC=gcc"
262 (string-append "PREFIX="
263 (assoc-ref %outputs "out")))
264 #:tests? #f ; no tests included
266 (modify-phases %standard-phases
267 (delete 'configure))))
268 (home-page "https://github.com/Gottox/smu")
269 (synopsis "Simple markup")
271 "Smu is a very simple and minimal markup language. It is
272 designed for using in wiki-like environments. Smu makes it very
273 easy to write your documents on the fly and convert them into HTML.
274 Smu is capable to parse very large documents. As long as you avoid an huge
275 amount of indents it scales just great.
277 Smu was started as a rewrite of Markdown but became something more
278 lightweight and consistent. The biggest difference between Markdown
279 and smu is that smu doesn't support reference style links.")
290 (url "https://github.com/mity/md4c/")
291 (commit (string-append "release-" version))))
292 (file-name (git-file-name name version))
294 (base32 "0m3202zzjvw4k7jw66z1qi3cbisxzvplq5alkygpifvhzm81gwwx"))))
295 (build-system cmake-build-system)
296 (arguments '(#:tests? #f))
297 (home-page "https://github.com/mity/md4c/")
298 (synopsis "C Markdown parser compliant to CommonMark")
299 (description "MD4C is a C Markdown parser with a
300 SAX-like interface. It is compliant to the CommonMark specification,
301 with a few extensions.")