MD::details::HtmlVisitor Class

template <typename Trait> class MD::details::HtmlVisitor

HTML visitor interface to walk through Document. More...

Header: #include <md4qt/html.h>
CMake: find_package(md4qt REQUIRED COMPONENTS md4qt)
target_link_libraries(mytarget PRIVATE md4qt::md4qt)
Inherits: MD::Visitor

Public Functions

virtual typename Trait::String toHtml(std::shared_ptr<MD::Document<Trait>> doc, const typename Trait::String &hrefForRefBackImage, bool wrappedInArticle = true)

Protected Types

Protected Functions

virtual void closeStyle(const typename ItemWithOpts<Trait>::Styles &styles)
virtual typename Trait::String headingIdToHtml(MD::Heading<Trait> *h)
void onAddLineEnding() override
void onAnchor(MD::Anchor<Trait> *a) override
void onBlockquote(MD::Blockquote<Trait> *b) override
void onCode(MD::Code<Trait> *c) override
void onFootnoteRef(MD::FootnoteRef<Trait> *ref) override
virtual void onFootnotes(const typename Trait::String &hrefForRefBackImage)
void onHeading(MD::Heading<Trait> *h) override
virtual void onHeading(MD::Heading<Trait> *h, const typename Trait::String &ht)
void onHorizontalLine(MD::HorizontalLine<Trait> *) override
void onImage(MD::Image<Trait> *i) override
void onInlineCode(MD::Code<Trait> *c) override
void onLineBreak(MD::LineBreak<Trait> *) override
void onLink(MD::Link<Trait> *l) override
void onList(MD::List<Trait> *l) override
void onListItem(MD::ListItem<Trait> *i, bool first) override
void onMath(MD::Math<Trait> *m) override
void onParagraph(MD::Paragraph<Trait> *p, bool wrap) override
void onRawHtml(MD::RawHtml<Trait> *h) override
void onTable(MD::Table<Trait> *t) override
void onText(MD::Text<Trait> *t) override
virtual void openStyle(const typename ItemWithOpts<Trait>::Styles &styles)
virtual typename Trait::String prepareTextForHtml(const typename Trait::String &t)
virtual typename Trait::String tableAlignmentToHtml(typename Table<Trait>::Alignment a)

Protected Variables

bool m_dontIncrementFootnoteCount
typename Trait::template Vector<FootnoteRefStuff> m_fns
typename Trait::String m_html
bool m_isWrappedInArticle
bool m_justCollectFootnoteRefs

Detailed Description

Member Function Documentation

[virtual protected] void HtmlVisitor::closeStyle(const typename ItemWithOpts<Trait>::Styles &styles)

Insert into HTML tags for closing styles.

styles Styles.

[virtual protected] typename Trait::String HtmlVisitor::headingIdToHtml(MD::Heading<Trait> *h)

Returns HTML content for heading's ID.

h Heading.

[protected] void HtmlVisitor::onAddLineEnding()

Handle new line in HTML.

[protected] void HtmlVisitor::onAnchor(MD::Anchor<Trait> *a)

Handle anchor.

a Anchor.

[protected] void HtmlVisitor::onBlockquote(MD::Blockquote<Trait> *b)

Handle blockquote.

b Blockquote.

[protected] void HtmlVisitor::onCode(MD::Code<Trait> *c)

Handle code block.

c Code.

[protected] void HtmlVisitor::onFootnoteRef(MD::FootnoteRef<Trait> *ref)

Handle footnote reference.

ref Footnote reference.

[virtual protected] void HtmlVisitor::onFootnotes(const typename Trait::String &hrefForRefBackImage)

Handle footnotes.

hrefForRefBackImage String that will be applied as URL for image for back link from footnote.

[protected] void HtmlVisitor::onHeading(MD::Heading<Trait> *h)

Handle heading.

h Heading.

[virtual protected] void HtmlVisitor::onHeading(MD::Heading<Trait> *h, const typename Trait::String &ht)

Handle heading.

h Heading.

ht Heading tag.

[protected] void HtmlVisitor::onHorizontalLine(MD::HorizontalLine<Trait> *)

Handle horizontal line.

[protected] void HtmlVisitor::onImage(MD::Image<Trait> *i)

Handle image.

i Image.

[protected] void HtmlVisitor::onInlineCode(MD::Code<Trait> *c)

Handle inline code.

c Code.

[protected] void HtmlVisitor::onLineBreak(MD::LineBreak<Trait> *)

Handle line break.

Handle link.

l Link.

[protected] void HtmlVisitor::onList(MD::List<Trait> *l)

Handle list.

l List.

[protected] void HtmlVisitor::onListItem(MD::ListItem<Trait> *i, bool first)

Handle list item.

i List item.

first Is this item first in the list?

[protected] void HtmlVisitor::onMath(MD::Math<Trait> *m)

Handle LaTeX math expression.

m Math.

[protected] void HtmlVisitor::onParagraph(MD::Paragraph<Trait> *p, bool wrap)

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.

[protected] void HtmlVisitor::onRawHtml(MD::RawHtml<Trait> *h)

Handle raw HTML.

h Raw HTML.

[protected] void HtmlVisitor::onTable(MD::Table<Trait> *t)

Handle table.

t Table.

[protected] void HtmlVisitor::onText(MD::Text<Trait> *t)

Handle text item.

t Text.

[virtual protected] void HtmlVisitor::openStyle(const typename ItemWithOpts<Trait>::Styles &styles)

Insert into HTML tags for opening styles.

styles Styles.

[virtual protected] typename Trait::String HtmlVisitor::prepareTextForHtml(const typename Trait::String &t)

Prepare text to insert into HTML content.

t String.

[virtual protected] typename Trait::String HtmlVisitor::tableAlignmentToHtml(typename Table<Trait>::Alignment a)

Returns HTML content for table alignment.

a Alignment.

[virtual] typename Trait::String HtmlVisitor::toHtml(std::shared_ptr<MD::Document<Trait>> doc, const typename Trait::String &hrefForRefBackImage, bool wrappedInArticle = true)

Walk through the document.

doc Document.

hrefForRefBackImage String that will be applied as URL for image for back link from footnote.

wrappedInArticle Wrap HTML with <article> tag?

Member Variable Documentation

bool HtmlVisitor::m_dontIncrementFootnoteCount

Just process footnote references and don't increment count number.

typename Trait::template Vector<FootnoteRefStuff> HtmlVisitor::m_fns

Vector of processed footnotes references.

typename Trait::String HtmlVisitor::m_html

HTML content.

bool HtmlVisitor::m_isWrappedInArticle

Is this HTML wrapped in artcile tag?

bool HtmlVisitor::m_justCollectFootnoteRefs

Just collect footnote references?