MD Namespace
Main namespace of md4qt library. More...
| Header: | #include <md4qt/parser.h> |
| CMake: | find_package(md4qt REQUIRED COMPONENTS md4qt)target_link_libraries(mytarget PRIVATE md4qt::md4qt) |
Namespaces
| namespace | details |
Classes
Types
| enum class | BlockState { None, Stop, Continue, ContinueWithoutAppendingChildCtx, Discard } |
| ItemFunctor | |
| enum class | ItemType { Heading, Text, Paragraph, LineBreak, Blockquote, …, UserDefined } |
| enum | TextOption { TextWithoutFormat, BoldText, ItalicText, StrikethroughText } |
Functions
| void | forEach(const QVector<MD::ItemType> &types, QSharedPointer<MD::Document> doc, MD::ItemFunctor func, unsigned int maxNestingLevel = 0) |
| int | htmlTagRule(MD::Line &line) |
| qsizetype | indentFromColumn(int c) |
| bool | isAsciiControl(const QChar &ch) |
| bool | isAsciiLetter(const QChar &c) |
| bool | isClosed(MD::Line &line, int rule, bool onSameLine) |
| bool | isEmail(const QString &url) |
| bool | isEmptyLine(MD::Line &line) |
| bool | isHorizontalLine(MD::Line &s) |
| bool | isHtmlTag(const QString &tag, MD::Line &line, bool closed) |
| bool | isIn(const MD::WithPosition &where, const MD::WithPosition &what) |
| bool | isValidTagName(const QString &tag) |
| bool | isValidUrl(const QString &url) |
| QString | readEscapedSequence(MD::Line &line, qsizetype *endPos = nullptr) |
| bool | readHtmlAttrName(MD::Line &line) |
| bool | readHtmlAttrValue(MD::Line &line) |
| bool | readHtmlAttributes(MD::Line &line) |
| QString | readLinkDestination(MD::Line &line) |
| QString | readLinkTitle(MD::Line &line, QChar &startChar, int &startParenthesisCount, qsizetype &startPos, bool &endStarted) |
| void | removeBackslashes(QString &str) |
| void | replaceEntity(QString &str) |
| void | skipIf(MD::Line &line, Pred pred) |
| qsizetype | skipIf(qsizetype startPos, const QString &line, Pred pred, qsizetype endPos = -1) |
| qsizetype | skipIfBackward(qsizetype startPos, const QString &line, Pred pred, qsizetype endPos = -1) |
| void | skipSpaces(MD::Line &line) |
| QString | toHtml(QSharedPointer<MD::Document> doc, bool wrapInBodyTag = true, const QString &footnoteBackLinkContent = {}, bool wrapInArticle = true, const MD::details::IdsMap *idsMap = nullptr) |
| bool | operator<(const MD::StyleDelim &s1, const MD::StyleDelim &s2) |
| bool | operator==(const MD::WithPosition &l, const MD::WithPosition &r) |
| bool | operator==(const MD::StyleDelim &l, const MD::StyleDelim &r) |
Detailed Description
All classes and functions of md4qt library is defined in this namespace.
Namespaces
namespace MD::details
Namespace for reusable auxiliary data structures.
Classes
class ATXHeadingParser
ATX heading parser. More...
class Anchor
Just an anchor. More...
class AsteriskEmphasisParser
Asterisk emphasis parser. More...
class AutolinkParser
Autolink parser. More...
class Block
Abstract block (storage of child items). More...
class BlockParser
Base class for parsing a block. More...
class Blockquote
Blockquote. More...
class BlockquoteParser
Blockquote parser. More...
class Code
Code. More...
class Context
Parsing context. More...
class Document
Document. More...
class EmphasisParser
Emphasis parser. More...
class FencedCodeParser
Fenced code parser. More...
class Footnote
Footnote. More...
class FootnoteParser
Footnote parser. More...
class FootnoteRef
Footnote reference. More...
class GfmAutolinkParser
GFM autolink parser. More...
class HTMLParser
HTML block parser. More...
class HardLineBreakParser
Hard line break parser. More...
class Heading
Heading. More...
class HorizontalLine
Horizontal line. More...
class Image
Image. More...
class IndentedCodeParser
Indented code parser. More...
class InlineCodeParser
Inline code parser. More...
class InlineContext
Inline parsing context. More...
class InlineHtmlParser
Inline HTML parser. More...
class InlineMathParser
Inline math parser. More...
class InlineParser
Base class for parsing inlines. More...
class Item
Base class for item in Markdown document. More...
class ItemWithOpts
Base class for items with style options. More...
class Line
Text line in the Markdown input document. More...
class LineBreak
Line break. More...
class Link
Link. More...
class LinkBase
Base class for links. More...
class LinkImageParser
Link and image parser. More...
class List
List. More...
class ListItem
List item in a list. More...
class ListParser
List parser. More...
class Math
LaTeX math expression. More...
class PageBreak
Page break. More...
class Paragraph
Paragraph. More...
class ParagraphParser
Paragraph parser. More...
class ParagraphStream
Text stream for paragraph processing. More...
class Parser
Markdown parser. More...
class PosCache
Cache of Markdown items to be accessed via position. More...
class RawHtml
Raw HTML. More...
class ReverseSolidusHandler
Helper for process reverse solidus characters. More...
class SetextHeadingParser
Setext heading parser. More...
class StrikethroughEmphasisParser
Strikethrough emphasis parser. More...
class StyleDelim
Emphasis in the Markdown document. More...
class Table
Table. More...
class TableCell
Table cell. More...
class TableParser
Table parser. More...
class TableRow
Table row. More...
class Text
Text item in Paragraph. More...
class TextStream
Actual text stream. More...
class TextStreamBase
Base class for text stream. More...
class ThematicBreakParser
Thematic break parser. More...
class UnderlineEmphasisParser
Underline emphasis parser. More...
class Visitor
Visitor interface to walk through the MD::Document. More...
class WithPosition
Base for any thing with start and end position. More...
class YAMLHeader
YAML header item in the document. More...
class YAMLParser
YAML parser. More...
Type Documentation
enum class MD::BlockState
Enumeration of block parsing states.
| Constant | Value | Description |
|---|---|---|
MD::BlockState::None | 0 | Means this instance does not handle current line. |
MD::BlockState::Stop | 1 | Means block was finished and next content should go for parsing of other block. |
MD::BlockState::Continue | 2 | Means this instance handles this line and parsing should give next lines to this block parser. |
MD::BlockState::ContinueWithoutAppendingChildCtx | 3 | Means this instance handles this line and parsing should give next lines to this block parser but child context should not be adder nor updated. |
MD::BlockState::Discard | 4 | Used on the next lines after check method to break processing with this block and try to process with other blocks. |
[alias] MD::ItemFunctor
Function type for algorithms.
enum class MD::ItemType
Enumeration of item types.
| Constant | Value | Description |
|---|---|---|
MD::ItemType::Heading | 0 | Heading. |
MD::ItemType::Text | 1 | Text. |
MD::ItemType::Paragraph | 2 | Paragraph. |
MD::ItemType::LineBreak | 3 | Line break. |
MD::ItemType::Blockquote | 4 | Blockquote. |
MD::ItemType::ListItem | 5 | List item. |
MD::ItemType::List | 6 | List. |
MD::ItemType::Link | 7 | Link. |
MD::ItemType::Image | 8 | Image. |
MD::ItemType::Code | 9 | Code. |
MD::ItemType::TableCell | 10 | Table cell. |
MD::ItemType::TableRow | 11 | Table row. |
MD::ItemType::Table | 12 | Table. |
MD::ItemType::FootnoteRef | 13 | Footnote ref. |
MD::ItemType::Footnote | 14 | Footnote. |
MD::ItemType::Document | 15 | Document. |
MD::ItemType::PageBreak | 16 | Page break. |
MD::ItemType::Anchor | 17 | Anchor. |
MD::ItemType::HorizontalLine | 18 | Horizontal line. |
MD::ItemType::RawHtml | 19 | Raw HTML. |
MD::ItemType::Math | 20 | Math expression. |
MD::ItemType::UserDefined | 255 | Start item for user-defined types. |
enum MD::TextOption
Text option.
| Constant | Value | Description |
|---|---|---|
MD::TextWithoutFormat | 0 | No format. |
MD::BoldText | 1 | Bold text. |
MD::ItalicText | 2 | Italic text. |
MD::StrikethroughText | 4 | Strikethrough. |
Function Documentation
void MD::forEach(const QVector<MD::ItemType> &types, QSharedPointer<MD::Document> doc, MD::ItemFunctor func, unsigned int maxNestingLevel = 0)
Calls function for each item in the document with the given type.
types Vector of item's types to be processed.
doc Document.
func Functor object.
maxNestingLevel Maximun nesting level. 0 means infinity, 1 - only top level items...
int MD::htmlTagRule(MD::Line &line)
Returns HTML tag rule.
line Line.
qsizetype MD::indentFromColumn(int c)
Returns indent from column.
c Column.
bool MD::isAsciiControl(const QChar &ch)
Returns whether the give symbol is ASCII control character.
ch Symbol.
bool MD::isAsciiLetter(const QChar &c)
Returns whether the given character is an ASCII letter.
c Character.
bool MD::isClosed(MD::Line &line, int rule, bool onSameLine)
Returns whether the HTML tag was closed.
line Line.
rule HTML tag rule.
onSameLine Flags that check is going on the same line as opening "<" character.
bool MD::isEmail(const QString &url)
Returns whether the given string a valid email?
url String for checking.
bool MD::isEmptyLine(MD::Line &line)
Return whether the given line is empty starting at the current position.
line Line.
bool MD::isHorizontalLine(MD::Line &s)
Returns whether string a horizontal line?
s String for checking.
bool MD::isHtmlTag(const QString &tag, MD::Line &line, bool closed)
Returns whether the HTML tag was read.
tag HTML tag name.
line Line.
closed Flags whether closing ">" was presented.
bool MD::isIn(const MD::WithPosition &where, const MD::WithPosition &what)
Returns whether the give object is in the given place.
where Place where to check if object is in.
what Object to check.
bool MD::isValidTagName(const QString &tag)
Returns whether the given string a valid HTML tag.
tag String for checking.
bool MD::isValidUrl(const QString &url)
Returns whether the given string a valid URL?
url String for checking.
QString MD::readEscapedSequence(MD::Line &line, qsizetype *endPos = nullptr)
Skip escaped sequence of characters till first space.
line String for reading.
endPos Receiver of last character's position in sequence.
bool MD::readHtmlAttrName(MD::Line &line)
Returns whether the HTML attribute name was read.
line Line.
bool MD::readHtmlAttrValue(MD::Line &line)
Returns whether the HTML attribute value was read.
line Line.
bool MD::readHtmlAttributes(MD::Line &line)
Returns whether the HTML attributes was read.
line Line.
QString MD::readLinkDestination(MD::Line &line)
Read link's destination.
line Line
QString MD::readLinkTitle(MD::Line &line, QChar &startChar, int &startParenthesisCount, qsizetype &startPos, bool &endStarted)
Read link's title.
line Line.
startChar Receiver for surrounding of title character.
startParenthesisCount Receiver for count of start parenthesis.
startPos Receiver for a start position.
endStarted Receiver for flag means that title is ended.
void MD::removeBackslashes(QString &str)
Remove backslashes from string.
str String.
void MD::replaceEntity(QString &str)
Replace entities in the string with corresponding character.
str String for modifications.
template <typename Pred> void MD::skipIf(MD::Line &line, Pred pred)
Skip characters by the given predicate.
line String.
pred Predicate.
template <typename Pred> qsizetype MD::skipIf(qsizetype startPos, const QString &line, Pred pred, qsizetype endPos = -1)
Returns first position of character not satisfying to predicate.
startPos Start position.
line String.
pred Predicate.
endPos End position. -1 means last character in the string.
See also MD::skipIfBackward.
template <typename Pred> qsizetype MD::skipIfBackward(qsizetype startPos, const QString &line, Pred pred, qsizetype endPos = -1)
Returns first position of character not satisfying to predicate moving in backward order.
startPos Start position.
line String.
pred Predicate.
endPos End position. -1 means first character in the string. End position is inclusive.
See also MD::skipIf.
void MD::skipSpaces(MD::Line &line)
Skip space characters.
line String.
template <typename HtmlVisitor = MD::details::HtmlVisitor> QString MD::toHtml(QSharedPointer<MD::Document> doc, bool wrapInBodyTag = true, const QString &footnoteBackLinkContent = {}, bool wrapInArticle = true, const MD::details::IdsMap *idsMap = nullptr)
Convert Document to HTML.
doc Markdown document.
wrapInBodyTag Wrap HTML into <body> tag?
footnoteBackLinkContent String that will be applied as content of back link from footnote. As an example, you can use "<img src="..." />".
wrapInArticle Wrap HTML with <article> tag?
idsMap Map of IDs to set to items.
bool MD::operator<(const MD::StyleDelim &s1, const MD::StyleDelim &s2)
Returns compare state of two style delimiters by theirs positions.
s1 Left operand.
s2 Right operand.
bool operator==(const MD::WithPosition &l, const MD::WithPosition &r)
Returns whether both are equal.
l Left operand.
r Right operand.
bool operator==(const MD::StyleDelim &l, const MD::StyleDelim &r)
Returns whether both are equal.
l Left operand.
r Right operand.