MD::Visitor Class
class MD::VisitorVisitor interface to walk through the MD::Document. More...
| Header: | #include <md4qt/visitor.h> |
| CMake: | find_package(md4qt REQUIRED COMPONENTS md4qt)target_link_libraries(mytarget PRIVATE md4qt::md4qt) |
| Inherited By: | MD::details::AlgoVisitor, MD::details::HtmlVisitor, and MD::PosCache |
Public Functions
Protected Functions
| virtual void | onAddLineEnding() = 0 |
| virtual void | onAnchor(MD::Anchor *a) = 0 |
| virtual void | onBlockquote(MD::Blockquote *b) |
| virtual void | onCode(MD::Code *c) = 0 |
| virtual void | onFootnote(MD::Footnote *f) |
| virtual void | onFootnoteRef(MD::FootnoteRef *ref) = 0 |
| virtual void | onHeading(MD::Heading *h) = 0 |
| virtual void | onHorizontalLine(MD::HorizontalLine *l) = 0 |
| virtual void | onImage(MD::Image *i) = 0 |
| virtual void | onInlineCode(MD::Code *c) = 0 |
| virtual void | onLineBreak(MD::LineBreak *b) = 0 |
| virtual void | onLink(MD::Link *l) = 0 |
| virtual void | onList(MD::List *l) = 0 |
| virtual void | onListItem(MD::ListItem *i, bool first, bool skipOpeningWrap = false) |
| virtual void | onMath(MD::Math *m) = 0 |
| virtual void | onParagraph(MD::Paragraph *p, bool wrap, bool skipOpeningWrap = false) |
| virtual void | onRawHtml(MD::RawHtml *h) = 0 |
| virtual void | onTable(MD::Table *t) = 0 |
| virtual void | onTableCell(MD::TableCell *c) |
| virtual void | onText(MD::Text *t) = 0 |
| virtual void | onUserDefined(MD::Item *item) |
| virtual bool | wrapFirstParagraphInListItem(MD::ListItem *i) const |
Protected Variables
Detailed Description
This is a very basic implementation of walking through the document.
See also MD::details::AlgoVisitor, MD::details::HtmlVisitor, and MD::PosCache.
Member Function Documentation
[constexpr noexcept] Visitor::Visitor()
Default constructor.
[pure virtual protected] void Visitor::onAddLineEnding()
For some generator it's important to keep line endings like they were in Markdown. So onParagraph() method invokes this method when necessary to add line ending.
[pure virtual protected] void Visitor::onAnchor(MD::Anchor *a)
Handle anchor.
a Anchor.
[virtual protected] void Visitor::onBlockquote(MD::Blockquote *b)
Handle blockquote.
b Blockquote.
[pure virtual protected] void Visitor::onCode(MD::Code *c)
Handle code.
c Code.
[virtual protected] void Visitor::onFootnote(MD::Footnote *f)
Handle footnote.
f Footnote.
[pure virtual protected] void Visitor::onFootnoteRef(MD::FootnoteRef *ref)
Handle footnote reference.
ref Footnote reference.
[pure virtual protected] void Visitor::onHeading(MD::Heading *h)
Handle heading.
h Heading.
[pure virtual protected] void Visitor::onHorizontalLine(MD::HorizontalLine *l)
Handle horizontal line.
l Horizontal line.
[pure virtual protected] void Visitor::onImage(MD::Image *i)
Handle image.
i Image.
[pure virtual protected] void Visitor::onInlineCode(MD::Code *c)
Handle inline code.
c Code
[pure virtual protected] void Visitor::onLineBreak(MD::LineBreak *b)
Handle line break.
b Line break.
[pure virtual protected] void Visitor::onLink(MD::Link *l)
Handle link.
l Link.
[pure virtual protected] void Visitor::onList(MD::List *l)
Handle list.
l List.
[virtual protected] void Visitor::onListItem(MD::ListItem *i, bool first, bool skipOpeningWrap = false)
Handle list item.
i List item.
first Is this item first in the list?
skipOpeningWrap Indicates that opening wrap should be added or no.
[pure virtual protected] void Visitor::onMath(MD::Math *m)
Handle LaTeX math expression.
m Math.
[virtual protected] void Visitor::onParagraph(MD::Paragraph *p, bool wrap, bool skipOpeningWrap = false)
Handle paragraph.
p Paragraph.
wrap Wrap this paragraph with something or no? It's useful to not wrap standalone paragraph in list item, for example.
skipOpeningWrap Indicates that opening wrap should be added or no.
[pure virtual protected] void Visitor::onRawHtml(MD::RawHtml *h)
Handle raw HTML.
h Raw HTML.
[pure virtual protected] void Visitor::onTable(MD::Table *t)
Handle table.
t Table.
[virtual protected] void Visitor::onTableCell(MD::TableCell *c)
Handle table cell.
c Table cell.
[pure virtual protected] void Visitor::onText(MD::Text *t)
Handle text item.
t Text.
[virtual protected] void Visitor::onUserDefined(MD::Item *item)
Handle user-defined item.
item Item.
void Visitor::process(QSharedPointer<MD::Document> d)
Walk through the document.
d Markdown document.
[virtual protected] bool Visitor::wrapFirstParagraphInListItem(MD::ListItem *i) const
Returns whether first paragraph in list item should be wrapped.
i List item.
Member Variable Documentation
QStringList Visitor::m_anchors
All available m_anchors in the document.
QSharedPointer<MD::Document> Visitor::m_doc
Document.