-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Markdown: Allow exporting Markdown as HTML #502
Conversation
Add a Tools menu item "Export Markdown as HTML" to allow saving of the rendered HTML to disk instead of just the live preview. Closes geany#497
I optimistically added 1.29 milestone though none of the new strings are translated yet, feel free to ignore for next release in 2 days :) |
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think multi-selection is disabled by default, and probably irrelevant for save too :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, just being explicit.
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"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe rather use basename(DOC_FILENAME(doc)) + ".html"
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be nice, yeah.
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"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe rather use gtk_file_filter_add_mime_type(filter, "text/html");
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like a good idea if it does what it sounds like, is there similar for *
(All files)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure, but I'm afraid not
dialogs_show_msgbox(GTK_MESSAGE_ERROR, | ||
_("Failed to export Markdown HTML to file '%s': %s"), | ||
fn, error->message); | ||
g_error_free(error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea.
* Use the document's filename as the basis for the new HTML filename. * Properly setup the initial directory and suggested filename in the file chooser. * Re-run the file chooser after showing error message if saving fails.
Add a Tools menu item "Export Markdown as HTML" to allow saving of the rendered HTML to disk instead of just the live preview.
Closes #497