I'm using Drupal 8.1.1 with Acquia's Lightning distribution. I need to be able to embed a media entity (a tweet, instagram post, youtube video, image, etc.) and then captured the resultant HTML output in a hook. However, $node->body->value just gives me a weird markup like this:
<drupal-entity data-align=\"none\" data-caption=\"\" data-embed-button=\"media_library\" data-entity-embed-display=\"entity_reference:entity_reference_entity_view\" data-entity-embed-settings=\"{"view_mode":"media_library"}\" data-entity-id=\"21\" data-entity-type=\"media\" data-entity-uuid=\"ea90ea95-6b7e-4e44-a1a6-4e7baabe3cb7\"></drupal-entity>\r\n"
And rendering the entity through the renderer service gives me the entire output of the node, rather than just the html equivalent of the aforementioned markup.
Is there any way to parse this output and get the actual HTML of the embedded entity?