[Github-comments] [geany/geany-plugins] Markdown: Allow exporting Markdown as HTML (#502)

Matthew Brush notifications at xxxxx
Sat Nov 12 20:23:07 UTC 2016


codebrainz commented on this pull request.



> +  gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter);
+
+  filter = gtk_file_filter_new();
+  gtk_file_filter_set_name(filter, _("All Files"));
+  gtk_file_filter_add_pattern(filter, "*");
+  gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter);
+
+  if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
+    gchar *fn = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
+    gchar *html = markdown_viewer_get_html(viewer);
+    GError *error = NULL;
+    if (! g_file_set_contents(fn, html, -1, &error)) {
+      dialogs_show_msgbox(GTK_MESSAGE_ERROR,
+        _("Failed to export Markdown HTML to file '%s': %s"),
+        fn, error->message);
+      g_error_free(error);

Good idea.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/pull/502
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20161112/ae20a329/attachment.html>


More information about the Github-comments mailing list