Commit | Line | Data |
---|---|---|
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> |
34316794 | 6 | ;;; Copyright © 2017, 2018, 2019, 2020 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 | |
68 | processing 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")) | |
93 | (unzip (string-append (assoc-ref %build-inputs "unzip") | |
94 | "/bin/unzip"))) | |
95 | (mkdir-p out) | |
96 | (with-directory-excursion out | |
e3cfef22 | 97 | (invoke unzip source) |
bae87762 ML |
98 | (mkdir "bin") |
99 | (mkdir-p "share/doc") | |
100 | (rename-file "Markdown_1.0.1/Markdown.pl" "bin/markdown") | |
101 | (rename-file "Markdown_1.0.1/Markdown Readme.text" | |
102 | "share/doc/README") | |
103 | (patch-shebang "bin/markdown" (list perlbd)) | |
e3cfef22 MW |
104 | (delete-file-recursively "Markdown_1.0.1")) |
105 | #t)))) | |
bae87762 ML |
106 | (native-inputs `(("unzip" ,unzip))) |
107 | (inputs `(("perl" ,perl))) | |
108 | (home-page "http://daringfireball.net/projects/markdown") | |
109 | (synopsis "Text-to-HTML conversion tool") | |
110 | (description | |
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.")))) | |
80588800 | 116 | |
31d3a7c7 CB |
117 | (define-public discount |
118 | (package | |
119 | (name "discount") | |
34316794 | 120 | (version "2.2.7") |
31d3a7c7 CB |
121 | (source (origin |
122 | (method url-fetch) | |
123 | (uri (string-append | |
124 | "http://www.pell.portland.or.us/~orc/Code/" | |
ad0b91bd | 125 | "discount/discount-" version ".tar.bz2")) |
31d3a7c7 CB |
126 | (sha256 |
127 | (base32 | |
34316794 | 128 | "024mxv0gpvilyfczarcgy5m7h4lv6qvhjfpf5i73qkxhszjjn9mi")))) |
31d3a7c7 CB |
129 | (build-system gnu-build-system) |
130 | (arguments | |
131 | `(#:test-target "test" | |
34316794 | 132 | #:parallel-build? #f ; libmarkdown won't be built in time |
31d3a7c7 CB |
133 | #:make-flags (list |
134 | (string-append "LFLAGS=-L. -Wl,-rpath=" | |
135 | (assoc-ref %outputs "out") "/lib")) | |
136 | #:phases | |
137 | (modify-phases %standard-phases | |
138 | (add-before 'configure 'set-AC_PATH | |
139 | (lambda _ | |
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")) | |
144 | #t)) | |
145 | (replace 'configure | |
146 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
34316794 TGR |
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) | |
153 | "--shared"))))))) | |
01f9a4c0 TGR |
154 | (native-inputs |
155 | `(("pkg-config" ,pkg-config))) | |
31d3a7c7 CB |
156 | (synopsis "Markdown processing library, written in C") |
157 | (description | |
158 | "Discount is a markdown implementation, written in C. It provides a | |
159 | @command{markdown} command, and a library.") | |
7fcb3935 | 160 | (home-page "https://www.pell.portland.or.us/~orc/Code/discount/") |
31d3a7c7 CB |
161 | (license bsd-3))) |
162 | ||
9d46919f CB |
163 | (define-public perl-text-markdown-discount |
164 | (package | |
165 | (name "perl-text-markdown-discount") | |
166 | (version "0.11") | |
167 | (source | |
168 | (origin | |
169 | (method url-fetch) | |
170 | (uri (string-append | |
171 | "mirror://cpan/authors/id/S/SE/SEKIMURA/Text-Markdown-Discount-" | |
172 | version | |
173 | ".tar.gz")) | |
174 | (sha256 | |
175 | (base32 | |
176 | "1xx7v3wnla7m6wa3h33whxw3vvincaicg4yra1b9wbzf2aix9rnw")) | |
177 | (patches | |
1da3d2a3 | 178 | (search-patches "perl-text-markdown-discount-unbundle.patch")))) |
9d46919f CB |
179 | (build-system perl-build-system) |
180 | (arguments | |
181 | `(#:phases | |
182 | (modify-phases %standard-phases | |
183 | (add-before 'build 'set-ldflags | |
184 | (lambda* (#:key inputs #:allow-other-keys) | |
185 | (substitute* "Makefile" | |
186 | (("OTHERLDFLAGS = ") | |
187 | (string-append | |
188 | "OTHERLDFLAGS = -lmarkdown -Wl,-rpath=" | |
189 | (assoc-ref inputs "discount") | |
4851af9e MW |
190 | "/lib"))) |
191 | #t))))) | |
9d46919f CB |
192 | (inputs |
193 | `(("discount" ,discount))) | |
194 | (home-page | |
9aba9b12 | 195 | "https://metacpan.org/release/Text-Markdown-Discount") |
9d46919f CB |
196 | (synopsis |
197 | "Fast function for converting Markdown to HTML using Discount") | |
198 | (description | |
199 | "Text::Markdown::Discount is a Perl extension to the Discount markdown | |
200 | implementation. | |
201 | ||
202 | @example | |
203 | use Text::Markdown::Discount; | |
204 | my $html = markdown($text) | |
205 | @end example") | |
206 | (license perl-license))) | |
207 | ||
80588800 EE |
208 | (define-public cmark |
209 | (package | |
210 | (name "cmark") | |
88409717 | 211 | (version "0.29.0") |
80588800 | 212 | (source (origin |
2c24b96b EF |
213 | (method git-fetch) |
214 | (uri (git-reference | |
b0e7b699 | 215 | (url "https://github.com/jgm/cmark") |
2c24b96b EF |
216 | (commit version))) |
217 | (file-name (git-file-name name version)) | |
80588800 EE |
218 | (sha256 |
219 | (base32 | |
49279343 MB |
220 | "0r7jpqhgnssq444i8pwji2g36058vfzwkl70wbiwj13h4w5rfc8f")) |
221 | (modules '((guix build utils))) | |
222 | (snippet | |
223 | '(begin | |
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" | |
228 | (("cgi") "html")) | |
229 | #t)))) | |
80588800 EE |
230 | (build-system cmake-build-system) |
231 | (arguments | |
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 | |
554245da | 238 | CommonMark to an abstract syntax tree (@dfn{AST}) and rendering the document |
80588800 EE |
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.") | |
78763c1e | 242 | (home-page "https://commonmark.org") |
80588800 EE |
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)))) | |
83f0d3a5 | 247 | |
248 | (define-public smu | |
249 | (package | |
250 | (name "smu") | |
67e4abc5 | 251 | (version "1.5") |
83f0d3a5 | 252 | (source |
253 | (origin | |
62b3a9b4 TGR |
254 | (method git-fetch) |
255 | (uri (git-reference | |
b0e7b699 | 256 | (url "https://github.com/Gottox/smu") |
62b3a9b4 TGR |
257 | (commit (string-append "v" version)))) |
258 | (file-name (git-file-name name version)) | |
83f0d3a5 | 259 | (sha256 |
62b3a9b4 | 260 | (base32 "1jm7lhnzjx4q7gcwlkvsbffcy0zppywyh50d71ami6dnq182vvcc")))) |
83f0d3a5 | 261 | (build-system gnu-build-system) |
262 | (arguments | |
263 | `(#:make-flags (list "CC=gcc" | |
264 | (string-append "PREFIX=" | |
265 | (assoc-ref %outputs "out"))) | |
67e4abc5 | 266 | #:tests? #f ; no tests included |
83f0d3a5 | 267 | #:phases |
268 | (modify-phases %standard-phases | |
269 | (delete 'configure)))) | |
270 | (home-page "https://github.com/Gottox/smu") | |
271 | (synopsis "Simple markup") | |
272 | (description | |
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. | |
278 | ||
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.") | |
282 | (license x11))) | |
966bdd11 E |
283 | |
284 | (define-public md4c | |
285 | (package | |
286 | (name "md4c") | |
287 | (version "0.4.7") | |
288 | (source | |
289 | (origin | |
290 | (method git-fetch) | |
291 | (uri (git-reference | |
292 | (url "https://github.com/mity/md4c/") | |
293 | (commit (string-append "release-" version)))) | |
294 | (file-name (git-file-name name version)) | |
295 | (sha256 | |
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.") | |
304 | (license expat))) | |
80599a73 RNG |
305 | |
306 | (define-public python-mistletoe | |
307 | (package | |
308 | (name "python-mistletoe") | |
309 | (version "0.7.2") | |
310 | (source | |
311 | (origin | |
312 | (method url-fetch) | |
313 | (uri (pypi-uri "mistletoe" version)) | |
314 | (sha256 | |
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") | |
319 | (description | |
320 | "The @code{mistletoe} Markdown parser is a CommonMark-compliant Markdown | |
321 | parser that supports definitions of custom tokens. | |
322 | ||
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 | |
325 | core components.") | |
326 | (license expat))) |