Skip to content

Commit 1ed268c

Browse files
committed
Begin adding support for Markdown in special blocks (#23) [WIP]
1 parent edf4dae commit 1ed268c

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

src/reader/md4c-reader.vala

+24-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,30 @@ namespace My
183183
self.node_ = self.node_.parent;
184184
}
185185

186-
// TODO? check here that the block we are leaving has the type we expect?
186+
// Postprocess special blocks
187+
while(self.node_.data.ty == BLOCK_SPECIAL) { //do once
188+
// Render the block's contents back to Markdown (TODO find a
189+
// better way)
190+
string inner_contents = "";
191+
192+
193+
// Parse the text
194+
var inner_reader = new MarkdownMd4cReader();
195+
// TODO copy reader options from this to inner_reader
196+
197+
Doc inner_doc = null;
198+
try {
199+
inner_doc = inner_reader.read_string(inner_contents);
200+
} catch(MarkupError e) {
201+
lwarningo(self.node_,
202+
"Could not parse special block's contents as Markdown: %s",
203+
e.message);
204+
break;
205+
}
206+
207+
// Replace the special block's children with the results
208+
// of parsing the inner text
209+
}
187210

188211
// Leave the current block
189212
self.node_ = self.node_.parent;

0 commit comments

Comments
 (0)