summaryrefslogtreecommitdiffstats
path: root/tdemarkdown/markdown_part.h
diff options
context:
space:
mode:
authorMavridis Philippe <mavridisf@gmail.com>2022-02-05 17:44:26 +0000
committerSlávek Banko <slavek.banko@axis.cz>2022-04-17 18:35:01 +0200
commit95279fbf6dfeb43d80590740a9259d7caa614177 (patch)
tree8c3ff4de77102f1e55357dd81d650e9f22be69a0 /tdemarkdown/markdown_part.h
parenta291f3a0a3fab073c009f77a36745c5c7bd48e9b (diff)
downloadtdelibs-95279fbf6dfeb43d80590740a9259d7caa614177.tar.gz
tdelibs-95279fbf6dfeb43d80590740a9259d7caa614177.zip
Add tdemarkdown part - embeddable lightweight markdown viewing component.
TDEMarkdown is based on the md4c library and using TDEHTML for rendering its output. For enhanced safety, on HTML widget is turned off everything we don't need for viewing. It integrates nicely into Konqueror and supports both Commonmark and GitHub markdown syntaxes. Signed-off-by: Mavridis Philippe <mavridisf@gmail.com> Prepare to merge tdemarkdown into tdelibs. Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'tdemarkdown/markdown_part.h')
-rw-r--r--tdemarkdown/markdown_part.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/tdemarkdown/markdown_part.h b/tdemarkdown/markdown_part.h
new file mode 100644
index 000000000..0131553d3
--- /dev/null
+++ b/tdemarkdown/markdown_part.h
@@ -0,0 +1,47 @@
+/***************************************************************************
+ * Markdown Viewer part *
+ * Copyright (c) 2022 Mavridis Philippe <mavridisf@gmail.com> *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+
+
+#ifndef __MARKDOWN_PART_H
+#define __MARKDOWN_PART_H
+
+#include <tqwidget.h>
+
+#include <tdehtml_part.h>
+
+class TDEHTMLPart;
+
+class MarkdownPart : public TDEHTMLPart
+{
+ TQ_OBJECT
+
+ public:
+ MarkdownPart(TQWidget* parentWidget, const char* widgetName,
+ TQObject* parent, const char* name, const TQStringList& args);
+ ~MarkdownPart();
+
+ /* Create and return About data */
+ static TDEAboutData* createAboutData();
+
+ /* Implemented virtual from TDEHTMLPart */
+ bool openURL(const KURL& u);
+
+ /* Parser */
+ TQString& parse(MD_CHAR* document);
+
+ private:
+ TQString m_buffer;
+
+ static void processHTML(const MD_CHAR* data, MD_SIZE data_size, void* userData);
+
+};
+
+
+#endif // __MARKDOWN_PART_H