Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. MarkdownDialectGitHub
Qt 6.11 is out! See what's new in the release blog

MarkdownDialectGitHub

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 632 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by A Former User
    #1

    The cardinal rule of good programming is, never put unexplained literal numbers in code, because nobody knows what they mean and it causes confusion and "WTF"'s.

    Case in point in Qt 5:

        MarkdownDialectGitHub = 0x0004 | 0x0008 | 0x0400 | 0x0100 | 0x0200 | 0x0800
    

    Whatever do these numbers mean? Are they deep secrets that only James Bond can decode?

    JonBJ 1 Reply Last reply
    0
    • ? A Former User

      The cardinal rule of good programming is, never put unexplained literal numbers in code, because nobody knows what they mean and it causes confusion and "WTF"'s.

      Case in point in Qt 5:

          MarkdownDialectGitHub = 0x0004 | 0x0008 | 0x0400 | 0x0100 | 0x0200 | 0x0800
      

      Whatever do these numbers mean? Are they deep secrets that only James Bond can decode?

      JonBJ Online
      JonBJ Online
      JonB
      wrote on last edited by
      #2

      @clarify
      The "answer" is in class Q_GUI_EXPORT QTextMarkdownImporter https://codebrowser.dev/qt6/qtbase/src/gui/text/qtextmarkdownimporter_p.h.html#QTextMarkdownImporter::Feature

          enum Feature {
              FeatureCollapseWhitespace =       0x0001,
              FeaturePermissiveATXHeaders =     0x0002,
              FeaturePermissiveURLAutoLinks =   0x0004,
              FeaturePermissiveMailAutoLinks =  0x0008,
              FeatureNoIndentedCodeBlocks =     0x0010,
              FeatureNoHTMLBlocks =             0x0020,
              FeatureNoHTMLSpans =              0x0040,
              FeatureTables =                   0x0100,
              FeatureStrikeThrough =            0x0200,
              FeaturePermissiveWWWAutoLinks =   0x0400,
              FeatureTasklists =                0x0800,
              FeatureUnderline =                0x4000,
              // composite flags
              FeaturePermissiveAutoLinks = FeaturePermissiveMailAutoLinks
                  | FeaturePermissiveURLAutoLinks | FeaturePermissiveWWWAutoLinks,
              FeatureNoHTML = QTextDocument::MarkdownNoHTML,
              DialectCommonMark = QTextDocument::MarkdownDialectCommonMark,
              DialectGitHub = QTextDocument::MarkdownDialectGitHub
          };
      
      ? 1 Reply Last reply
      0
      • JonBJ JonB

        @clarify
        The "answer" is in class Q_GUI_EXPORT QTextMarkdownImporter https://codebrowser.dev/qt6/qtbase/src/gui/text/qtextmarkdownimporter_p.h.html#QTextMarkdownImporter::Feature

            enum Feature {
                FeatureCollapseWhitespace =       0x0001,
                FeaturePermissiveATXHeaders =     0x0002,
                FeaturePermissiveURLAutoLinks =   0x0004,
                FeaturePermissiveMailAutoLinks =  0x0008,
                FeatureNoIndentedCodeBlocks =     0x0010,
                FeatureNoHTMLBlocks =             0x0020,
                FeatureNoHTMLSpans =              0x0040,
                FeatureTables =                   0x0100,
                FeatureStrikeThrough =            0x0200,
                FeaturePermissiveWWWAutoLinks =   0x0400,
                FeatureTasklists =                0x0800,
                FeatureUnderline =                0x4000,
                // composite flags
                FeaturePermissiveAutoLinks = FeaturePermissiveMailAutoLinks
                    | FeaturePermissiveURLAutoLinks | FeaturePermissiveWWWAutoLinks,
                FeatureNoHTML = QTextDocument::MarkdownNoHTML,
                DialectCommonMark = QTextDocument::MarkdownDialectCommonMark,
                DialectGitHub = QTextDocument::MarkdownDialectGitHub
            };
        
        ? Offline
        ? Offline
        A Former User
        wrote on last edited by A Former User
        #3

        @JonB That would explain why my underlined text is showing up as italic.
        Github dialect doesn't have 0x4000.

        But Qt 5 doesn't seem to have QTextMarkdownImporter.

        And weirdly: MarkdownDialectCommonMark = 0

        1 Reply Last reply
        0
        • System has marked this topic as solved on

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved