<p><b>@b4n</b> commented on this pull request.</p>

<hr>

<p>In <a href="https://github.com/geany/geany-plugins/pull/502#pullrequestreview-8295647">markdown/src/plugin.c</a>:</p>
<pre style='color:#555'>> @@ -240,3 +250,47 @@ on_view_pos_notify(GObject *obj, GParamSpec *pspec, MarkdownViewer *viewer)
 
   update_markdown_viewer(viewer);
 }
+
+static void on_export_as_html_activate(GtkMenuItem *item, MarkdownViewer *viewer)
+{
+  GtkWidget *dialog;
+  GtkFileFilter *filter;
+
+  g_return_if_fail(DOC_VALID(document_get_current()));
+
+  dialog = gtk_file_chooser_dialog_new(_("Save HTML File As"),
+    GTK_WINDOW(geany_data->main_widgets->window), GTK_FILE_CHOOSER_ACTION_SAVE,
+    GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+    GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
+    NULL);
+  gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dialog), TRUE);
+  gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), FALSE);
</pre>
<p>I think multi-selection is disabled by default, and probably irrelevant for save too :)</p>

<hr>

<p>In <a href="https://github.com/geany/geany-plugins/pull/502#pullrequestreview-8295647">markdown/src/plugin.c</a>:</p>
<pre style='color:#555'>> +
+static void on_export_as_html_activate(GtkMenuItem *item, MarkdownViewer *viewer)
+{
+  GtkWidget *dialog;
+  GtkFileFilter *filter;
+
+  g_return_if_fail(DOC_VALID(document_get_current()));
+
+  dialog = gtk_file_chooser_dialog_new(_("Save HTML File As"),
+    GTK_WINDOW(geany_data->main_widgets->window), GTK_FILE_CHOOSER_ACTION_SAVE,
+    GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+    GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
+    NULL);
+  gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dialog), TRUE);
+  gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), FALSE);
+  gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), "index.html");
</pre>
<p>Maybe rather use <code>basename(DOC_FILENAME(doc)) + ".html"</code>?</p>

<hr>

<p>In <a href="https://github.com/geany/geany-plugins/pull/502#pullrequestreview-8295647">markdown/src/plugin.c</a>:</p>
<pre style='color:#555'>> +
+  g_return_if_fail(DOC_VALID(document_get_current()));
+
+  dialog = gtk_file_chooser_dialog_new(_("Save HTML File As"),
+    GTK_WINDOW(geany_data->main_widgets->window), GTK_FILE_CHOOSER_ACTION_SAVE,
+    GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+    GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
+    NULL);
+  gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dialog), TRUE);
+  gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), FALSE);
+  gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), "index.html");
+
+  filter = gtk_file_filter_new();
+  gtk_file_filter_set_name(filter, _("HTML Files"));
+  gtk_file_filter_add_pattern(filter, "*.html");
+  gtk_file_filter_add_pattern(filter, "*.htm");
</pre>
<p>maybe rather use <code>gtk_file_filter_add_mime_type(filter, "text/html");</code>?</p>

<hr>

<p>In <a href="https://github.com/geany/geany-plugins/pull/502#pullrequestreview-8295647">markdown/src/plugin.c</a>:</p>
<pre style='color:#555'>> +  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);
</pre>
<p>maybe re-show the save dialog in case of error?  I guess the most likely reason of failure is permission issue/invalid path, so I imagine the general action would be trying again.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/geany/geany-plugins/pull/502#pullrequestreview-8295647">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABDrJ8NvigJ2yvFCCfiWZkn-swpB6W9Gks5q9Yc4gaJpZM4KwOA-">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/ABDrJwnNdwe1I8Dj76U_26FgwFJ8Gn3kks5q9Yc4gaJpZM4KwOA-.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/geany/geany-plugins/pull/502#pullrequestreview-8295647"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/geany/geany-plugins","title":"geany/geany-plugins","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/geany/geany-plugins"}},"updates":{"snippets":[{"icon":"PERSON","message":"@b4n commented on #502"}],"action":{"name":"View Pull Request","url":"https://github.com/geany/geany-plugins/pull/502#pullrequestreview-8295647"}}}</script>