KCoreAddons

ktexttohtml.h
1/*
2 SPDX-FileCopyrightText: 2002 Dave Corrie <kde@davecorrie.com>
3 SPDX-FileCopyrightText: 2014 Daniel Vrátil <dvratil@redhat.com>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#ifndef KCOREADDONS_KTEXTTOHTML_H
9#define KCOREADDONS_KTEXTTOHTML_H
10
11#include <kcoreaddons_export.h>
12
13#include <QString>
14
15/**
16 * @author Dave Corrie <kde@davecorrie.com>
17 */
18namespace KTextToHTML
19{
20/**
21 * @see Options
22 * @since 5.5.0
23 */
24enum Option {
25 /**
26 * Preserve white-space formatting of the text
27 */
29
30 /**
31 * Replace text emoticons smileys by emoticons images.
32 */
34
35 /**
36 * Don't parse and replace any URLs.
37 */
38 IgnoreUrls = 1 << 3,
39
40 /**
41 * Interpret text highlighting markup, like *bold*, _underline_ and /italic/,
42 * and wrap them in corresponding HTML entities.
43 */
44 HighlightText = 1 << 4,
45
46 /**
47 * Replace phone numbers with tel: links.
48 * @since 5.56.0
49 */
51};
52/**
53 * Stores a combination of #Option values.
54 */
55Q_DECLARE_FLAGS(Options, Option)
56Q_DECLARE_OPERATORS_FOR_FLAGS(Options)
57
58/**
59 * Converts plaintext into html. The following characters are converted
60 * to HTML entities: & " < >. Newlines are also preserved.
61 *
62 * @param plainText The text to be converted into HTML.
63 * @param options The options to use when processing @p plainText.
64 * @param maxUrlLen The maximum length of permitted URLs. The reason for
65 * this limit is that there may be possible security
66 * implications in handling URLs of unlimited length.
67 * @param maxAddressLen The maximum length of permitted email addresses.
68 * The reason for this limit is that there may be possible
69 * security implications in handling addresses of unlimited
70 * length.
71 *
72 * @return An HTML version of the text supplied in the 'plainText'
73 * parameter, suitable for inclusion in the BODY of an HTML document.
74 *
75 * @since 5.5.0
76 */
77KCOREADDONS_EXPORT QString convertToHtml(const QString &plainText, const KTextToHTML::Options &options, int maxUrlLen = 4096, int maxAddressLen = 255);
78
79}
80
81#endif
KCOREADDONS_EXPORT QString convertToHtml(const QString &plainText, const KTextToHTML::Options &options, int maxUrlLen=4096, int maxAddressLen=255)
Converts plaintext into html.
@ ReplaceSmileys
Replace text emoticons smileys by emoticons images.
Definition ktexttohtml.h:33
@ IgnoreUrls
Don't parse and replace any URLs.
Definition ktexttohtml.h:38
@ ConvertPhoneNumbers
Replace phone numbers with tel: links.
Definition ktexttohtml.h:50
@ HighlightText
Interpret text highlighting markup, like bold, underline and /italic/, and wrap them in corresponding...
Definition ktexttohtml.h:44
@ PreserveSpaces
Preserve white-space formatting of the text.
Definition ktexttohtml.h:28
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jul 26 2024 11:56:13 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.