summaryrefslogtreecommitdiff
blob: e9fef2679adb06fefed866146f0754c3012a70b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
From f1f638c2c51a6ef699dee22f6e90aff67beff8ec Mon Sep 17 00:00:00 2001
From: Albert Astals Cid <aacid@kde.org>
Date: Wed, 1 Feb 2023 22:01:52 +0100
Subject: [PATCH] Compile with discount 3

---
 generators/markdown/converter.cpp | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/generators/markdown/converter.cpp b/generators/markdown/converter.cpp
index 20d3c725f..3c8546b32 100644
--- a/generators/markdown/converter.cpp
+++ b/generators/markdown/converter.cpp
@@ -93,6 +93,8 @@ QTextDocument *Converter::convertOpenFile()
 {
     rewind(m_markdownFile);
 
+#if defined(MKD_NOLINKS)
+    // on discount 2 MKD_NOLINKS is a define
     MMIOT *markdownHandle = mkd_in(m_markdownFile, 0);
 
     int flags = MKD_FENCEDCODE | MKD_GITHUBTAGS | MKD_AUTOLINK | MKD_TOC | MKD_IDANCHOR;
@@ -103,6 +105,21 @@ QTextDocument *Converter::convertOpenFile()
         Q_EMIT error(i18n("Failed to compile the Markdown document."), -1);
         return nullptr;
     }
+#else
+    // on discount 3 MKD_NOLINKS is an enum value
+    MMIOT *markdownHandle = mkd_in(m_markdownFile, nullptr);
+
+    mkd_flag_t *flags = mkd_flags();
+    mkd_set_flag_bitmap(flags, MKD_FENCEDCODE | MKD_GITHUBTAGS | MKD_AUTOLINK | MKD_TOC | MKD_IDANCHOR);
+    if (!m_isFancyPantsEnabled) {
+        mkd_set_flag_num(flags, MKD_NOPANTS);
+    }
+    if (!mkd_compile(markdownHandle, flags)) {
+        Q_EMIT error(i18n("Failed to compile the Markdown document."), -1);
+        return nullptr;
+    }
+    mkd_free_flags(flags);
+#endif
 
     char *htmlDocument;
     const int size = mkd_document(markdownHandle, &htmlDocument);
-- 
GitLab