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