summaryrefslogtreecommitdiff
path: root/gnu/packages/markup.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/markup.scm')
-rw-r--r--gnu/packages/markup.scm193
1 files changed, 163 insertions, 30 deletions
diff --git a/gnu/packages/markup.scm b/gnu/packages/markup.scm
index 368976bfde..bc8476e056 100644
--- a/gnu/packages/markup.scm
+++ b/gnu/packages/markup.scm
@@ -4,9 +4,11 @@
;;; Copyright © 2016, 2019 Efraim Flashner <[email protected]>
;;; Copyright © 2017 Nikita <[email protected]>
;;; Copyright © 2017–2021 Tobias Geerinckx-Rice <[email protected]>
-;;; Copyright © 2020 Marius Bakke <[email protected]>
+;;; Copyright © 2020, 2022 Marius Bakke <[email protected]>
;;; Copyright © 2020 EuAndreh <[email protected]>
;;; Copyright © 2021 Noisytoot <[email protected]>
+;;; Copyright © 2021 Zhu Zihao <[email protected]>
+;;; Copyright © 2021 Petr Hodina <[email protected]>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -24,9 +26,10 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu packages markup)
- #:use-module (guix licenses)
+ #:use-module ((guix licenses) #:prefix license:)
#:use-module (guix download)
#:use-module (guix git-download)
+ #:use-module (guix gexp)
#:use-module (guix packages)
#:use-module (guix build-system gnu)
#:use-module (guix build-system trivial)
@@ -34,11 +37,16 @@
#:use-module (guix build-system perl)
#:use-module (guix build-system python)
#:use-module (guix utils)
- #:use-module (gnu packages compression)
+ #:use-module (guix gexp)
#:use-module (gnu packages)
+ #:use-module (gnu packages base)
+ #:use-module (gnu packages check)
+ #:use-module (gnu packages compression)
+ #:use-module (gnu packages libffi)
#:use-module (gnu packages perl)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages python)
+ #:use-module (gnu packages python-xyz)
#:use-module (gnu packages web))
(define-public hoedown
@@ -67,7 +75,7 @@
(description "Hoedown is a standards compliant, fast, secure markdown
processing library written in C.")
(home-page "https://github.com/hoedown/hoedown")
- (license expat)))
+ (license license:expat)))
(define-public markdown
(package
@@ -90,8 +98,7 @@ processing library written in C.")
(let ((source (assoc-ref %build-inputs "source"))
(out (assoc-ref %outputs "out"))
(perlbd (string-append (assoc-ref %build-inputs "perl") "/bin"))
- (unzip (string-append (assoc-ref %build-inputs "unzip")
- "/bin/unzip")))
+ (unzip (search-input-file %build-inputs "/bin/unzip")))
(mkdir-p out)
(with-directory-excursion out
(invoke unzip source)
@@ -103,16 +110,51 @@ processing library written in C.")
(patch-shebang "bin/markdown" (list perlbd))
(delete-file-recursively "Markdown_1.0.1"))
#t))))
- (native-inputs `(("unzip" ,unzip)))
- (inputs `(("perl" ,perl)))
+ (native-inputs (list unzip))
+ (inputs (list perl))
(home-page "http://daringfireball.net/projects/markdown")
(synopsis "Text-to-HTML conversion tool")
(description
"Markdown is a text-to-HTML conversion tool for web writers. It allows
you to write using an easy-to-read, easy-to-write plain text format, then
convert it to structurally valid XHTML (or HTML).")
- (license (non-copyleft "file://License.text"
- "See License.text in the distribution."))))
+ (license (license:non-copyleft "file://License.text"
+ "See License.text in the distribution."))))
+
+(define-public lowdown
+ (let ((commit "1de10c1d71bfb4348ae0beaec8b1547d5e114969")
+ (revision "1"))
+ (package
+ (name "lowdown")
+ (version (git-version "0.10.0" revision commit))
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/kristapsdz/lowdown")
+ (commit commit)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "1wh07nkiihvp1m79sj4qlnqklnn0rfp3hwls8sqcp0bfd96wpa1h"))))
+ (build-system gnu-build-system)
+ (arguments
+ (list
+ #:test-target "regress"
+ #:phases
+ #~(modify-phases %standard-phases
+ (replace 'configure
+ (lambda _
+ (invoke "./configure"
+ (string-append "PREFIX=" #$output)
+ (string-append "MANDIR=" #$output "/share/man")))))
+ #:make-flags #~(list "CFLAGS=-fPIC")))
+ (native-inputs
+ (list which))
+ (home-page "https://kristaps.bsd.lv/lowdown/")
+ (synopsis "Simple Markdown translator")
+ (description "Lowdown is a Markdown translator producing HTML5,
+roff documents in the ms and man formats, LaTeX, gemini, and terminal output.")
+ (license license:isc))))
(define-public discount
(package
@@ -152,13 +194,13 @@ convert it to structurally valid XHTML (or HTML).")
(string-append "--prefix=" out)
"--shared")))))))
(native-inputs
- `(("pkg-config" ,pkg-config)))
+ (list pkg-config))
(synopsis "Markdown processing library, written in C")
(description
"Discount is a markdown implementation, written in C. It provides a
@command{markdown} command, and a library.")
(home-page "https://www.pell.portland.or.us/~orc/Code/discount/")
- (license bsd-3)))
+ (license license:bsd-3)))
(define-public perl-text-markdown-discount
(package
@@ -190,7 +232,7 @@ convert it to structurally valid XHTML (or HTML).")
"/lib")))
#t)))))
(inputs
- `(("discount" ,discount)))
+ (list discount))
(home-page
"https://metacpan.org/release/Text-Markdown-Discount")
(synopsis
@@ -203,12 +245,85 @@ implementation.
use Text::Markdown::Discount;
my $html = markdown($text)
@end example")
- (license perl-license)))
+ (license license:perl-license)))
+
+(define-public python-cmarkgfm
+ (package
+ (name "python-cmarkgfm")
+ (version "0.7.0")
+ (source (origin
+ (method url-fetch)
+ (uri (pypi-uri "cmarkgfm" version))
+ (sha256
+ (base32
+ "06cw49bzxl3k7m8993cyi5zqxvk817z8ghhr9xqq5gx8klpiap56"))
+ (modules '((guix build utils)))
+ (snippet
+ '(begin
+ ;; Delete bundled cmark and generated headers.
+ (for-each delete-file-recursively
+ '("third_party/cmark" "generated"))))))
+ (build-system python-build-system)
+ (arguments
+ (list #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'copy-cmark-gfm
+ (lambda _
+ ;; This package needs the cmark-gfm source files
+ ;; to generate FFI bindings.
+ (copy-recursively #+(package-source (this-package-input
+ "cmark-gfm"))
+ "third_party/cmark")))
+ (add-after 'unpack 'install-cmark-headers
+ (lambda* (#:key inputs #:allow-other-keys)
+ ;; XXX: Loosely based on 'regenerate' from noxfile.py.
+ (let ((version.h (search-input-file
+ inputs "/include/cmark-gfm_version.h")))
+ (for-each (lambda (file)
+ (install-file file "generated/unix/"))
+ (cons version.h
+ (find-files (dirname version.h)
+ "_export\\.h$"))))))
+ (replace 'check
+ (lambda* (#:key tests? #:allow-other-keys)
+ (when tests? (invoke "pytest" "-vv" "tests")))))))
+ (native-inputs (list python-pytest))
+ (inputs (list cmark-gfm))
+ (propagated-inputs (list python-cffi-1.15))
+ (home-page "https://github.com/theacodes/cmarkgfm")
+ (synopsis "Python bindings for GitHub's fork of cmark")
+ (description
+ "This package provides a minimal set of Python bindings for the
+GitHub cmark fork (@code{cmark-gfm}).")
+ (license license:expat)))
+
+(define-public python-markdownify
+ (package
+ (name "python-markdownify")
+ (version "0.10.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (pypi-uri "markdownify" version))
+ (sha256
+ (base32
+ "0msvrsgq9jigbgg7r7iq7ql5bgslmbxd8sq0nmpbxrjwqypgs7w2"))))
+ (build-system python-build-system)
+ (native-inputs
+ (list python-pytest))
+ (propagated-inputs
+ (list python-flake8 python-beautifulsoup4 python-six))
+ (home-page
+ "https://github.com/matthewwithanm/python-markdownify")
+ (synopsis "Converts HTML to Markdown")
+ (description "This package provides @code{markdownify} a Python library to
+convert HTML to Markdown.")
+ (license license:expat)))
(define-public cmark
(package
(name "cmark")
- (version "0.29.0")
+ (version "0.30.2")
(source (origin
(method git-fetch)
(uri (git-reference
@@ -217,20 +332,11 @@ implementation.
(file-name (git-file-name name version))
(sha256
(base32
- "0r7jpqhgnssq444i8pwji2g36058vfzwkl70wbiwj13h4w5rfc8f"))
- (modules '((guix build utils)))
- (snippet
- '(begin
- ;; Mimic upstream commit 68c3a91166347 to fix a test failure
- ;; when using Python 3.8. Remove for versions > 0.29.
- ;; See <https://github.com/commonmark/cmark/issues/313>.
- (substitute* "test/normalize.py"
- (("cgi") "html"))
- #t))))
+ "1426snw3mq8qmpdxznkhsyy75xd9v9nwlc7sph08qpdz8xnp4hr2"))))
(build-system cmake-build-system)
(arguments
'(#:test-target "test"))
- (native-inputs `(("python" ,python)))
+ (native-inputs (list python))
(synopsis "CommonMark Markdown reference implementation")
(description "CommonMark is a strongly defined, highly compatible
specification of Markdown. cmark is the C reference implementation of
@@ -243,7 +349,34 @@ for parsing and rendering CommonMark.")
;; cmark is distributed with a BSD-2 license, but some components are Expat
;; licensed. The CommonMark specification is Creative Commons CC-BY-SA 4.0
;; licensed. See 'COPYING' in the source distribution for more information.
- (license (list bsd-2 expat cc-by-sa4.0))))
+ (license (list license:bsd-2 license:expat license:cc-by-sa4.0))))
+
+(define-public cmark-gfm
+ (package
+ (inherit cmark)
+ (name "cmark-gfm")
+ (version "0.29.0.gfm.2")
+ (home-page "https://github.com/github/cmark-gfm")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference (url home-page) (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0vz6zs3m22k7jzfj4782lahciwfjlbi4m3qz5crsmssip3rwdy7h"))))
+ (arguments
+ '(#:test-target "test"
+ #:phases (modify-phases %standard-phases
+ (add-after 'install 'install-config
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out")))
+ ;; XXX: cmark-gfm-core-extensions.h includes this file.
+ (install-file "src/config.h"
+ (string-append out "/include"))))))))
+ (synopsis "GitHub flavored CommonMark")
+ (description
+ "This package is a fork of @code{cmark}, with GitHub-specific Markdown
+additions.")))
(define-public smu
(package
@@ -279,7 +412,7 @@ amount of indents it scales just great.
Smu was started as a rewrite of Markdown but became something more
lightweight and consistent. The biggest difference between Markdown
and smu is that smu doesn't support reference style links.")
- (license x11)))
+ (license license:x11)))
(define-public md4c
(package
@@ -301,7 +434,7 @@ and smu is that smu doesn't support reference style links.")
(description "MD4C is a C Markdown parser with a
SAX-like interface. It is compliant to the CommonMark specification,
with a few extensions.")
- (license expat)))
+ (license license:expat)))
(define-public python-mistletoe
(package
@@ -323,4 +456,4 @@ parser that supports definitions of custom tokens.
Parsing Markdown into an abstract syntax tree also allows @code{mistletoe} to
swap out renderers for different output formats, without touching any of the
core components.")
- (license expat)))
+ (license license:expat)))