Example #1
0
        private async Task ConvertDocumentContentToHtmlAsync()
        {
            if (_uiOptions.SectionRendering)
            {
                await SetDocumentPreferencesAsync();

                SetAlternativeOptionLinksAsync();
                SetUserPreferences();

                var partialTemplates = await GetDocumentPartialTemplatesAsync();

                Document.Content = await _documentSectionRenderer.RenderAsync(Document.Content, UserPreferences, partialTemplates);
            }

            var converter = _documentToHtmlConverterFactory.Create(Document.Format ?? Project.Format);
            var content   = converter.Convert(Project, Document, GetSpecificVersionOrLatest(), LanguageCode);

            content = HtmlNormalizer.ReplaceImageSources(
                content,
                Document.RawRootUrl,
                Document.LocalDirectory
                );

            content = HtmlNormalizer.WrapImagesWithinAnchors(content);

            //todo find a way to make it on client in prismJS configuration (eg: map C# => csharp)
            content = HtmlNormalizer.ReplaceCodeBlocksLanguage(
                content,
                "language-C#",
                "language-csharp"
                );

            Document.Content = content;
        }
Example #2
0
        private async Task ConvertDocumentContentToHtmlAsync()
        {
            await SetDocumentPreferencesAsync();

            SetUserPreferences();

            UserPreferences.Add("Document_Language_Code", LanguageCode);
            UserPreferences.Add("Document_Version", Version);

            Document.Content = await _documentSectionRenderer.RenderAsync(Document.Content, UserPreferences);

            var converter = _documentToHtmlConverterFactory.Create(Document.Format ?? Project.Format);
            var content   = converter.Convert(Project, Document, GetSpecificVersionOrLatest(), LanguageCode);

            content = HtmlNormalizer.ReplaceImageSources(
                content,
                Document.RawRootUrl,
                Document.LocalDirectory
                );

            //todo find a way to make it on client in prismJS configuration (eg: map C# => csharp)
            content = HtmlNormalizer.ReplaceCodeBlocksLanguage(
                content,
                "language-C#",
                "language-csharp"
                );

            Document.Content = content;
        }