BlakePlugin.DocsRenderer
0.0.1-preview2
See the version list below for details.
dotnet add package BlakePlugin.DocsRenderer --version 0.0.1-preview2
NuGet\Install-Package BlakePlugin.DocsRenderer -Version 0.0.1-preview2
<PackageReference Include="BlakePlugin.DocsRenderer" Version="0.0.1-preview2" />
<PackageVersion Include="BlakePlugin.DocsRenderer" Version="0.0.1-preview2" />
<PackageReference Include="BlakePlugin.DocsRenderer" />
paket add BlakePlugin.DocsRenderer --version 0.0.1-preview2
#r "nuget: BlakePlugin.DocsRenderer, 0.0.1-preview2"
#:package BlakePlugin.DocsRenderer@0.0.1-preview2
#addin nuget:?package=BlakePlugin.DocsRenderer&version=0.0.1-preview2&prerelease
#tool nuget:?package=BlakePlugin.DocsRenderer&version=0.0.1-preview2&prerelease
BlakePlugin.DocsRenderer
A plugin for Blake that adds scrollspy, TOC navigation, and beautiful code blocks to your documentation.
Features
- In-page navigation with scrollspy
- Document sectioning
- Custom Prism code rendering
- Customizable styles
- Includes default Bootstrap styles (works with the default Blazor template)
- Default Razor components for navigation and sectioning
How it works
The plugin adds a Markdig renderer to the Markdown pipeline to process documentation pages more intelligently (there's nothing stopping you adding this to your blog though, too!). It uses headings to automatically split the content into sections and generates a table of contents. The scrollspy functionality highlights the current section in the navigation as the user scrolls through the page.
The plugin adds a custom Prism code renderer to the pipeline that enhances the default behavior by adding custom line numbering, line diffing, and other features. The included styles and JavaScript add visual and functional enhancements to code blocks.
Installation
Add the package:
dotnet add package BlakePlugin.DocsRenderer
Import the necessary styles and scripts in your
index.html
, and initialise the DocsRenderer:<link rel="stylesheet" href="_content/BlakePlugin.DocsRenderer/lib/docsrenderer.css"> <script src="_content/BlakePlugin.DocsRenderer/lib/docsrenderer.js"></script> <script>initDocsRenderer();</script>
Usage
Razor Setup
Once the plugin is installed, you can use the built-in Razor components to render both the site-wide and in-page table of contents.
Make sure to import the relevant namespaces at the top of your .razor
file:
@using BlakePlugin.DocsRenderer // Required for Section, note this is automatically added to generated pages
@using BlakePlugin.DocsRenderer.Components // Required for SiteToc and PageToc components
@using BlakePlugin.DocsRenderer.Utils // Required for TocNode and TocUtils
Adding navigation components
You can now use the SiteToc
and PageToc
components in your Razor pages or components, or template.razor
files:
<SiteToc Pages="@contentIndex" />
<PageToc Sections="@_sections" />
Generating TOC and Section Data
In your @code
block, you’ll typically initialise the table of contents like this:
@code {
private List<TocNode> contentIndex = TocUtils.BuildSiteTocNodes(GeneratedContentIndex.GetPages());
// This list of sections is automatically generated by the plugin
private List<Section> _sections = [
new Section { Text = "Introduction", Id = "introduction", Children = [ // ...] },
new Section { Text = "Getting Started", Id = "getting-started", Children = [] /*Empty in this case*/ },
// ...
];
}
The _sections
list is automatically injected by the plugin into the generated Razor page at build time, so you don't need to maintain it manually unless you’re testing or debugging. (Note the comments were added just for this example, they are not present in the actual code.)
Customisation
While the behaviour of the plugin is mostly fixed, you can use the generated data to drive your own components. The included components are trivial; you can copy the code and modify it to suit your needs (e.g. add your own styles or additional functionality).
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- Blake.BuildTools (>= 0.0.2-alpha1)
- Microsoft.AspNetCore.Components.Web (>= 9.0.6)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
1.0.15 | 140 | 9/4/2025 |
1.0.14 | 155 | 9/3/2025 |
1.0.13 | 138 | 8/10/2025 |
1.0.12 | 77 | 8/10/2025 |
1.0.11 | 110 | 8/9/2025 |
1.0.10 | 133 | 8/9/2025 |
1.0.9 | 214 | 8/7/2025 |
1.0.8 | 205 | 8/6/2025 |
1.0.7 | 206 | 8/6/2025 |
1.0.6 | 220 | 8/5/2025 |
1.0.5 | 216 | 8/5/2025 |
1.0.4 | 72 | 8/3/2025 |
1.0.0 | 42 | 8/2/2025 |
0.0.1-preview2 | 168 | 7/26/2025 |
0.0.1-preview1 | 412 | 7/25/2025 |