code: def record_markdown(text, cellid):
      
      from acorn.logging.database import record
      from time import time
      ekey = "nb-{}".format(cellid)
      
      global _cellid_map
      if cellid not in _cellid_map:
          from acorn.logging.database import active_db
          from difflib import SequenceMatcher
          from acorn.logging.diff import cascade
          taskdb = active_db()
          
          if ekey not in taskdb.entities:
              #Compute a new ekey if possible with the most similar markdown cell
              #in the database.
              possible = [k for k in taskdb.entities if k[0:3] == "nb-"]
              maxkey, maxvalue = None, 0.
              for pkey in possible:
                  sequence = [e["c"] for e in taskdb.entities[pkey]]
                  state = ''.join(cascade(sequence))
                  matcher = SequenceMatcher(a=state, b=text)
                  ratio = matcher.quick_ratio()
                  if ratio > maxvalue and ratio > 0.5:
                      maxkey, maxvalue = pkey, ratio
  
              #We expect the similarity to be at least 0.5; otherwise we decide
              #that it is a new cell.
              if maxkey is not None:
                  ekey = pkey
                              
          _cellid_map[cellid] = ekey
          
      ekey = _cellid_map[cellid]        
      entry = {
          "m": "md",
          "a": None,
          "s": time(),
          "r": None,
          "c": text,
      }
      record(ekey, entry, diff=True)
docs: Records the specified markdown text to the acorn database.
  
      Args:
          text (str): the *raw* markdown text entered into the cell in the ipython
            notebook.