code: def blocks(self, lines):
          
          state = markdown.blockparser.State()
          blocks = []
  
          # We use three states: start, ``` and '\n'
          state.set('start')
  
          # index of current block
          currblock = 0
  
          for line in lines:
              line += '\n'
              if state.isstate('start'):
                  if line[:3] == '```':
                      state.set('```')
                  else:
                      state.set('\n')
                  blocks.append('')
                  currblock = len(blocks) - 1
              else:
                  marker = line[:3]  # Will capture either '\n' or '```'
                  if state.isstate(marker):
                      state.reset()
              blocks[currblock] += line
  
          return blocks
docs: Groups lines into markdown blocks