code: def _highlight_line_difflib(self, line, next):
          
  
          if line['action'] == 'del':
              old, new = line, next
          else:
              old, new = next, line
  
          oldwords = re.split(r'(\W)', old['line'])
          newwords = re.split(r'(\W)', new['line'])
  
          sequence = difflib.SequenceMatcher(None, oldwords, newwords)
  
          oldfragments, newfragments = [], []
          for tag, i1, i2, j1, j2 in sequence.get_opcodes():
              oldfrag = ''.join(oldwords[i1:i2])
              newfrag = ''.join(newwords[j1:j2])
              if tag != 'equal':
                  if oldfrag:
                      oldfrag = '<del>%s</del>' % oldfrag
                  if newfrag:
                      newfrag = '<ins>%s</ins>' % newfrag
              oldfragments.append(oldfrag)
              newfragments.append(newfrag)
  
          old['line'] = "".join(oldfragments)
          new['line'] = "".join(newfragments)
docs: Highlight inline changes in both lines.