gnu: Use 'search-input-file' some more.
[jackhill/guix/guix.git] / gnu / packages / markup.scm
CommitLineData
7782d3a6 1;;; GNU Guix --- Functional package management for GNU
bae87762 2;;; Copyright © 2015 Mathieu Lirzin <mthl@openmailbox.org>
7782d3a6 3;;; Copyright © 2015 David Thompson <davet@gnu.org>
d71af69d 4;;; Copyright © 2016, 2019 Efraim Flashner <efraim@flashner.co.il>
3c986a7d 5;;; Copyright © 2017 Nikita <nikita@n0.is>
ec81488b 6;;; Copyright © 2017–2021 Tobias Geerinckx-Rice <me@tobias.gr>
49279343 7;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
966bdd11 8;;; Copyright © 2020 EuAndreh <eu@euandre.org>
80599a73 9;;; Copyright © 2021 Noisytoot <noisytoot@disroot.org>
7782d3a6
DT
10;;;
11;;; This file is part of GNU Guix.
12;;;
13;;; GNU Guix is free software; you can redistribute it and/or modify it
14;;; under the terms of the GNU General Public License as published by
15;;; the Free Software Foundation; either version 3 of the License, or (at
16;;; your option) any later version.
17;;;
18;;; GNU Guix is distributed in the hope that it will be useful, but
19;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21;;; GNU General Public License for more details.
22;;;
23;;; You should have received a copy of the GNU General Public License
24;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25
e5eede3f 26(define-module (gnu packages markup)
7782d3a6
DT
27 #:use-module (guix licenses)
28 #:use-module (guix download)
62b3a9b4 29 #:use-module (guix git-download)
7782d3a6
DT
30 #:use-module (guix packages)
31 #:use-module (guix build-system gnu)
bae87762 32 #:use-module (guix build-system trivial)
80588800 33 #:use-module (guix build-system cmake)
9d46919f 34 #:use-module (guix build-system perl)
80599a73 35 #:use-module (guix build-system python)
f41b56a9 36 #:use-module (guix utils)
148585c2 37 #:use-module (gnu packages compression)
9d46919f 38 #:use-module (gnu packages)
bae87762 39 #:use-module (gnu packages perl)
01f9a4c0 40 #:use-module (gnu packages pkg-config)
7782d3a6 41 #:use-module (gnu packages python)
148585c2 42 #:use-module (gnu packages web))
7782d3a6
DT
43
44(define-public hoedown
45 (package
46 (name "hoedown")
67eb3857 47 (version "3.0.7")
7782d3a6 48 (source (origin
d71af69d
EF
49 (method git-fetch)
50 (uri (git-reference
b0e7b699 51 (url "https://github.com/hoedown/hoedown")
d71af69d
EF
52 (commit version)))
53 (file-name (git-file-name name version))
7782d3a6
DT
54 (sha256
55 (base32
d71af69d 56 "1kr3hxjg2dgmwy9738qgj3sh3f5cygx0zxskkfhrg7x19bq9yd26"))))
7782d3a6
DT
57 (build-system gnu-build-system)
58 (arguments
606a106f
MW
59 '(#:make-flags (list "CC=gcc" (string-append "PREFIX=" %output))
60 #:phases (modify-phases %standard-phases
7782d3a6
DT
61 (delete 'configure)) ; no configure script
62 #:test-target "test"))
63 (native-inputs
64 `(("python" ,python-2)
65 ("tidy" ,tidy)))
66 (synopsis "Markdown processing library")
67 (description "Hoedown is a standards compliant, fast, secure markdown
68processing library written in C.")
69 (home-page "https://github.com/hoedown/hoedown")
70 (license expat)))
bae87762
ML
71
72(define-public markdown
73 (package
74 (name "markdown")
75 (version "1.0.1")
76 (source
77 (origin
78 (method url-fetch)
79 (uri (string-append
80 "http://daringfireball.net/projects/downloads/"
81 (string-capitalize name) "_" version ".zip"))
82 (sha256
83 (base32 "0dq1pj91pvlwkv0jwcgdfpv6gvnxzrk3s8mnh7imamcclnvfj835"))))
84 (build-system trivial-build-system)
85 (arguments
86 '(#:modules ((guix build utils))
87 #:builder
88 (begin
89 (use-modules (guix build utils))
90 (let ((source (assoc-ref %build-inputs "source"))
91 (out (assoc-ref %outputs "out"))
92 (perlbd (string-append (assoc-ref %build-inputs "perl") "/bin"))
2dffe476 93 (unzip (search-input-file %build-inputs "/bin/unzip")))
bae87762
ML
94 (mkdir-p out)
95 (with-directory-excursion out
e3cfef22 96 (invoke unzip source)
bae87762
ML
97 (mkdir "bin")
98 (mkdir-p "share/doc")
99 (rename-file "Markdown_1.0.1/Markdown.pl" "bin/markdown")
100 (rename-file "Markdown_1.0.1/Markdown Readme.text"
101 "share/doc/README")
102 (patch-shebang "bin/markdown" (list perlbd))
e3cfef22
MW
103 (delete-file-recursively "Markdown_1.0.1"))
104 #t))))
bae87762
ML
105 (native-inputs `(("unzip" ,unzip)))
106 (inputs `(("perl" ,perl)))
107 (home-page "http://daringfireball.net/projects/markdown")
108 (synopsis "Text-to-HTML conversion tool")
109 (description
110 "Markdown is a text-to-HTML conversion tool for web writers. It allows
111you to write using an easy-to-read, easy-to-write plain text format, then
112convert it to structurally valid XHTML (or HTML).")
113 (license (non-copyleft "file://License.text"
114 "See License.text in the distribution."))))
80588800 115
31d3a7c7
CB
116(define-public discount
117 (package
118 (name "discount")
34316794 119 (version "2.2.7")
31d3a7c7
CB
120 (source (origin
121 (method url-fetch)
122 (uri (string-append
123 "http://www.pell.portland.or.us/~orc/Code/"
ad0b91bd 124 "discount/discount-" version ".tar.bz2"))
31d3a7c7
CB
125 (sha256
126 (base32
34316794 127 "024mxv0gpvilyfczarcgy5m7h4lv6qvhjfpf5i73qkxhszjjn9mi"))))
31d3a7c7
CB
128 (build-system gnu-build-system)
129 (arguments
130 `(#:test-target "test"
34316794 131 #:parallel-build? #f ; libmarkdown won't be built in time
31d3a7c7
CB
132 #:make-flags (list
133 (string-append "LFLAGS=-L. -Wl,-rpath="
134 (assoc-ref %outputs "out") "/lib"))
135 #:phases
136 (modify-phases %standard-phases
137 (add-before 'configure 'set-AC_PATH
138 (lambda _
139 ;; The default value is not suitable, so override using an
140 ;; environment variable. This just affects the build, and not the
141 ;; resulting store item.
142 (setenv "AC_PATH" (getenv "PATH"))
143 #t))
144 (replace 'configure
145 (lambda* (#:key inputs outputs #:allow-other-keys)
34316794
TGR
146 (let ((out (assoc-ref outputs "out")))
147 (setenv "CC" ,(cc-for-target))
148 ;; The ‘validate-runpath’ phase fails otherwise.
149 (setenv "LDFLAGS" (string-append "-Wl,-rpath=" out "/lib"))
150 (invoke "./configure.sh"
151 (string-append "--prefix=" out)
152 "--shared")))))))
01f9a4c0
TGR
153 (native-inputs
154 `(("pkg-config" ,pkg-config)))
31d3a7c7
CB
155 (synopsis "Markdown processing library, written in C")
156 (description
157 "Discount is a markdown implementation, written in C. It provides a
158@command{markdown} command, and a library.")
7fcb3935 159 (home-page "https://www.pell.portland.or.us/~orc/Code/discount/")
31d3a7c7
CB
160 (license bsd-3)))
161
9d46919f
CB
162(define-public perl-text-markdown-discount
163 (package
164 (name "perl-text-markdown-discount")
165 (version "0.11")
166 (source
167 (origin
168 (method url-fetch)
169 (uri (string-append
170 "mirror://cpan/authors/id/S/SE/SEKIMURA/Text-Markdown-Discount-"
171 version
172 ".tar.gz"))
173 (sha256
174 (base32
175 "1xx7v3wnla7m6wa3h33whxw3vvincaicg4yra1b9wbzf2aix9rnw"))
176 (patches
1da3d2a3 177 (search-patches "perl-text-markdown-discount-unbundle.patch"))))
9d46919f
CB
178 (build-system perl-build-system)
179 (arguments
180 `(#:phases
181 (modify-phases %standard-phases
182 (add-before 'build 'set-ldflags
183 (lambda* (#:key inputs #:allow-other-keys)
184 (substitute* "Makefile"
185 (("OTHERLDFLAGS = ")
186 (string-append
187 "OTHERLDFLAGS = -lmarkdown -Wl,-rpath="
188 (assoc-ref inputs "discount")
4851af9e
MW
189 "/lib")))
190 #t)))))
9d46919f
CB
191 (inputs
192 `(("discount" ,discount)))
193 (home-page
9aba9b12 194 "https://metacpan.org/release/Text-Markdown-Discount")
9d46919f
CB
195 (synopsis
196 "Fast function for converting Markdown to HTML using Discount")
197 (description
198 "Text::Markdown::Discount is a Perl extension to the Discount markdown
199implementation.
200
201@example
202 use Text::Markdown::Discount;
203 my $html = markdown($text)
204@end example")
205 (license perl-license)))
206
80588800
EE
207(define-public cmark
208 (package
209 (name "cmark")
88409717 210 (version "0.29.0")
80588800 211 (source (origin
2c24b96b
EF
212 (method git-fetch)
213 (uri (git-reference
b0e7b699 214 (url "https://github.com/jgm/cmark")
2c24b96b
EF
215 (commit version)))
216 (file-name (git-file-name name version))
80588800
EE
217 (sha256
218 (base32
49279343
MB
219 "0r7jpqhgnssq444i8pwji2g36058vfzwkl70wbiwj13h4w5rfc8f"))
220 (modules '((guix build utils)))
221 (snippet
222 '(begin
223 ;; Mimic upstream commit 68c3a91166347 to fix a test failure
224 ;; when using Python 3.8. Remove for versions > 0.29.
225 ;; See <https://github.com/commonmark/cmark/issues/313>.
226 (substitute* "test/normalize.py"
227 (("cgi") "html"))
228 #t))))
80588800
EE
229 (build-system cmake-build-system)
230 (arguments
231 '(#:test-target "test"))
232 (native-inputs `(("python" ,python)))
233 (synopsis "CommonMark Markdown reference implementation")
234 (description "CommonMark is a strongly defined, highly compatible
235specification of Markdown. cmark is the C reference implementation of
236CommonMark. It provides @code{libcmark} shared library for parsing
554245da 237CommonMark to an abstract syntax tree (@dfn{AST}) and rendering the document
80588800
EE
238as HTML, groff man, LaTeX, CommonMark, or an XML representation of the
239AST. The package also provides the command-line program @command{cmark}
240for parsing and rendering CommonMark.")
78763c1e 241 (home-page "https://commonmark.org")
80588800
EE
242 ;; cmark is distributed with a BSD-2 license, but some components are Expat
243 ;; licensed. The CommonMark specification is Creative Commons CC-BY-SA 4.0
244 ;; licensed. See 'COPYING' in the source distribution for more information.
245 (license (list bsd-2 expat cc-by-sa4.0))))
83f0d3a5 246
247(define-public smu
248 (package
249 (name "smu")
67e4abc5 250 (version "1.5")
83f0d3a5 251 (source
252 (origin
62b3a9b4
TGR
253 (method git-fetch)
254 (uri (git-reference
b0e7b699 255 (url "https://github.com/Gottox/smu")
62b3a9b4
TGR
256 (commit (string-append "v" version))))
257 (file-name (git-file-name name version))
83f0d3a5 258 (sha256
62b3a9b4 259 (base32 "1jm7lhnzjx4q7gcwlkvsbffcy0zppywyh50d71ami6dnq182vvcc"))))
83f0d3a5 260 (build-system gnu-build-system)
261 (arguments
262 `(#:make-flags (list "CC=gcc"
263 (string-append "PREFIX="
264 (assoc-ref %outputs "out")))
67e4abc5 265 #:tests? #f ; no tests included
83f0d3a5 266 #:phases
267 (modify-phases %standard-phases
268 (delete 'configure))))
269 (home-page "https://github.com/Gottox/smu")
270 (synopsis "Simple markup")
271 (description
272 "Smu is a very simple and minimal markup language. It is
273designed for using in wiki-like environments. Smu makes it very
274easy to write your documents on the fly and convert them into HTML.
275Smu is capable to parse very large documents. As long as you avoid an huge
276amount of indents it scales just great.
277
278Smu was started as a rewrite of Markdown but became something more
279lightweight and consistent. The biggest difference between Markdown
280and smu is that smu doesn't support reference style links.")
281 (license x11)))
966bdd11
E
282
283(define-public md4c
284 (package
285 (name "md4c")
ec81488b 286 (version "0.4.8")
966bdd11
E
287 (source
288 (origin
289 (method git-fetch)
290 (uri (git-reference
291 (url "https://github.com/mity/md4c/")
292 (commit (string-append "release-" version))))
293 (file-name (git-file-name name version))
294 (sha256
ec81488b 295 (base32 "12pdh4rfjc3b0cblj5nz3jksr2376lx8ay0vw5dwa1s97q09pczq"))))
966bdd11
E
296 (build-system cmake-build-system)
297 (arguments '(#:tests? #f))
298 (home-page "https://github.com/mity/md4c/")
299 (synopsis "C Markdown parser compliant to CommonMark")
300 (description "MD4C is a C Markdown parser with a
301SAX-like interface. It is compliant to the CommonMark specification,
302with a few extensions.")
303 (license expat)))
80599a73
RNG
304
305(define-public python-mistletoe
306 (package
307 (name "python-mistletoe")
308 (version "0.7.2")
309 (source
310 (origin
311 (method url-fetch)
312 (uri (pypi-uri "mistletoe" version))
313 (sha256
314 (base32 "18z6hqfnfjqnrcgfgl5pkj9ggf9yx0yyy94azcn1qf7hqn6g3l14"))))
315 (build-system python-build-system)
316 (home-page "https://github.com/miyuchina/mistletoe")
317 (synopsis "Extensible Markdown parser in pure Python")
318 (description
319 "The @code{mistletoe} Markdown parser is a CommonMark-compliant Markdown
320parser that supports definitions of custom tokens.
321
322Parsing Markdown into an abstract syntax tree also allows @code{mistletoe} to
323swap out renderers for different output formats, without touching any of the
324core components.")
325 (license expat)))