title: Render ViewComponent inside html string
body: <p>Lets say I have a ViewComponent named MyComponent.</p>
  
  <p>As of ASP.NET Core 1.1 I can render this ViewComponent by writing this inside a razor view .cshtml page:</p>
  
  <pre><code> &lt;vc:my-component&gt;&lt;/vc:my-component&gt;
  </code></pre>
  
  <p>I want to do something like this:</p>
  
  <pre><code>@{string myHtml = "&lt;vc:my-component&gt;&lt;/vc:my-component&gt;";}
  
  @(new HtmlString(myHtml))
  </code></pre>
  
  <p>I installed and tried RazorEngine by doing this, but this did not work:</p>
  
  <pre><code>string template = "&lt;vc:my-component&gt;&lt;/vc:my-component&gt;";
  var result = Engine.Razor.RunCompile(template, "messageTemplateKey", null, new { Name = "some model data" });
  ViewBag.result = result;
  </code></pre>
  
  <p>then in the .chtml file:</p>
  
  <pre><code> @(new HtmlString(ViewBag.result))
  </code></pre>
  
  <p>The backstory to this is that I've created a ViewComponent with some logic on how to handle image files, now I want to search and replace all img tags in some html with my ViewComponent. Before I do that I need to make sure this even works.</p>