MarkdownToHtmlTranspiler/lib/inlineNode.cpp
2025-10-17 13:50:29 -07:00

26 lines
642 B
C++

#include "inlineNode.h"
#include <memory>
#include <stdexcept>
#include <string>
using std::string;
void InlineNode::AddChild(std::unique_ptr<Node> child) {
throw std::runtime_error("Cannot add a child to an InlineNode.");
}
string TextNode::ToHtml() const { return this->content; }
string ItalicNode::ToHtml() const { return "<em>" + this->content + "</em>"; }
string BoldNode::ToHtml() const {
return "<strong>" + this->content + "</strong>";
}
string BoldItalicNode::ToHtml() const {
return "<strong><em>" + this->content + "</em></strong>";
}
string CodeNode::ToHtml() const { return "<code>" + this->content + "</code>"; }