#pragma once #include #include class MarkdownDocument; class MarkdownParagraph; class MarkdownParser { enum class DocumentState { NONE, IN_MULTILINEQUOTE }; enum class LineState { NONE, IN_HEADING, IN_INLINEQUOTE, IN_MULTILINE_TAG }; public: MarkdownParser(); ~MarkdownParser(); std::unique_ptr run(const std::string& content); private: void processLine(); void onMultilineQuote(); void onInlineQuote(); void onHeading(unsigned level); void onEmptyLine(); void onNewParagraph(); void onTextSpan(); std::pair onTick(unsigned tickCount); std::string mWorkingLine; std::string mLineContent; std::string mDocumentContent; std::string mMultilineTag; LineState mLineState {LineState::NONE}; DocumentState mDocumentState {DocumentState::NONE}; std::unique_ptr mWorkingParagraph{nullptr}; std::unique_ptr mMarkdownDocument; };