gnu: gf2x: Update to 1.3.0.
[jackhill/guix/guix.git] / gnu / packages / markup.scm
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–2021 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;; Copyright © 2020, 2022 Marius Bakke <marius@gnu.org>
8 ;;; Copyright © 2020 EuAndreh <eu@euandre.org>
9 ;;; Copyright © 2021 Noisytoot <noisytoot@disroot.org>
10 ;;; Copyright © 2021 Zhu Zihao <all_but_last@163.com>
11 ;;; Copyright © 2021 Petr Hodina <phodina@protonmail.com>
12 ;;; Copyright © 2022 jgart <jgart@dismail.de>
13 ;;; Copyright © 2022 Vinicius Monego <monego@posteo.net>
14 ;;;
15 ;;; This file is part of GNU Guix.
16 ;;;
17 ;;; GNU Guix is free software; you can redistribute it and/or modify it
18 ;;; under the terms of the GNU General Public License as published by
19 ;;; the Free Software Foundation; either version 3 of the License, or (at
20 ;;; your option) any later version.
21 ;;;
22 ;;; GNU Guix is distributed in the hope that it will be useful, but
23 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
24 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 ;;; GNU General Public License for more details.
26 ;;;
27 ;;; You should have received a copy of the GNU General Public License
28 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
29
30 (define-module (gnu packages markup)
31 #:use-module ((guix licenses) #:prefix license:)
32 #:use-module (guix download)
33 #:use-module (guix git-download)
34 #:use-module (guix gexp)
35 #:use-module (guix packages)
36 #:use-module (guix build-system gnu)
37 #:use-module (guix build-system trivial)
38 #:use-module (guix build-system cmake)
39 #:use-module (guix build-system perl)
40 #:use-module (guix build-system python)
41 #:use-module (guix utils)
42 #:use-module (guix gexp)
43 #:use-module (gnu packages)
44 #:use-module (gnu packages base)
45 #:use-module (gnu packages check)
46 #:use-module (gnu packages compression)
47 #:use-module (gnu packages libffi)
48 #:use-module (gnu packages perl)
49 #:use-module (gnu packages pkg-config)
50 #:use-module (gnu packages python)
51 #:use-module (gnu packages python-xyz)
52 #:use-module (gnu packages web))
53
54 (define-public hoedown
55 (package
56 (name "hoedown")
57 (version "3.0.7")
58 (source (origin
59 (method git-fetch)
60 (uri (git-reference
61 (url "https://github.com/hoedown/hoedown")
62 (commit version)))
63 (file-name (git-file-name name version))
64 (sha256
65 (base32
66 "1kr3hxjg2dgmwy9738qgj3sh3f5cygx0zxskkfhrg7x19bq9yd26"))))
67 (build-system gnu-build-system)
68 (arguments
69 '(#:make-flags (list "CC=gcc" (string-append "PREFIX=" %output))
70 #:phases (modify-phases %standard-phases
71 (delete 'configure)) ; no configure script
72 #:test-target "test"))
73 (native-inputs
74 `(("python" ,python-2)
75 ("tidy" ,tidy)))
76 (synopsis "Markdown processing library")
77 (description "Hoedown is a standards compliant, fast, secure markdown
78 processing library written in C.")
79 (home-page "https://github.com/hoedown/hoedown")
80 (license license:expat)))
81
82 (define-public markdown
83 (package
84 (name "markdown")
85 (version "1.0.1")
86 (source
87 (origin
88 (method url-fetch)
89 (uri (string-append
90 "http://daringfireball.net/projects/downloads/"
91 (string-capitalize name) "_" version ".zip"))
92 (sha256
93 (base32 "0dq1pj91pvlwkv0jwcgdfpv6gvnxzrk3s8mnh7imamcclnvfj835"))))
94 (build-system trivial-build-system)
95 (arguments
96 '(#:modules ((guix build utils))
97 #:builder
98 (begin
99 (use-modules (guix build utils))
100 (let ((source (assoc-ref %build-inputs "source"))
101 (out (assoc-ref %outputs "out"))
102 (perlbd (string-append (assoc-ref %build-inputs "perl") "/bin"))
103 (unzip (search-input-file %build-inputs "/bin/unzip")))
104 (mkdir-p out)
105 (with-directory-excursion out
106 (invoke unzip source)
107 (mkdir "bin")
108 (mkdir-p "share/doc")
109 (rename-file "Markdown_1.0.1/Markdown.pl" "bin/markdown")
110 (rename-file "Markdown_1.0.1/Markdown Readme.text"
111 "share/doc/README")
112 (patch-shebang "bin/markdown" (list perlbd))
113 (delete-file-recursively "Markdown_1.0.1"))
114 #t))))
115 (native-inputs (list unzip))
116 (inputs (list perl))
117 (home-page "http://daringfireball.net/projects/markdown")
118 (synopsis "Text-to-HTML conversion tool")
119 (description
120 "Markdown is a text-to-HTML conversion tool for web writers. It allows
121 you to write using an easy-to-read, easy-to-write plain text format, then
122 convert it to structurally valid XHTML (or HTML).")
123 (license (license:non-copyleft "file://License.text"
124 "See License.text in the distribution."))))
125
126 (define-public lowdown
127 (let ((commit "1de10c1d71bfb4348ae0beaec8b1547d5e114969")
128 (revision "1"))
129 (package
130 (name "lowdown")
131 (version (git-version "0.10.0" revision commit))
132 (source
133 (origin
134 (method git-fetch)
135 (uri (git-reference
136 (url "https://github.com/kristapsdz/lowdown")
137 (commit commit)))
138 (file-name (git-file-name name version))
139 (sha256
140 (base32 "1wh07nkiihvp1m79sj4qlnqklnn0rfp3hwls8sqcp0bfd96wpa1h"))))
141 (build-system gnu-build-system)
142 (arguments
143 (list
144 #:test-target "regress"
145 #:phases
146 #~(modify-phases %standard-phases
147 (replace 'configure
148 (lambda _
149 (invoke "./configure"
150 (string-append "PREFIX=" #$output)
151 (string-append "MANDIR=" #$output "/share/man")))))
152 #:make-flags #~(list "CFLAGS=-fPIC")))
153 (native-inputs
154 (list which))
155 (home-page "https://kristaps.bsd.lv/lowdown/")
156 (synopsis "Simple Markdown translator")
157 (description "Lowdown is a Markdown translator producing HTML5,
158 roff documents in the ms and man formats, LaTeX, gemini, and terminal output.")
159 (license license:isc))))
160
161 (define-public discount
162 (package
163 (name "discount")
164 (version "2.2.7")
165 (source (origin
166 (method url-fetch)
167 (uri (string-append
168 "http://www.pell.portland.or.us/~orc/Code/"
169 "discount/discount-" version ".tar.bz2"))
170 (sha256
171 (base32
172 "024mxv0gpvilyfczarcgy5m7h4lv6qvhjfpf5i73qkxhszjjn9mi"))))
173 (build-system gnu-build-system)
174 (arguments
175 `(#:test-target "test"
176 #:parallel-build? #f ; libmarkdown won't be built in time
177 #:make-flags (list
178 (string-append "LFLAGS=-L. -Wl,-rpath="
179 (assoc-ref %outputs "out") "/lib"))
180 #:phases
181 (modify-phases %standard-phases
182 (add-before 'configure 'set-AC_PATH
183 (lambda _
184 ;; The default value is not suitable, so override using an
185 ;; environment variable. This just affects the build, and not the
186 ;; resulting store item.
187 (setenv "AC_PATH" (getenv "PATH"))
188 #t))
189 (replace 'configure
190 (lambda* (#:key inputs outputs #:allow-other-keys)
191 (let ((out (assoc-ref outputs "out")))
192 (setenv "CC" ,(cc-for-target))
193 ;; The ‘validate-runpath’ phase fails otherwise.
194 (setenv "LDFLAGS" (string-append "-Wl,-rpath=" out "/lib"))
195 (invoke "./configure.sh"
196 (string-append "--prefix=" out)
197 "--shared")))))))
198 (native-inputs
199 (list pkg-config))
200 (synopsis "Markdown processing library, written in C")
201 (description
202 "Discount is a markdown implementation, written in C. It provides a
203 @command{markdown} command, and a library.")
204 (home-page "https://www.pell.portland.or.us/~orc/Code/discount/")
205 (license license:bsd-3)))
206
207 (define-public perl-text-markdown-discount
208 (package
209 (name "perl-text-markdown-discount")
210 (version "0.11")
211 (source
212 (origin
213 (method url-fetch)
214 (uri (string-append
215 "mirror://cpan/authors/id/S/SE/SEKIMURA/Text-Markdown-Discount-"
216 version
217 ".tar.gz"))
218 (sha256
219 (base32
220 "1xx7v3wnla7m6wa3h33whxw3vvincaicg4yra1b9wbzf2aix9rnw"))
221 (patches
222 (search-patches "perl-text-markdown-discount-unbundle.patch"))))
223 (build-system perl-build-system)
224 (arguments
225 `(#:phases
226 (modify-phases %standard-phases
227 (add-before 'build 'set-ldflags
228 (lambda* (#:key inputs #:allow-other-keys)
229 (substitute* "Makefile"
230 (("OTHERLDFLAGS = ")
231 (string-append
232 "OTHERLDFLAGS = -lmarkdown -Wl,-rpath="
233 (assoc-ref inputs "discount")
234 "/lib")))
235 #t)))))
236 (inputs
237 (list discount))
238 (home-page
239 "https://metacpan.org/release/Text-Markdown-Discount")
240 (synopsis
241 "Fast function for converting Markdown to HTML using Discount")
242 (description
243 "Text::Markdown::Discount is a Perl extension to the Discount markdown
244 implementation.
245
246 @example
247 use Text::Markdown::Discount;
248 my $html = markdown($text)
249 @end example")
250 (license license:perl-license)))
251
252 (define-public python-cmarkgfm
253 (package
254 (name "python-cmarkgfm")
255 (version "0.8.0")
256 (source (origin
257 (method url-fetch)
258 (uri (pypi-uri "cmarkgfm" version))
259 (sha256
260 (base32
261 "1jxk9cdir4q1bpjla7b7y1qfjmr7mkd0f802b2sb88njk079p1gy"))
262 (modules '((guix build utils)))
263 (snippet
264 '(begin
265 ;; Delete bundled cmark and generated headers.
266 (for-each delete-file-recursively
267 '("third_party/cmark" "generated"))))))
268 (build-system python-build-system)
269 (arguments
270 (list #:phases
271 #~(modify-phases %standard-phases
272 (add-after 'unpack 'relax-requirements
273 (lambda _
274 ;; Don't depend on bleeding-edge CFFI, as it is
275 ;; apparently only needed for Python >= 3.10.
276 (substitute* "setup.py"
277 (("cffi>=1\\.15\\.0")
278 "cffi>=1.0"))))
279 (add-after 'unpack 'copy-cmark-gfm
280 (lambda _
281 ;; This package needs the cmark-gfm source files
282 ;; to generate FFI bindings.
283 (copy-recursively #+(package-source (this-package-input
284 "cmark-gfm"))
285 "third_party/cmark")))
286 (add-after 'unpack 'install-cmark-headers
287 (lambda* (#:key inputs #:allow-other-keys)
288 ;; XXX: Loosely based on 'regenerate' from noxfile.py.
289 (let ((version.h (search-input-file
290 inputs "/include/cmark-gfm_version.h")))
291 (for-each (lambda (file)
292 (install-file file "generated/unix/"))
293 (cons version.h
294 (find-files (dirname version.h)
295 "_export\\.h$"))))))
296 (replace 'check
297 (lambda* (#:key tests? #:allow-other-keys)
298 (when tests? (invoke "pytest" "-vv" "tests")))))))
299 (native-inputs (list python-pytest))
300 (inputs (list cmark-gfm))
301 (propagated-inputs (list python-cffi))
302 (home-page "https://github.com/theacodes/cmarkgfm")
303 (synopsis "Python bindings for GitHub's fork of cmark")
304 (description
305 "This package provides a minimal set of Python bindings for the
306 GitHub cmark fork (@code{cmark-gfm}).")
307 (license license:expat)))
308
309 (define-public python-markdownify
310 (package
311 (name "python-markdownify")
312 (version "0.10.1")
313 (source
314 (origin
315 (method url-fetch)
316 (uri (pypi-uri "markdownify" version))
317 (sha256
318 (base32
319 "0msvrsgq9jigbgg7r7iq7ql5bgslmbxd8sq0nmpbxrjwqypgs7w2"))))
320 (build-system python-build-system)
321 (native-inputs
322 (list python-pytest))
323 (propagated-inputs
324 (list python-flake8 python-beautifulsoup4 python-six))
325 (home-page
326 "https://github.com/matthewwithanm/python-markdownify")
327 (synopsis "Converts HTML to Markdown")
328 (description "This package provides @code{markdownify} a Python library to
329 convert HTML to Markdown.")
330 (license license:expat)))
331
332 (define-public cmark
333 (package
334 (name "cmark")
335 (version "0.30.2")
336 (source (origin
337 (method git-fetch)
338 (uri (git-reference
339 (url "https://github.com/jgm/cmark")
340 (commit version)))
341 (file-name (git-file-name name version))
342 (sha256
343 (base32
344 "1426snw3mq8qmpdxznkhsyy75xd9v9nwlc7sph08qpdz8xnp4hr2"))))
345 (build-system cmake-build-system)
346 (arguments
347 '(#:test-target "test"))
348 (native-inputs (list python))
349 (synopsis "CommonMark Markdown reference implementation")
350 (description "CommonMark is a strongly defined, highly compatible
351 specification of Markdown. cmark is the C reference implementation of
352 CommonMark. It provides @code{libcmark} shared library for parsing
353 CommonMark to an abstract syntax tree (@dfn{AST}) and rendering the document
354 as HTML, groff man, LaTeX, CommonMark, or an XML representation of the
355 AST. The package also provides the command-line program @command{cmark}
356 for parsing and rendering CommonMark.")
357 (home-page "https://commonmark.org")
358 ;; cmark is distributed with a BSD-2 license, but some components are Expat
359 ;; licensed. The CommonMark specification is Creative Commons CC-BY-SA 4.0
360 ;; licensed. See 'COPYING' in the source distribution for more information.
361 (license (list license:bsd-2 license:expat license:cc-by-sa4.0))))
362
363 (define-public cmark-gfm
364 (package
365 (inherit cmark)
366 (name "cmark-gfm")
367 (version "0.29.0.gfm.2")
368 (home-page "https://github.com/github/cmark-gfm")
369 (source (origin
370 (method git-fetch)
371 (uri (git-reference (url home-page) (commit version)))
372 (file-name (git-file-name name version))
373 (sha256
374 (base32
375 "0vz6zs3m22k7jzfj4782lahciwfjlbi4m3qz5crsmssip3rwdy7h"))))
376 (arguments
377 '(#:test-target "test"
378 #:phases (modify-phases %standard-phases
379 (add-after 'install 'install-config
380 (lambda* (#:key outputs #:allow-other-keys)
381 (let ((out (assoc-ref outputs "out")))
382 ;; XXX: cmark-gfm-core-extensions.h includes this file.
383 (install-file "src/config.h"
384 (string-append out "/include"))))))))
385 (synopsis "GitHub flavored CommonMark")
386 (description
387 "This package is a fork of @code{cmark}, with GitHub-specific Markdown
388 additions.")))
389
390 (define-public smu
391 (package
392 (name "smu")
393 (version "1.5")
394 (source
395 (origin
396 (method git-fetch)
397 (uri (git-reference
398 (url "https://github.com/Gottox/smu")
399 (commit (string-append "v" version))))
400 (file-name (git-file-name name version))
401 (sha256
402 (base32 "1jm7lhnzjx4q7gcwlkvsbffcy0zppywyh50d71ami6dnq182vvcc"))))
403 (build-system gnu-build-system)
404 (arguments
405 `(#:make-flags (list "CC=gcc"
406 (string-append "PREFIX="
407 (assoc-ref %outputs "out")))
408 #:tests? #f ; no tests included
409 #:phases
410 (modify-phases %standard-phases
411 (delete 'configure))))
412 (home-page "https://github.com/Gottox/smu")
413 (synopsis "Simple markup")
414 (description
415 "Smu is a very simple and minimal markup language. It is
416 designed for using in wiki-like environments. Smu makes it very
417 easy to write your documents on the fly and convert them into HTML.
418 Smu is capable to parse very large documents. As long as you avoid an huge
419 amount of indents it scales just great.
420
421 Smu was started as a rewrite of Markdown but became something more
422 lightweight and consistent. The biggest difference between Markdown
423 and smu is that smu doesn't support reference style links.")
424 (license license:x11)))
425
426 (define-public md4c
427 (package
428 (name "md4c")
429 (version "0.4.8")
430 (source
431 (origin
432 (method git-fetch)
433 (uri (git-reference
434 (url "https://github.com/mity/md4c/")
435 (commit (string-append "release-" version))))
436 (file-name (git-file-name name version))
437 (sha256
438 (base32 "12pdh4rfjc3b0cblj5nz3jksr2376lx8ay0vw5dwa1s97q09pczq"))))
439 (build-system cmake-build-system)
440 (arguments '(#:tests? #f))
441 (home-page "https://github.com/mity/md4c/")
442 (synopsis "C Markdown parser compliant to CommonMark")
443 (description "MD4C is a C Markdown parser with a
444 SAX-like interface. It is compliant to the CommonMark specification,
445 with a few extensions.")
446 (license license:expat)))
447
448 (define-public python-mistletoe
449 (package
450 (name "python-mistletoe")
451 (version "0.8.1")
452 (source
453 (origin
454 (method url-fetch)
455 (uri (pypi-uri "mistletoe" version))
456 (sha256
457 (base32 "0h8ydzxlfzmspiz8lcm13qp720kfsxiky0qqnc2mxf4qzm16m326"))))
458 (build-system python-build-system)
459 (arguments
460 `(#:phases
461 (modify-phases %standard-phases
462 (replace 'check
463 (lambda* (#:key tests? #:allow-other-keys)
464 (when tests?
465 (invoke "python" "-m" "unittest" "discover" "test")))))))
466 (home-page "https://github.com/miyuchina/mistletoe")
467 (synopsis "Extensible Markdown parser in pure Python")
468 (description
469 "The @code{mistletoe} Markdown parser is a CommonMark-compliant Markdown
470 parser that supports definitions of custom tokens.
471
472 Parsing Markdown into an abstract syntax tree also allows @code{mistletoe} to
473 swap out renderers for different output formats, without touching any of the
474 core components.")
475 (license license:expat)))