Skip to content

MarkupString should be respected in .cshtml files #61239

@leotsarev

Description

@leotsarev

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

I have solution with a mix of .cshtml and .razor files (moving from MVC to mixed MVC/Razor components). I have a paradigm where my view models have HtmlString/IHtmlContent fields that could be correctly displayed in .cshtml files just be directly referencing.

HtmlString/IHtmlContent doesn't supported in Razor component, so I have to use MarkupString there.
MarkupString is more lightweight marker concept, and doesn't require framework reference to whole ASP.NET server — I like it.

However, .cshtml renderer doesn't support MarkupString, so I have to manually add Html.Raw here. I don't like it.

Describe the solution you'd like

  1. MarkupString supported in .cshtml files and doesn't re-encoded.
  2. Ideally, MarkupString moved even higher in dependecies stack into some MS.Ext. assembly, totally untied from ASP.NET and will become universally recognized "html marker" class.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-ui-renderingIncludes: MVC Views/Pages, Razor Views/Pages

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions