55 void startDocument()
override;
56 void endDocument()
override;
60 void endHeading(
int level)
override;
62 void startParagraph()
override;
63 void endParagraph()
override;
65 void startCodeBlock(
StringView language)
override;
67 void endCodeBlock()
override;
69 void startList(
bool ordered)
override;
70 void startListItem()
override;
71 void endListItem()
override;
72 void endList()
override;
74 void startBlockquote()
override;
75 void endBlockquote()
override;
77 void horizontalRule()
override;
95 void startEmphasis()
override;
96 void endEmphasis()
override;
97 void startStrong()
override;
98 void endStrong()
override;
99 void startDelete()
override;
100 void endDelete()
override;
103 void endLink()
override;
108 std::string&
output() {
return output_; }
109 const std::string& output()
const {
return output_; }
110 void clearOutput() { output_.clear(); }
114 bool isTableTruncate()
const {
return truncateCells_; }
118 void emitActiveStyles();
119 void emitStyleTransition(
int oldStyles,
int newStyles);
120 void emitBlockPrefix();
121 void outputCodeBlockGutter(
int lineNum);
124 std::string& curBuf() {
return inCell_ ? cellContent_ : output_; }
126 A_DISABLE_COPY(MarkdownANSI);
129 enum InlineStyle :
int
133 STYLE_ITALIC = 1 << 1,
135 STYLE_DELETE = 1 << 3,
142 BlockFrame() =
default;
143 BlockFrame(Type type) : type(type) {}
151 int activeStyles_ = STYLE_NONE;
154 std::vector<BlockFrame> blockStack_;
162 std::vector<ListFrame> listStack_;
164 bool inCodeBlock_ =
false;
165 int codeLineNumber_ = 0;
170 std::string rendered;
176 std::vector<CellData> cells;
177 bool isHeader =
false;
180 bool inTable_ =
false;
181 bool inTableHead_ =
false;
182 bool inCell_ =
false;
184 std::string cellContent_;
185 bool truncateCells_ =
true;
187 std::vector<RowData> tableRows_;
190 std::string linkUrl_;