eric6/UI/Previewers/PreviewerHTML.py

changeset 8260
2161475d9639
parent 8243
cc717c2ae956
child 8273
698ae46f40a4
equal deleted inserted replaced
8259:2bbec88047dd 8260:2161475d9639
236 self.__saveScrollBarPositions() 236 self.__saveScrollBarPositions()
237 self.previewView.page().loadFinished.connect( 237 self.previewView.page().loadFinished.connect(
238 self.__restoreScrollBarPositions) 238 self.__restoreScrollBarPositions)
239 if not filePath: 239 if not filePath:
240 filePath = "/" 240 filePath = "/"
241 if rootPath: 241 baseUrl = (
242 baseUrl = QUrl.fromLocalFile(rootPath + "/index.html") 242 QUrl.fromLocalFile(rootPath + "/index.html")
243 else: 243 if rootPath else
244 baseUrl = QUrl.fromLocalFile(filePath) 244 QUrl.fromLocalFile(filePath)
245 )
245 self.previewView.setHtml(html, baseUrl=baseUrl) 246 self.previewView.setHtml(html, baseUrl=baseUrl)
246 if self.__previewedEditor: 247 if self.__previewedEditor:
247 self.__previewedEditor.setFocus() 248 self.__previewedEditor.setFocus()
248 249
249 @pyqtSlot(str) 250 @pyqtSlot(str)
764 mermaid_initialize = "" 765 mermaid_initialize = ""
765 766
766 htmlFormat = Preferences.getEditor("PreviewMarkdownHTMLFormat").lower() 767 htmlFormat = Preferences.getEditor("PreviewMarkdownHTMLFormat").lower()
767 body = markdown.markdown(text, extensions=extensions, 768 body = markdown.markdown(text, extensions=extensions,
768 output_format=htmlFormat.lower()) 769 output_format=htmlFormat.lower())
769 if e5App().usesDarkPalette(): 770 style = (
770 style = ( 771 (PreviewerHTMLStyles.css_markdown_dark +
771 PreviewerHTMLStyles.css_markdown_dark + 772 PreviewerHTMLStyles.css_pygments_dark)
772 PreviewerHTMLStyles.css_pygments_dark 773 if e5App().usesDarkPalette() else
773 ) 774 (PreviewerHTMLStyles.css_markdown_light +
774 else: 775 PreviewerHTMLStyles.css_pygments_light)
775 style = ( 776 )
776 PreviewerHTMLStyles.css_markdown_light +
777 PreviewerHTMLStyles.css_pygments_light
778 )
779 777
780 if htmlFormat == "xhtml1": 778 if htmlFormat == "xhtml1":
781 head = ( 779 head = (
782 '''<!DOCTYPE html PUBLIC "-//W3C//DTD''' 780 '''<!DOCTYPE html PUBLIC "-//W3C//DTD'''
783 ''' XHTML 1.0 Transitional//EN"\n''' 781 ''' XHTML 1.0 Transitional//EN"\n'''

eric ide

mercurial