markup.scm 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  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 Marius Bakke <mbakke@fastmail.com>
  8. ;;; Copyright © 2020 EuAndreh <eu@euandre.org>
  9. ;;; Copyright © 2021 Noisytoot <noisytoot@disroot.org>
  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. (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 build-system python)
  35. #:use-module (guix utils)
  36. #:use-module (gnu packages compression)
  37. #:use-module (gnu packages)
  38. #:use-module (gnu packages perl)
  39. #:use-module (gnu packages pkg-config)
  40. #:use-module (gnu packages python)
  41. #:use-module (gnu packages web))
  42. (define-public hoedown
  43. (package
  44. (name "hoedown")
  45. (version "3.0.7")
  46. (source (origin
  47. (method git-fetch)
  48. (uri (git-reference
  49. (url "https://github.com/hoedown/hoedown")
  50. (commit version)))
  51. (file-name (git-file-name name version))
  52. (sha256
  53. (base32
  54. "1kr3hxjg2dgmwy9738qgj3sh3f5cygx0zxskkfhrg7x19bq9yd26"))))
  55. (build-system gnu-build-system)
  56. (arguments
  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"))
  61. (native-inputs
  62. `(("python" ,python-2)
  63. ("tidy" ,tidy)))
  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")
  68. (license expat)))
  69. (define-public markdown
  70. (package
  71. (name "markdown")
  72. (version "1.0.1")
  73. (source
  74. (origin
  75. (method url-fetch)
  76. (uri (string-append
  77. "http://daringfireball.net/projects/downloads/"
  78. (string-capitalize name) "_" version ".zip"))
  79. (sha256
  80. (base32 "0dq1pj91pvlwkv0jwcgdfpv6gvnxzrk3s8mnh7imamcclnvfj835"))))
  81. (build-system trivial-build-system)
  82. (arguments
  83. '(#:modules ((guix build utils))
  84. #:builder
  85. (begin
  86. (use-modules (guix build utils))
  87. (let ((source (assoc-ref %build-inputs "source"))
  88. (out (assoc-ref %outputs "out"))
  89. (perlbd (string-append (assoc-ref %build-inputs "perl") "/bin"))
  90. (unzip (search-input-file %build-inputs "/bin/unzip")))
  91. (mkdir-p out)
  92. (with-directory-excursion out
  93. (invoke unzip source)
  94. (mkdir "bin")
  95. (mkdir-p "share/doc")
  96. (rename-file "Markdown_1.0.1/Markdown.pl" "bin/markdown")
  97. (rename-file "Markdown_1.0.1/Markdown Readme.text"
  98. "share/doc/README")
  99. (patch-shebang "bin/markdown" (list perlbd))
  100. (delete-file-recursively "Markdown_1.0.1"))
  101. #t))))
  102. (native-inputs `(("unzip" ,unzip)))
  103. (inputs `(("perl" ,perl)))
  104. (home-page "http://daringfireball.net/projects/markdown")
  105. (synopsis "Text-to-HTML conversion tool")
  106. (description
  107. "Markdown is a text-to-HTML conversion tool for web writers. It allows
  108. you to write using an easy-to-read, easy-to-write plain text format, then
  109. convert it to structurally valid XHTML (or HTML).")
  110. (license (non-copyleft "file://License.text"
  111. "See License.text in the distribution."))))
  112. (define-public discount
  113. (package
  114. (name "discount")
  115. (version "2.2.7")
  116. (source (origin
  117. (method url-fetch)
  118. (uri (string-append
  119. "http://www.pell.portland.or.us/~orc/Code/"
  120. "discount/discount-" version ".tar.bz2"))
  121. (sha256
  122. (base32
  123. "024mxv0gpvilyfczarcgy5m7h4lv6qvhjfpf5i73qkxhszjjn9mi"))))
  124. (build-system gnu-build-system)
  125. (arguments
  126. `(#:test-target "test"
  127. #:parallel-build? #f ; libmarkdown won't be built in time
  128. #:make-flags (list
  129. (string-append "LFLAGS=-L. -Wl,-rpath="
  130. (assoc-ref %outputs "out") "/lib"))
  131. #:phases
  132. (modify-phases %standard-phases
  133. (add-before 'configure 'set-AC_PATH
  134. (lambda _
  135. ;; The default value is not suitable, so override using an
  136. ;; environment variable. This just affects the build, and not the
  137. ;; resulting store item.
  138. (setenv "AC_PATH" (getenv "PATH"))
  139. #t))
  140. (replace 'configure
  141. (lambda* (#:key inputs outputs #:allow-other-keys)
  142. (let ((out (assoc-ref outputs "out")))
  143. (setenv "CC" ,(cc-for-target))
  144. ;; The ‘validate-runpath’ phase fails otherwise.
  145. (setenv "LDFLAGS" (string-append "-Wl,-rpath=" out "/lib"))
  146. (invoke "./configure.sh"
  147. (string-append "--prefix=" out)
  148. "--shared")))))))
  149. (native-inputs
  150. `(("pkg-config" ,pkg-config)))
  151. (synopsis "Markdown processing library, written in C")
  152. (description
  153. "Discount is a markdown implementation, written in C. It provides a
  154. @command{markdown} command, and a library.")
  155. (home-page "https://www.pell.portland.or.us/~orc/Code/discount/")
  156. (license bsd-3)))
  157. (define-public perl-text-markdown-discount
  158. (package
  159. (name "perl-text-markdown-discount")
  160. (version "0.11")
  161. (source
  162. (origin
  163. (method url-fetch)
  164. (uri (string-append
  165. "mirror://cpan/authors/id/S/SE/SEKIMURA/Text-Markdown-Discount-"
  166. version
  167. ".tar.gz"))
  168. (sha256
  169. (base32
  170. "1xx7v3wnla7m6wa3h33whxw3vvincaicg4yra1b9wbzf2aix9rnw"))
  171. (patches
  172. (search-patches "perl-text-markdown-discount-unbundle.patch"))))
  173. (build-system perl-build-system)
  174. (arguments
  175. `(#:phases
  176. (modify-phases %standard-phases
  177. (add-before 'build 'set-ldflags
  178. (lambda* (#:key inputs #:allow-other-keys)
  179. (substitute* "Makefile"
  180. (("OTHERLDFLAGS = ")
  181. (string-append
  182. "OTHERLDFLAGS = -lmarkdown -Wl,-rpath="
  183. (assoc-ref inputs "discount")
  184. "/lib")))
  185. #t)))))
  186. (inputs
  187. `(("discount" ,discount)))
  188. (home-page
  189. "https://metacpan.org/release/Text-Markdown-Discount")
  190. (synopsis
  191. "Fast function for converting Markdown to HTML using Discount")
  192. (description
  193. "Text::Markdown::Discount is a Perl extension to the Discount markdown
  194. implementation.
  195. @example
  196. use Text::Markdown::Discount;
  197. my $html = markdown($text)
  198. @end example")
  199. (license perl-license)))
  200. (define-public cmark
  201. (package
  202. (name "cmark")
  203. (version "0.29.0")
  204. (source (origin
  205. (method git-fetch)
  206. (uri (git-reference
  207. (url "https://github.com/jgm/cmark")
  208. (commit version)))
  209. (file-name (git-file-name name version))
  210. (sha256
  211. (base32
  212. "0r7jpqhgnssq444i8pwji2g36058vfzwkl70wbiwj13h4w5rfc8f"))
  213. (modules '((guix build utils)))
  214. (snippet
  215. '(begin
  216. ;; Mimic upstream commit 68c3a91166347 to fix a test failure
  217. ;; when using Python 3.8. Remove for versions > 0.29.
  218. ;; See <https://github.com/commonmark/cmark/issues/313>.
  219. (substitute* "test/normalize.py"
  220. (("cgi") "html"))
  221. #t))))
  222. (build-system cmake-build-system)
  223. (arguments
  224. '(#:test-target "test"))
  225. (native-inputs `(("python" ,python)))
  226. (synopsis "CommonMark Markdown reference implementation")
  227. (description "CommonMark is a strongly defined, highly compatible
  228. specification of Markdown. cmark is the C reference implementation of
  229. CommonMark. It provides @code{libcmark} shared library for parsing
  230. CommonMark to an abstract syntax tree (@dfn{AST}) and rendering the document
  231. as HTML, groff man, LaTeX, CommonMark, or an XML representation of the
  232. AST. The package also provides the command-line program @command{cmark}
  233. for parsing and rendering CommonMark.")
  234. (home-page "https://commonmark.org")
  235. ;; cmark is distributed with a BSD-2 license, but some components are Expat
  236. ;; licensed. The CommonMark specification is Creative Commons CC-BY-SA 4.0
  237. ;; licensed. See 'COPYING' in the source distribution for more information.
  238. (license (list bsd-2 expat cc-by-sa4.0))))
  239. (define-public smu
  240. (package
  241. (name "smu")
  242. (version "1.5")
  243. (source
  244. (origin
  245. (method git-fetch)
  246. (uri (git-reference
  247. (url "https://github.com/Gottox/smu")
  248. (commit (string-append "v" version))))
  249. (file-name (git-file-name name version))
  250. (sha256
  251. (base32 "1jm7lhnzjx4q7gcwlkvsbffcy0zppywyh50d71ami6dnq182vvcc"))))
  252. (build-system gnu-build-system)
  253. (arguments
  254. `(#:make-flags (list "CC=gcc"
  255. (string-append "PREFIX="
  256. (assoc-ref %outputs "out")))
  257. #:tests? #f ; no tests included
  258. #:phases
  259. (modify-phases %standard-phases
  260. (delete 'configure))))
  261. (home-page "https://github.com/Gottox/smu")
  262. (synopsis "Simple markup")
  263. (description
  264. "Smu is a very simple and minimal markup language. It is
  265. designed for using in wiki-like environments. Smu makes it very
  266. easy to write your documents on the fly and convert them into HTML.
  267. Smu is capable to parse very large documents. As long as you avoid an huge
  268. amount of indents it scales just great.
  269. Smu was started as a rewrite of Markdown but became something more
  270. lightweight and consistent. The biggest difference between Markdown
  271. and smu is that smu doesn't support reference style links.")
  272. (license x11)))
  273. (define-public md4c
  274. (package
  275. (name "md4c")
  276. (version "0.4.8")
  277. (source
  278. (origin
  279. (method git-fetch)
  280. (uri (git-reference
  281. (url "https://github.com/mity/md4c/")
  282. (commit (string-append "release-" version))))
  283. (file-name (git-file-name name version))
  284. (sha256
  285. (base32 "12pdh4rfjc3b0cblj5nz3jksr2376lx8ay0vw5dwa1s97q09pczq"))))
  286. (build-system cmake-build-system)
  287. (arguments '(#:tests? #f))
  288. (home-page "https://github.com/mity/md4c/")
  289. (synopsis "C Markdown parser compliant to CommonMark")
  290. (description "MD4C is a C Markdown parser with a
  291. SAX-like interface. It is compliant to the CommonMark specification,
  292. with a few extensions.")
  293. (license expat)))
  294. (define-public python-mistletoe
  295. (package
  296. (name "python-mistletoe")
  297. (version "0.7.2")
  298. (source
  299. (origin
  300. (method url-fetch)
  301. (uri (pypi-uri "mistletoe" version))
  302. (sha256
  303. (base32 "18z6hqfnfjqnrcgfgl5pkj9ggf9yx0yyy94azcn1qf7hqn6g3l14"))))
  304. (build-system python-build-system)
  305. (home-page "https://github.com/miyuchina/mistletoe")
  306. (synopsis "Extensible Markdown parser in pure Python")
  307. (description
  308. "The @code{mistletoe} Markdown parser is a CommonMark-compliant Markdown
  309. parser that supports definitions of custom tokens.
  310. Parsing Markdown into an abstract syntax tree also allows @code{mistletoe} to
  311. swap out renderers for different output formats, without touching any of the
  312. core components.")
  313. (license expat)))