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

Markdown smashes nested formatting inside lists

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.15.2
    • Fix Version/s: None
    • Component/s: GUI: Text handling
    • Labels:
      None
    • Platform/s:
      Linux/X11

      Description

      The same sequence as in QTBUG-91222 (calling QTextDocument::setMarkdown and then QTextDocument::toHtml) fails on the following Markdown:

      List:
      1. **Bold** and plain
      2. `code` and plain
      

      producing the following HTML:

      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
      <html><head><meta name="qrichtext" content="1" /><style type="text/css">
      p, li { white-space: pre-wrap; }
      </style></head><body style=" font-family:'DejaVu Sans Semi-Condensed'; font-size:11pt; font-weight:400; font-style:normal;">
      <p style=" margin-top:7px; margin-bottom:7px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">List:</p>
      <ol style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-weight:600;" style=" margin-top:7px; margin-bottom:7px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Bold and plain</li>
      <li style=" font-family:'monospace';" style=" margin-top:7px; margin-bottom:7px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">code and plain</li></ol></body></html>
      

      Apparently, the nested formatting that starts in the beginning of the bullet gets added as the style of the bullet itself, even when it's not the entire bullet formatted; moreover, it leads to redefinition of the `style` attribute which is not even valid HTML. Can be reproduced with both ordered and unordered lists. Quotes (`>`) are unaffected, producing correctly nested span elements inside indented p elements (why those are not blockquote elements is a separate question).

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            srutledg Shawn Rutledge
            Reporter:
            alexey.rusakov Alexey Rusakov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes