diff --git a/cicm_web/Models/Company.cs b/cicm_web/Models/Company.cs index db9414a7..7762a434 100644 --- a/cicm_web/Models/Company.cs +++ b/cicm_web/Models/Company.cs @@ -32,6 +32,7 @@ using System; using System.Collections.Generic; using System.Linq; using Cicm.Database.Schemas; +using Markdig; namespace cicm_web.Models { @@ -60,6 +61,7 @@ namespace cicm_web.Models public static CompanyWithItems GetItem(int id) { Cicm.Database.Schemas.Company dbItem = Program.Database?.Operations.GetCompany(id); + MarkdownPipeline pipeline = new Markdig.MarkdownPipelineBuilder().UseAdvancedExtensions().Build(); return dbItem == null ? null @@ -83,7 +85,7 @@ namespace cicm_web.Models Website = dbItem.Website, Logos = dbItem.Logos, LastLogo = dbItem.LastLogo, - Description = dbItem.Description + Description = dbItem.Description == null ? null : Markdig.Markdown.ToHtml(dbItem.Description, pipeline) }; } @@ -92,6 +94,7 @@ namespace cicm_web.Models List dbItems = null; bool? result = Program.Database?.Operations.GetCompanies(out dbItems); if(result == null || result.Value == false || dbItems == null) return null; + MarkdownPipeline pipeline = new Markdig.MarkdownPipelineBuilder().UseAdvancedExtensions().Build(); return dbItems.Select(t => new CompanyWithItems { @@ -113,7 +116,7 @@ namespace cicm_web.Models Website = t.Website, Logos = t.Logos, LastLogo = t.LastLogo, - Description = t.Description + Description = t.Description == null ? null : Markdig.Markdown.ToHtml(t.Description, pipeline) }).OrderBy(t => t.Name).ToArray(); } @@ -122,6 +125,7 @@ namespace cicm_web.Models List dbItems = null; bool? result = Program.Database?.Operations.GetCompanies(out dbItems); if(result == null || result.Value == false || dbItems == null) return null; + MarkdownPipeline pipeline = new Markdig.MarkdownPipelineBuilder().UseAdvancedExtensions().Build(); return dbItems .Where(t => t.Name.StartsWith(new string(letter, 1), StringComparison.InvariantCultureIgnoreCase)) @@ -145,7 +149,7 @@ namespace cicm_web.Models Website = t.Website, Logos = t.Logos, LastLogo = t.LastLogo, - Description = t.Description + Description = t.Description == null ? null : Markdig.Markdown.ToHtml(t.Description, pipeline) }).OrderBy(t => t.Name).ToArray(); } } diff --git a/cicm_web/Views/Company/View.cshtml b/cicm_web/Views/Company/View.cshtml index dd488a72..db179ee0 100644 --- a/cicm_web/Views/Company/View.cshtml +++ b/cicm_web/Views/Company/View.cshtml @@ -33,6 +33,7 @@ } @using System.IO @using Cicm.Database.Schemas +@using Markdig @model CompanyWithItems @if(Model != null) @@ -431,7 +432,7 @@ @if(Model.Description != null) {
- @Model.Description + @Html.Raw(Model.Description)
} diff --git a/cicm_web/cicm_web.csproj b/cicm_web/cicm_web.csproj index 1e7ff99f..72764886 100644 --- a/cicm_web/cicm_web.csproj +++ b/cicm_web/cicm_web.csproj @@ -2,7 +2,7 @@ netcoreapp2.0 - 3.0.99.150 + 3.0.99.153 Canary Islands Computer Museum Copyright © 2003-2018 Natalia Portillo Canary Islands Computer Museum Website @@ -14,6 +14,7 @@ true +