Force Jupyter kernel rendering result as markdown

I’m writing a new Jupyter kernel. The default output of the code cell is text, like this one:

   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/CU7S_yTVLpE\" allowfullscreen></iframe>"
     ]
    }
   ]

However, I want to render the result as the markdown. Is there any chance to do this?

Sorry for being annoying.

Actually, I just changed this piece of code when printing out the result

self.send_response(self.iopub_socket, "stream", {"name": "stdout", "text": contents})

to

send_response(self.iopub_socket, 
                           'display_data',
                           {
                            'data':{
                               'text/markdown': contents
                                },
                            'metadata': {}
                           }
                          )