|
@@ -66,6 +66,24 @@ namespace GtkCommonMark {
|
|
|
reader.read_data(data);
|
|
|
}
|
|
|
|
|
|
+ public async void load_from_stream_async(InputStream stream) throws IOError {
|
|
|
+ var reader = new GtkCommonMark.Reader(buffer, this, tag_manager);
|
|
|
+ reader.widget_embedded.connect(on_widget_embedded);
|
|
|
+
|
|
|
+ MemoryOutputStream os = new MemoryOutputStream (null, GLib.realloc, GLib.free);
|
|
|
+ yield os.splice_async (stream, OutputStreamSpliceFlags.CLOSE_TARGET, Priority.DEFAULT);
|
|
|
+ var data = os.steal_data();
|
|
|
+ data.length = (int) os.get_data_size ();
|
|
|
+ reader.read_data(data);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void load_from_string(string markdown) {
|
|
|
+ var reader = new GtkCommonMark.Reader(buffer, this, tag_manager);
|
|
|
+ reader.widget_embedded.connect(on_widget_embedded);
|
|
|
+
|
|
|
+ reader.read_data((uint8[])markdown.to_utf8());
|
|
|
+ }
|
|
|
+
|
|
|
protected string? link_at_buffer_location(int x, int y) {
|
|
|
Gtk.TextIter iter;
|
|
|
get_iter_at_location(out iter, x, y);
|