Skip to content

Commit

Permalink
Docs module: option to disable section rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
yekalkan committed Jul 22, 2020
1 parent ba484e7 commit 4f57c82
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
6 changes: 6 additions & 0 deletions modules/docs/src/Volo.Docs.Web/DocsUiOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ public string RoutePrefix
/// </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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,12 +405,15 @@ private void SetLanguageSelectListItems()

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);
Expand Down

0 comments on commit 4f57c82

Please sign in to comment.