1{ lib
2, stdenv
3, fetchFromGitHub
4, cmake
5, pkg-config
6}:
7
8stdenv.mkDerivation rec {
9 pname = "md4c";
10 version = "0.4.8";
11
12 src = fetchFromGitHub {
13 owner = "mity";
14 repo = pname;
15 rev = "release-${version}";
16 hash = "sha256-+LObAD5JB8Vb4Rt4hTo1Z4ispxzfFkkXA2sw6TKB7Yo=";
17 };
18
19 patches = [
20 # We set CMAKE_INSTALL_LIBDIR to the absolute path in $out, so
21 # prefix and exec_prefix cannot be $out, too
22 # Use CMake's _FULL_ variables instead of `prefix` concatenation.
23 ./fix-pkgconfig.patch
24 ];
25
26 nativeBuildInputs = [
27 cmake
28 pkg-config
29 ];
30
31 meta = with lib; {
32 description = "Markdown parser made in C";
33 longDescription = ''
34 MD4C is Markdown parser implementation in C, with the following features:
35
36 - Compliance: Generally, MD4C aims to be compliant to the latest version
37 of CommonMark specification. Currently, we are fully compliant to
38 CommonMark 0.29.
39 - Extensions: MD4C supports some commonly requested and accepted
40 extensions. See below.
41 - Performance: MD4C is very fast.
42 - Compactness: MD4C parser is implemented in one source file and one
43 header file. There are no dependencies other than standard C library.
44 - Embedding: MD4C parser is easy to reuse in other projects, its API is
45 very straightforward: There is actually just one function, md_parse().
46 - Push model: MD4C parses the complete document and calls few callback
47 functions provided by the application to inform it about a start/end of
48 every block, a start/end of every span, and with any textual contents.
49 - Portability: MD4C builds and works on Windows and POSIX-compliant
50 OSes. (It should be simple to make it run also on most other platforms,
51 at least as long as the platform provides C standard library, including
52 a heap memory management.)
53 - Encoding: MD4C by default expects UTF-8 encoding of the input
54 document. But it can be compiled to recognize ASCII-only control
55 characters (i.e. to disable all Unicode-specific code), or (on Windows)
56 to expect UTF-16 (i.e. what is on Windows commonly called just
57 "Unicode"). See more details below.
58 - Permissive license: MD4C is available under the MIT license.
59 '';
60 homepage = "https://github.com/mity/md4c";
61 license = licenses.mit;
62 maintainers = with maintainers; [ AndersonTorres ];
63 mainProgram = "md2html";
64 platforms = platforms.all;
65 };
66}
67# TODO: enable tests (needs Python)