1

I try to use PyQt5.14 to show markdown content, but some content not showing and it looks like different as usual?

The Code:

from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from urllib import request


class Demo(QTextEdit):
    def __init__(self):
        super().__init__()
        md = self.get_markdown()
        self.setMarkdown(md)

    def get_markdown(self):
        url = 'https://raw.githubusercontent.com/PyQt5/PyQt/master/README.md'
        response = request.urlopen(url)
        return response.read().decode()

app = QApplication([])
demo = Demo()
demo.show()
app.exec()

Origin::

After Render:

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
jett chen
  • 1,067
  • 16
  • 33
  • 2
    QTextEdit does not support external resources so it does not render the images, I recommend using Qt WebEngine in that case: https://doc.qt.io/qt-5/qtwebengine-webenginewidgets-markdowneditor-example.html – eyllanesc Dec 26 '19 at 07:24
  • I try to buy a coffee `https://www.buymeacoffee.com/eyllanesc`, but i can't use my unionpay to pay with paypay, it show unionpay had refuse my transaction error. – jett chen Dec 26 '19 at 08:22
  • I had donate you with my paypay account. – jett chen Dec 26 '19 at 08:39

0 Answers0