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>
9 ;;; Copyright © 2021 Noisytoot <noisytoot@disroot.org>
11 ;;; This file is part of GNU Guix.
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.
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.
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/>.
26 (define-module (gnu packages markup)
27 #:use-module (guix licenses)
28 #:use-module (guix download)
29 #:use-module (guix git-download)
30 #:use-module (guix packages)
31 #:use-module (guix build-system gnu)
32 #:use-module (guix build-system trivial)
33 #:use-module (guix build-system cmake)
34 #:use-module (guix build-system perl)
35 #:use-module (guix build-system python)
36 #:use-module (guix utils)
37 #:use-module (gnu packages compression)
38 #:use-module (gnu packages)
39 #:use-module (gnu packages perl)
40 #:use-module (gnu packages pkg-config)
41 #:use-module (gnu packages python)
42 #:use-module (gnu packages web))
44 (define-public hoedown
51 (url "https://github.com/hoedown/hoedown")
53 (file-name (git-file-name name version))
56 "1kr3hxjg2dgmwy9738qgj3sh3f5cygx0zxskkfhrg7x19bq9yd26"))))
57 (build-system gnu-build-system)
59 '(#:make-flags (list "CC=gcc" (string-append "PREFIX=" %output))
60 #:phases (modify-phases %standard-phases
61 (delete 'configure)) ; no configure script
62 #:test-target "test"))
64 `(("python" ,python-2)
66 (synopsis "Markdown processing library")
67 (description "Hoedown is a standards compliant, fast, secure markdown
68 processing library written in C.")
69 (home-page "https://github.com/hoedown/hoedown")
72 (define-public markdown
80 "http://daringfireball.net/projects/downloads/"
81 (string-capitalize name) "_" version ".zip"))
83 (base32 "0dq1pj91pvlwkv0jwcgdfpv6gvnxzrk3s8mnh7imamcclnvfj835"))))
84 (build-system trivial-build-system)
86 '(#:modules ((guix build utils))
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"))
93 (unzip (string-append (assoc-ref %build-inputs "unzip")
96 (with-directory-excursion out
100 (rename-file "Markdown_1.0.1/Markdown.pl" "bin/markdown")
101 (rename-file "Markdown_1.0.1/Markdown Readme.text"
103 (patch-shebang "bin/markdown" (list perlbd))
104 (delete-file-recursively "Markdown_1.0.1"))
106 (native-inputs `(("unzip" ,unzip)))
107 (inputs `(("perl" ,perl)))
108 (home-page "http://daringfireball.net/projects/markdown")
109 (synopsis "Text-to-HTML conversion tool")
111 "Markdown is a text-to-HTML conversion tool for web writers. It allows
112 you to write using an easy-to-read, easy-to-write plain text format, then
113 convert it to structurally valid XHTML (or HTML).")
114 (license (non-copyleft "file://License.text"
115 "See License.text in the distribution."))))
117 (define-public discount
124 "http://www.pell.portland.or.us/~orc/Code/"
125 "discount/discount-" version ".tar.bz2"))
128 "024mxv0gpvilyfczarcgy5m7h4lv6qvhjfpf5i73qkxhszjjn9mi"))))
129 (build-system gnu-build-system)
131 `(#:test-target "test"
132 #:parallel-build? #f ; libmarkdown won't be built in time
134 (string-append "LFLAGS=-L. -Wl,-rpath="
135 (assoc-ref %outputs "out") "/lib"))
137 (modify-phases %standard-phases
138 (add-before 'configure 'set-AC_PATH
140 ;; The default value is not suitable, so override using an
141 ;; environment variable. This just affects the build, and not the
142 ;; resulting store item.
143 (setenv "AC_PATH" (getenv "PATH"))
146 (lambda* (#:key inputs outputs #:allow-other-keys)
147 (let ((out (assoc-ref outputs "out")))
148 (setenv "CC" ,(cc-for-target))
149 ;; The ‘validate-runpath’ phase fails otherwise.
150 (setenv "LDFLAGS" (string-append "-Wl,-rpath=" out "/lib"))
151 (invoke "./configure.sh"
152 (string-append "--prefix=" out)
155 `(("pkg-config" ,pkg-config)))
156 (synopsis "Markdown processing library, written in C")
158 "Discount is a markdown implementation, written in C. It provides a
159 @command{markdown} command, and a library.")
160 (home-page "https://www.pell.portland.or.us/~orc/Code/discount/")
163 (define-public perl-text-markdown-discount
165 (name "perl-text-markdown-discount")
171 "mirror://cpan/authors/id/S/SE/SEKIMURA/Text-Markdown-Discount-"
176 "1xx7v3wnla7m6wa3h33whxw3vvincaicg4yra1b9wbzf2aix9rnw"))
178 (search-patches "perl-text-markdown-discount-unbundle.patch"))))
179 (build-system perl-build-system)
182 (modify-phases %standard-phases
183 (add-before 'build 'set-ldflags
184 (lambda* (#:key inputs #:allow-other-keys)
185 (substitute* "Makefile"
188 "OTHERLDFLAGS = -lmarkdown -Wl,-rpath="
189 (assoc-ref inputs "discount")
193 `(("discount" ,discount)))
195 "https://metacpan.org/release/Text-Markdown-Discount")
197 "Fast function for converting Markdown to HTML using Discount")
199 "Text::Markdown::Discount is a Perl extension to the Discount markdown
203 use Text::Markdown::Discount;
204 my $html = markdown($text)
206 (license perl-license)))
215 (url "https://github.com/jgm/cmark")
217 (file-name (git-file-name name version))
220 "0r7jpqhgnssq444i8pwji2g36058vfzwkl70wbiwj13h4w5rfc8f"))
221 (modules '((guix build utils)))
224 ;; Mimic upstream commit 68c3a91166347 to fix a test failure
225 ;; when using Python 3.8. Remove for versions > 0.29.
226 ;; See <https://github.com/commonmark/cmark/issues/313>.
227 (substitute* "test/normalize.py"
230 (build-system cmake-build-system)
232 '(#:test-target "test"))
233 (native-inputs `(("python" ,python)))
234 (synopsis "CommonMark Markdown reference implementation")
235 (description "CommonMark is a strongly defined, highly compatible
236 specification of Markdown. cmark is the C reference implementation of
237 CommonMark. It provides @code{libcmark} shared library for parsing
238 CommonMark to an abstract syntax tree (@dfn{AST}) and rendering the document
239 as HTML, groff man, LaTeX, CommonMark, or an XML representation of the
240 AST. The package also provides the command-line program @command{cmark}
241 for parsing and rendering CommonMark.")
242 (home-page "https://commonmark.org")
243 ;; cmark is distributed with a BSD-2 license, but some components are Expat
244 ;; licensed. The CommonMark specification is Creative Commons CC-BY-SA 4.0
245 ;; licensed. See 'COPYING' in the source distribution for more information.
246 (license (list bsd-2 expat cc-by-sa4.0))))
256 (url "https://github.com/Gottox/smu")
257 (commit (string-append "v" version))))
258 (file-name (git-file-name name version))
260 (base32 "1jm7lhnzjx4q7gcwlkvsbffcy0zppywyh50d71ami6dnq182vvcc"))))
261 (build-system gnu-build-system)
263 `(#:make-flags (list "CC=gcc"
264 (string-append "PREFIX="
265 (assoc-ref %outputs "out")))
266 #:tests? #f ; no tests included
268 (modify-phases %standard-phases
269 (delete 'configure))))
270 (home-page "https://github.com/Gottox/smu")
271 (synopsis "Simple markup")
273 "Smu is a very simple and minimal markup language. It is
274 designed for using in wiki-like environments. Smu makes it very
275 easy to write your documents on the fly and convert them into HTML.
276 Smu is capable to parse very large documents. As long as you avoid an huge
277 amount of indents it scales just great.
279 Smu was started as a rewrite of Markdown but became something more
280 lightweight and consistent. The biggest difference between Markdown
281 and smu is that smu doesn't support reference style links.")
292 (url "https://github.com/mity/md4c/")
293 (commit (string-append "release-" version))))
294 (file-name (git-file-name name version))
296 (base32 "0m3202zzjvw4k7jw66z1qi3cbisxzvplq5alkygpifvhzm81gwwx"))))
297 (build-system cmake-build-system)
298 (arguments '(#:tests? #f))
299 (home-page "https://github.com/mity/md4c/")
300 (synopsis "C Markdown parser compliant to CommonMark")
301 (description "MD4C is a C Markdown parser with a
302 SAX-like interface. It is compliant to the CommonMark specification,
303 with a few extensions.")
306 (define-public python-mistletoe
308 (name "python-mistletoe")
313 (uri (pypi-uri "mistletoe" version))
315 (base32 "18z6hqfnfjqnrcgfgl5pkj9ggf9yx0yyy94azcn1qf7hqn6g3l14"))))
316 (build-system python-build-system)
317 (home-page "https://github.com/miyuchina/mistletoe")
318 (synopsis "Extensible Markdown parser in pure Python")
320 "The @code{mistletoe} Markdown parser is a CommonMark-compliant Markdown
321 parser that supports definitions of custom tokens.
323 Parsing Markdown into an abstract syntax tree also allows @code{mistletoe} to
324 swap out renderers for different output formats, without touching any of the