def preview(self, settingsWidget, previewWidget): settings = settingsWidget.getSettings() # Save settings settingsWidget.writeSettings() md = markdown.output(self, settingsWidget) html = MD.markdown(md) path = os.path.join(self.projectPath(), "dummy.html") self.preparesTextEditView(previewWidget.widget(0), settings["Preview"]["PreviewFont"]) self.preparesTextEditViewMarkdown(previewWidget.widget(0), settings) previewWidget.widget(0).setPlainText(md) self.preparesTextEditView(previewWidget.widget(1), settings["Preview"]["PreviewFont"]) previewWidget.widget(1).setPlainText(html) previewWidget.widget(2).setHtml(html, QUrl.fromLocalFile(path))
def preview(self, settingsWidget, previewWidget): settings = settingsWidget.getSettings() # Save settings settingsWidget.writeSettings() md = markdown.output(self, settingsWidget) html = MD.markdown(md) path = os.path.join(self.projectPath(), "dummy.html") self.preparesTextEditView(previewWidget.widget(0), settings["Preview"]["PreviewFont"]) self.preparesTextEditViewMarkdown(previewWidget.widget(0), settings) previewWidget.widget(0).setPlainText(md) self.preparesTextEditView(previewWidget.widget(1), settings["Preview"]["PreviewFont"]) previewWidget.widget(1).setPlainText(html) w2 = previewWidget.widget(2) if isinstance(w2, QTextEdit): w2.setHtml(html) else: w2.setHtml(html, QUrl.fromLocalFile(path))
def src(self, settingsWidget): return markdown.output(self, settingsWidget)
def output(self, settingsWidget): html = MD.markdown(markdown.output(self, settingsWidget)) return html