Exemplo n.º 1
0
        private async Task <string> RenderContentAsync(string markdown, DocumentMetaData metaData, HashSet <string> mediaFiles, int slot)
        {
            var body = await _markdownParser.ParseAsync(markdown);

            // Hack: Replace all links to .md files with links to .html files,
            // as we're changing the extension of the files during local generation.
            body = body.Replace(".md)", ".html)")
                   .Replace(".md\"", ".html\"")
                   .Replace(".md#", ".html#");

            var sb = new StringBuilder();

            sb.AppendLine($"<div class=\"example-content-preview example-content-preview-slot-{slot}\">");
            sb.AppendLine(GetPreviewVideo(mediaFiles));
            sb.AppendLine("</div>");
            sb.AppendLine("<div class=\"example-content-body\">");
            sb.AppendLine(body);
            sb.AppendLine("</div>");
            return(sb.ToString());
        }