Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-101031

markdown fenced code blocks end with unnecessary blank lines

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4: Low
    • Resolution: Done
    • Affects Version/s: 5.15.7, 6.3.0 Beta2
    • Fix Version/s: 6.3.1, 6.4.0 Beta1
    • Component/s: GUI: Text handling
    • Labels:
      None
    • Commits:
      ff153d9874 (qt/qtbase/dev) 567340e122 (qt/qtbase/6.3) 567340e122 (qt/tqtc-qtbase/6.3) ff153d9874 (qt/tqtc-qtbase/dev) 567340e122 (qt/qtbase/6.3.1)

      Description

      You can read markdown like this

      ```
      one line only
      ```
      

      and in the QTextBrowser/QTextEdit, there is already an extra blank line, which is an extra QTextBlock. It's visible if there is any special highlighting of code blocks in the editor (which can be done by making a subclass of QSyntaxHighlighter, as in https://github.com/ec1oud/nettebook/commit/ececcd6d04f22e3764ee6b90e5520495a18e9f48 ). And when you rewrite the markdown, this comes through as an extra blank line before the ending fence, but in html it's worse: something like

      <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'monospace';">one line only</span></pre>
      <pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'monospace';"><br /></pre>
      

      that is, a whole extra <pre> tag with all the cruft that comes with it. The blank line should be treated as part of the single <pre> if it's there; but in fact it shouldn't be there at all.

        Attachments

        For Gerrit Dashboard: QTBUG-101031
        # Subject Branch Project Status CR V

          Activity

            People

            Assignee:
            srutledg Shawn Rutledge
            Reporter:
            srutledg Shawn Rutledge
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews