Allow custom tag processing in md
This commit is contained in:
parent
22157169c0
commit
101bfb4207
12 changed files with 214 additions and 43 deletions
|
@ -3,6 +3,7 @@
|
|||
#include "MarkdownParser.h"
|
||||
#include "MarkdownDocument.h"
|
||||
#include "MarkdownElement.h"
|
||||
#include "MarkdownCustomElement.h"
|
||||
|
||||
#include "File.h"
|
||||
|
||||
|
@ -37,9 +38,20 @@ std::pair<MarkdownContentParser::FileMetadata, std::unique_ptr<MarkdownDocument>
|
|||
}
|
||||
|
||||
MarkdownParser md_parser;
|
||||
auto content = md_parser.run(content_body);
|
||||
|
||||
return {output_metadata, std::move(content)};
|
||||
auto document = std::make_unique<MarkdownDocument>();
|
||||
|
||||
auto custom_math_inline = std::make_unique<MarkdownCustomInlineElementContext>("$");
|
||||
custom_math_inline->setReplacementDelimiters("\\(", "\\)");
|
||||
|
||||
auto custom_math_multiline = std::make_unique<MarkdownCustomMultilineElementContext>("$$");
|
||||
|
||||
document->registerCustomInlineElement(std::move(custom_math_inline));
|
||||
document->registerCustomMultilineElement(std::move(custom_math_multiline));
|
||||
|
||||
md_parser.run(content_body, document.get());
|
||||
|
||||
return {output_metadata, std::move(document)};
|
||||
}
|
||||
|
||||
std::optional<MarkdownContentParser::FileMetadataItem> MarkdownContentParser::checkForMetadataItem(const std::string& line) const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue