def record_markdown(text, cellid):
from acorn.logging.database import record<EOL>from time import time<EOL>ekey = "<STR_LIT>".format(cellid)<EOL>global _cellid_map<EOL>if cellid not in _cellid_map:<EOL><INDENT>from acorn.logging.database import active_db<EOL>from difflib import SequenceMatcher<EOL>from acorn.logging.diff import cascade<EOL>taskdb = active_db()<EOL>if ekey not in taskdb.entities:<EOL><INDENT>possible = [k for k in taskdb.entities if k[<NUM_LIT:0>:<NUM_LIT:3>] == "<STR_LIT>"]<EOL>maxkey, maxvalue = None, <NUM_LIT:0.><EOL>for pkey in possible:<EOL><INDENT>sequence = [e["<STR_LIT:c>"] for e in taskdb.entities[pkey]]<EOL>state = '<STR_LIT>'.join(cascade(sequence))<EOL>matcher = SequenceMatcher(a=state, b=text)<EOL>ratio = matcher.quick_ratio()<EOL>if ratio > maxvalue and ratio > <NUM_LIT:0.5>:<EOL><INDENT>maxkey, maxvalue = pkey, ratio<EOL><DEDENT><DEDENT>if maxkey is not None:<EOL><INDENT>ekey = pkey<EOL><DEDENT><DEDENT>_cellid_map[cellid] = ekey<EOL><DEDENT>ekey = _cellid_map[cellid]        <EOL>entry = {<EOL>"<STR_LIT:m>": "<STR_LIT>",<EOL>"<STR_LIT:a>": None,<EOL>"<STR_LIT:s>": time(),<EOL>"<STR_LIT:r>": None,<EOL>"<STR_LIT:c>": text,<EOL>}<EOL>record(ekey, entry, diff=True)<EOL>
Records the specified markdown text to the acorn database.

    Args:
        text (str): the *raw* markdown text entered into the cell in the ipython
          notebook.