Using ServiceStack Markdown Razor, how can I create an HtmlHelper extension method that works like:
In your views you can now do:
@{
using (Html.BeginLink())
{
@Html.Raw("Hello World")
}
}
Which yields the result:
<a>Hello World</a>
from This StackOverflow Answer
ServiceStack Markdown Razor has no concept of ViewContext
, so I'm unsure how I'd get a Writer the same way as in the SO Answer.
UPDATE
I can get at the ViewPage's StringBuilder
directly from:
@{ this.ViewPage.Builder }
But is this the intended way to access it? If it was intended to directly access the StringBuilder, wouldn't the StringBuilder
be exposed from the HtmlHelper
in lieu of ViewData (from MVC)?