title: draftjs entity Content State to HTML
body: <p>I am using draftjs in which users can type in anything and can also click a button on which I am inserting a IMMUTABLE entity.</p>
  <pre><code>const text = &quot;foo&quot;;
  
  const editorState = this.state.value;
  const selectionState = editorState.getSelection();
  const contentState = editorState.getCurrentContent();
  const contentStateWithEntity = contentState.createEntity(&quot;TOKEN&quot;, &quot;IMMUTABLE&quot;, { time: new Date().getTime() });
  const entityKey = contentStateWithEntity.getLastCreatedEntityKey();
  const modifiedContent = Modifier.insertText(contentState, selectionState, text, OrderedSet([ &quot;INSERT&quot; ]), entityKey);
  const nextState = EditorState.push( editorState, modifiedContent, editorState.getLastChangeType() );
  
  this.setState({value: nextState}, this.focus );
  </code></pre>
  <p><a href="https://codepen.io/dakridge/pen/XgLWJQ" rel="nofollow noreferrer">https://codepen.io/dakridge/pen/XgLWJQ</a></p>
  <p>All this is working fine but when the editor state is saved and now I am trying to render the HTML from the saved ContentState in my webpage then I am not able to identify the immutable entity and apply styles to it or render it differently.</p>
  <p>For ex, in the above example how can foo be rendered with a different color and how the saved timestamp say can be logged in the console when I hover over foo?</p>
  <p>I am using draftjs-to-html to render html from draftjs output.</p>