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.scm96
1 files changed, 83 insertions, 13 deletions
diff --git a/gnu/packages/markup.scm b/gnu/packages/markup.scm
index 5f2f525cd2..be3d4e619f 100644
--- a/gnu/packages/markup.scm
+++ b/gnu/packages/markup.scm
@@ -4,7 +4,7 @@
;;; 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]>
@@ -36,10 +36,12 @@
#:use-module (guix build-system perl)
#:use-module (guix build-system python)
#:use-module (guix utils)
+ #: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)
+ #:use-module (gnu packages libffi)
#:use-module (gnu packages perl)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages python)
@@ -239,6 +241,56 @@ implementation.
@end example")
(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")
@@ -265,7 +317,7 @@ convert HTML to Markdown.")
(define-public cmark
(package
(name "cmark")
- (version "0.29.0")
+ (version "0.30.2")
(source (origin
(method git-fetch)
(uri (git-reference
@@ -274,16 +326,7 @@ convert HTML to Markdown.")
(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"))
@@ -302,6 +345,33 @@ for parsing and rendering CommonMark.")
;; licensed. See 'COPYING' in the source distribution for more information.
(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
(name "smu")