多行输出html

时间:2018-01-10 05:25:58

标签: c# html asp.net razor

我正在使用Skybrud Social获取Instagram Feed。

我从Feed中获得的标题如下所示:

Line 1

Line 2

Line 3

当我输出到html时,它将是

Line 1 Line 2 Line 3

如何制作它以便像第一个一样显示?

s = CurrentPage;
Skybrud.Social.Umbraco.Instagram.PropertyEditors.OAuth.InstagramOAuthData client = s.ig;
var service = InstagramService.CreateFromAccessToken(client.AccessToken);
var response = service.Tags.GetRecentMedia("invitation",10);
foreach (Skybrud.Social.Instagram.Objects.InstagramMedia mediaig in response.Body.Data)
{
   <div class="col-md-4">    
       <div class="row" >
           <a class="template" href="@mediaig.Link">
               <div class="col-xs-12 templateIconDiv">
                   <div class="templateIconDivContainer">
                       <img class="templateIcon" 
                       src="@mediaig.Images.StandardResolution.Url">
                   </div>        
                   <div class="col-xs-12 templateName">
                       @Html.Raw(mediaig.Caption.Text)
                   </div>              

               </div>
           </a>
       </div>
   </div>
}

1 个答案:

答案 0 :(得分:0)

已修复

   <div class="col-xs-12 templateName" style="white-space: pre-line;">
                   @Html.Raw(mediaig.Caption.Text)
               </div>