Skip to content

MLR124: Text() literal contains Pango markup that plain Text renders verbatim

qual reports MLR124 when a literal passed to plain Text contains a matching open/close pair of a validated Pango tag (b i u s sub sup tt big small span), e.g. <b>...</b>.

  • Default severity: warning
  • Minimum confidence: high
  • Implementation phase: 1
  • Fix: unsafe suggestion switching the constructor to MarkupText

Plain Text passes its string to Pango without markup parsing, so the tags appear verbatim in the rendered frame. MarkupText parses the same subset. A lone <, an unmatched tag, or a tag outside the validated subset (<html>) never fires. The class switch is UNSAFE because the rendered output changes and MarkupText must be importable at the call site.

Wrong:

Text("<b>bold</b> move")   # renders the tags literally

Right:

MarkupText("<b>bold</b> move")
Text("a < b and b > c")    # not markup: not reported