summaryrefslogtreecommitdiffstats
path: root/tdemarkdown/markdown_part.h
blob: f3e003ec9e0ab5af59fec3d0ec4a0e148c3c5abd (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
/***************************************************************************
 *   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, MD_CHAR* title = nullptr);

    private:
        TQString m_buffer;

        static void processHTML(const MD_CHAR* data, MD_SIZE data_size, void* userData);

};


#endif // __MARKDOWN_PART_H