docstr: Method called on each block to highlight it content
docstr_tok: ["Method","called","on","each","block","to","highlight","it","content"]
code: def highlight(self, block):
      """Method called on each block to highlight it content"""
      tokens = pygments.lex(block, self.python_lexer)
      if self.format_rst:
          from pygments.token import Token
  
          toks = []
          for token in tokens:
              if token[0] == Token.String.Doc and len(token[1]) > 6:
                  toks += pygments.lex(token[1][:3], self.python_lexer)
                  # parse doc string content by rst lexer
                  toks += pygments.lex(token[1][3:-3], self.rst_lexer)
                  toks += pygments.lex(token[1][-3:], self.python_lexer)
              elif token[0] == Token.Comment.Single:
                  toks.append((Token.Comment.Single, token[1][0]))
                  # parse comment content by rst lexer
                  # remove the extra newline added by rst lexer
                  toks += list(
                      pygments.lex(token[1][1:], self.rst_lexer)
                  )[:-1]
              else:
                  toks.append(token)
          tokens = toks
      return pygments.format(tokens, self.formatter)
  
imports: import os
  import re
  import shlex
  import sys
  import pygments
  from pathlib import Path
  from IPython.utils.text import marquee
  from IPython.utils import openpy
  from IPython.utils import py3compat
label_desc: Use image node_id 19 for calling the Demo obj's underlying member method code with example usage: obj.highlight(block) and returns: pygments