Log in

Memo "syntax" for user System Manager


Here's some Python code:

    def _format_body(self, user, body_style):
        """Format message body"""

        msg = Text()
        syntax = False

        for block in backquote_match.split(self.msg):
            if syntax:
                lexer, block = block.split('\n', 1)
                msg += Syntax(block, lexer,
                              theme=user.syntax_theme).highlight(block)
            elif self.markup:
                if self.markup == 'enhanced':
                    block = parse_markup(block)

                msg += Text(style=body_style) + \
                    user.render_markup(block, self.emoji)
            elif not user.unicode:
                msg += Text(user.encode_str(block), style=body_style)
            else:
                msg += Text(block, style=body_style)

            syntax = not syntax

        return msg

Here's a link to Google.