MD::YAMLBlockPlugin Class

template <typename Trait> class MD::YAMLBlockPlugin

Plugin for YAML header. More...

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

Public Functions

MD::BlockType id() const override
bool isItYou(typename Trait::InternalString &startLine, MD::StringListStream<Trait> &stream, long long emptyLinesBefore) override
long long linesCountOfLastBlock() const override
void process(MD::MdBlock<Trait> &fr, std::shared_ptr<MD::Block<Trait>> parent, std::shared_ptr<MD::Document<Trait>> doc, bool collectRefLinks) override

Detailed Description

Member Function Documentation

MD::BlockType YAMLBlockPlugin::id() const

Returns ID of a block.

bool YAMLBlockPlugin::isItYou(typename Trait::InternalString &startLine, MD::StringListStream<Trait> &stream, long long emptyLinesBefore)

Returns whether the given line is a start of a block that this plugin handles.

Note: Position of stream is on next line after startLine.

Note: After checking in stream next lines on return from this method stream should be in state what it was before.

startLine Start line.

stream Stream.

emptyLinesBefore Count of empty lines before. May be 0 even if there are empty lines before, but in this case you will get access to full stream. In case when not full stream is passed to this method you will get correct amount of empty lines before.

long long YAMLBlockPlugin::linesCountOfLastBlock() const

Returns count of lines in the last detected block of this type.

void YAMLBlockPlugin::process(MD::MdBlock<Trait> &fr, std::shared_ptr<MD::Block<Trait>> parent, std::shared_ptr<MD::Document<Trait>> doc, bool collectRefLinks)

Process a block.

fr Fragment of a document.

parent Parent where new block should be added.

doc Document.

collectRefLinks Indicates that this is first go through the document and we just collecting reference links. Most of block plugins may just do nothing when this flag is true.