Browse Source

Docs module: option to disable section rendering

pull/4842/head
Yunus Emre Kalkan 6 years ago
parent
commit
4f57c823c8
  1. 6
      modules/docs/src/Volo.Docs.Web/DocsUiOptions.cs
  2. 11
      modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml.cs

6
modules/docs/src/Volo.Docs.Web/DocsUiOptions.cs

@ -21,6 +21,12 @@ namespace Volo.Docs
/// </summary>
public bool ShowProjectsCombobox = true;
/// <summary>
/// If true, allows to create sections in document and show/hide sections according to user preferences.
/// Default value: True;
/// </summary>
public bool SectionRendering = true;
private string GetFormattedRoutePrefix()
{
if (string.IsNullOrWhiteSpace(_routePrefix))

11
modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml.cs

@ -405,12 +405,15 @@ namespace Volo.Docs.Pages.Documents.Project
private async Task ConvertDocumentContentToHtmlAsync()
{
await SetDocumentPreferencesAsync();
SetUserPreferences();
if (_uiOptions.SectionRendering)
{
await SetDocumentPreferencesAsync();
SetUserPreferences();
var partialTemplates = await GetDocumentPartialTemplatesAsync();
var partialTemplates = await GetDocumentPartialTemplatesAsync();
Document.Content = await _documentSectionRenderer.RenderAsync(Document.Content, UserPreferences, partialTemplates);
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);

Loading…
Cancel
Save