mostlylucid.Markdig.FetchExtension
1.1.0
dotnet add package mostlylucid.Markdig.FetchExtension --version 1.1.0
NuGet\Install-Package mostlylucid.Markdig.FetchExtension -Version 1.1.0
<PackageReference Include="mostlylucid.Markdig.FetchExtension" Version="1.1.0" />
<PackageVersion Include="mostlylucid.Markdig.FetchExtension" Version="1.1.0" />
<PackageReference Include="mostlylucid.Markdig.FetchExtension" />
paket add mostlylucid.Markdig.FetchExtension --version 1.1.0
#r "nuget: mostlylucid.Markdig.FetchExtension, 1.1.0"
#:package mostlylucid.Markdig.FetchExtension@1.1.0
#addin nuget:?package=mostlylucid.Markdig.FetchExtension&version=1.1.0
#tool nuget:?package=mostlylucid.Markdig.FetchExtension&version=1.1.0
mostlylucid.Markdig.FetchExtension
A comprehensive Markdig toolkit providing:
- Fetch Preprocessor - Embed remote Markdown content before pipeline processing
- Table of Contents Extension - Automatically generate TOC from document headings
See my blog here for more details.
Latest Updates
Version 1.1.0 (2025-11-07) - Major TOC Extension Enhancements
- 🎉 Smart Heading Level Detection - TOC now auto-adjusts to document structure (no more empty TOCs!)
- 🎨 Flexible Syntax - Supports single quotes, no quotes, and extra whitespace in cssclass attribute
- 🐛 Improved Error Handling - Better feedback for edge cases and empty documents
- ⚡ Performance - Removed debug logging, more efficient heading processing
- ⚠️ Breaking Change - UseToc() extension MUST now be registered last in the pipeline
- ✅ Comprehensive Tests - Full test coverage for all new features
See TOC Enhancements Guide for detailed information and release notes for version history.
Architecture Overview
This package provides two distinct but complementary features:
graph TD
A[Your Markdown with <fetch> tags and [TOC]] --> B[MarkdownFetchPreprocessor]
B --> C{Check Cache}
C -->|Fresh| D[Return Cached Content]
C -->|Stale/Missing| E[Fetch from Remote URL]
E -->|Success| F[Update Cache]
E -->|Failure| G{Has Cached?}
G -->|Yes| H[Return Stale Cache]
G -->|No| I[Return Error Comment]
F --> J[Replace <fetch> with Content]
D --> J
H --> J
I --> J
J --> K[Processed Markdown with [TOC] markers]
K --> L[Markdig Pipeline with TOC Extension]
L --> M[Final HTML with TOC and fetched content]
style A fill:#e1f5ff
style B fill:#fff3cd
style K fill:#d4edda
style L fill:#d4edda
style M fill:#c8e6c9
Key Concept: The Fetch functionality is a preprocessor that runs before the Markdig pipeline, while TOC is a pipeline extension that runs during Markdig processing.
Table of Contents Extension
A Markdig pipeline extension that generates a table of contents from your document headings.
Quick Start
using Markdig;
using Mostlylucid.Markdig.FetchExtension;
var pipeline = new MarkdownPipelineBuilder()
.UseToc()
.Build();
var markdown = @"
# My Article
[TOC]
## Introduction
Content here...
## Features
More content...
";
var html = Markdown.ToHtml(markdown, pipeline);
TOC Syntax
[TOC]
[TOC]
[TOC]
[TOC cssclass="my-toc"]
[TOC cssclass='my-toc']
[TOC cssclass=my-toc]
[TOC cssclass = "my-toc" ]
v1.1.0 Enhancement: If your document starts at H2 (common in blog posts), the TOC now automatically adjusts the minimum level. No more empty TOCs!
TOC Output
Generates semantic <nav> elements:
<nav class="ml_toc" aria-label="Table of Contents">
<ul>
<li><a href="#introduction">Introduction</a></li>
<li><a href="#features">Features</a></li>
</ul>
</nav>
Headings automatically get IDs for anchor linking. Default CSS class is ml_toc.
Fetch Preprocessor
A preprocessor that fetches and embeds remote Markdown content before it flows through your Markdig pipeline.
Why a Preprocessor?
The Fetch functionality runs before the Markdig pipeline to ensure:
- ✅ Fetched content receives ALL your custom Markdig extensions
- ✅ Consistent styling and processing for local and remote content
- ✅ TOC extension can see headers from fetched content
- ✅ All extensions work on the combined content
- ✅ Simple integration - one preprocessing step
Quick Start
using Mostlylucid.Markdig.FetchExtension;
using Mostlylucid.Markdig.FetchExtension.Processors;
using Microsoft.Extensions.DependencyInjection;
using Markdig;
// 1. Setup DI with a storage provider
var services = new ServiceCollection();
services.AddLogging();
services.AddInMemoryMarkdownFetch();
var serviceProvider = services.BuildServiceProvider();
// 2. Create preprocessor
var preprocessor = new MarkdownFetchPreprocessor(serviceProvider);
// 3. Create your pipeline (can include any extensions)
var pipeline = new MarkdownPipelineBuilder()
.UseToc() // TOC will see fetched content!
.Build();
// 4. Preprocess, then render
var markdown = @"
# My Document
[TOC]
## Local Content
<fetch markdownurl=""https://raw.githubusercontent.com/scottgal/mostlylucidweb/main/README.md""
pollfrequency=""24""/>
";
var processedMarkdown = preprocessor.Preprocess(markdown);
var html = Markdown.ToHtml(processedMarkdown, pipeline);
Fetch Syntax
<fetch markdownurl="https://example.com/README.md" pollfrequency="24h"/>
Full syntax:
<fetch markdownurl="URL"
pollfrequency="DURATION"
transformlinks="true|false"
showsummary="true|false"
summarytemplate="TEMPLATE"
cssclass="CLASSNAME"
disable="true|false"/>
Attributes:
markdownurl(required): URL of the remote Markdown to fetchpollfrequency(required): Cache duration with unit (s/m/h/d) or plain number (defaults to hours)- Examples:
"30s"(30 seconds),"5m"(5 minutes),"12h"(12 hours),"7d"(7 days),"24"(24 hours) - Use
"0"or"0s"to always fetch fresh content
- Examples:
transformlinks(optional): Rewrite relative links to absolute URLs (default:false)showsummary(optional): Display fetch metadata summary (default:false)summarytemplate(optional): Custom template for metadata summarycssclass(optional): CSS class for the summary wrapper div (default:"ft_summary")disable(optional): Whentrue, the tag is left as-is and not processed (useful for documentation) (default:false)
Combined Usage
The real power comes from using both features together:
using Mostlylucid.Markdig.FetchExtension;
using Mostlylucid.Markdig.FetchExtension.Processors;
using Microsoft.Extensions.DependencyInjection;
using Markdig;
// Setup DI
var services = new ServiceCollection();
services.AddLogging();
services.AddInMemoryMarkdownFetch();
var serviceProvider = services.BuildServiceProvider();
// Create preprocessor and pipeline
var preprocessor = new MarkdownFetchPreprocessor(serviceProvider);
var pipeline = new MarkdownPipelineBuilder()
.UseToc() // MUST be last! (v1.1.0+)
.Build();
// Your markdown can use both features
var markdown = @"
# Documentation Hub
[TOC:2-3]
## Local Section
This is local content.
## Remote Section
<fetch markdownurl=""https://example.com/api-docs.md""
pollfrequency=""12""
transformlinks=""true""
showsummary=""true""/>
## Another Local Section
More local content.
";
// Process: Fetch first, then pipeline
var processedMarkdown = preprocessor.Preprocess(markdown);
var html = Markdown.ToHtml(processedMarkdown, pipeline);
// Result: TOC includes headers from both local AND fetched content!
Storage Options
The Fetch preprocessor requires a storage backend for caching:
| Storage Type | Persistence | Multi-Server | Use Case | Setup |
|---|---|---|---|---|
| In-Memory | No | No | Demos, testing, simple apps | Very Easy |
| File-Based | Yes | No | Single-server production | Easy |
| SQLite | Yes | No | Single-server with DB | Easy |
| PostgreSQL | Yes | Yes | Multi-server, cloud | Moderate |
| SQL Server | Yes | Yes | Enterprise, Azure | Moderate |
| Custom | Configurable | Configurable | Specialized needs | Advanced |
Storage Provider Architecture
graph LR
A[IMarkdownFetchService Interface] --> B[InMemoryMarkdownFetchService]
A --> C[FileBasedMarkdownFetchService]
A --> D[PostgresMarkdownFetchService]
A --> E[SqliteMarkdownFetchService]
A --> F[SqlServerMarkdownFetchService]
A --> G[YourCustomService]
B --> H[ConcurrentDictionary]
C --> I[File System + SemaphoreSlim]
D --> J[PostgreSQL Database]
E --> K[SQLite Database]
F --> L[SQL Server Database]
G --> M[Your Storage Backend]
style A fill:#4a90e2
style B fill:#e1f5ff
style C fill:#e1f5ff
style D fill:#c8e6c9
style E fill:#c8e6c9
style F fill:#c8e6c9
style G fill:#fff3cd
Option 1: In-Memory Storage
Perfect for demos, testing, or apps that don't need persistence:
services.AddInMemoryMarkdownFetch();
Option 2: File-Based Storage
Persists cache to disk, survives restarts:
services.AddFileBasedMarkdownFetch("./markdown-cache");
Option 3: Database Storage (Plugins)
SQLite
dotnet add package Mostlylucid.Markdig.FetchExtension.Sqlite
services.AddSqliteMarkdownFetch("Data Source=markdown-cache.db");
serviceProvider.EnsureMarkdownCacheDatabase();
PostgreSQL
dotnet add package Mostlylucid.Markdig.FetchExtension.Postgres
services.AddPostgresMarkdownFetch("Host=localhost;Database=myapp;Username=user;Password=pass");
serviceProvider.EnsureMarkdownCacheDatabase();
SQL Server
dotnet add package Mostlylucid.Markdig.FetchExtension.SqlServer
services.AddSqlServerMarkdownFetch("Server=localhost;Database=MyApp;Integrated Security=true");
serviceProvider.EnsureMarkdownCacheDatabase();
Option 4: Custom Storage
Implement IMarkdownFetchService for your own backend:
public class MyCustomMarkdownFetchService : IMarkdownFetchService
{
public async Task<MarkdownFetchResult> FetchMarkdownAsync(
string url,
int pollFrequencyHours,
int blogPostId)
{
// Your custom implementation
}
}
services.AddScoped<IMarkdownFetchService, MyCustomMarkdownFetchService>();
Fetch Features
Link Transformation
When fetching remote Markdown (especially from GitHub repositories), relative links will break. Use transformlinks="true":
<fetch markdownurl="https://raw.githubusercontent.com/user/repo/main/docs/README.md"
pollfrequency="24"
transformlinks="true"/>
What it does:
- Converts relative links like
[docs](./CONTRIBUTING.md)to absolute GitHub URLs - Preserves absolute URLs, anchors (
#section), and mailto links unchanged - Special handling for GitHub raw URLs - converts to display URLs (blob view)
- Example:
./file.mdbecomeshttps://github.com/user/repo/blob/main/docs/file.md
Fetch Metadata Summaries
Show readers when content was last fetched:
<fetch markdownurl="https://example.com/docs.md"
pollfrequency="24"
showsummary="true"
summarytemplate="_Last updated {age} | Status: {status}_"/>
Available placeholders:
| Placeholder | Description | Example |
|---|---|---|
{retrieved:format} |
Last fetch date/time | See formats below |
{age} |
Human-readable time since fetch | "2 hours ago", "3 days ago" |
{url} |
Source URL | https://example.com/file.md |
{nextrefresh:format} |
When content will be refreshed | "in 22 hours" |
{pollfrequency} |
Cache duration in hours | 24 |
{status} |
Cache status | fresh, cached, or stale |
Date format options: relative, short, long, date, time, iso, day, month, month-text, month-short, year, or any .NET DateTime format string.
Separate Summary Tag
Display metadata separately from content:
# External Documentation
<fetch markdownurl="https://github.com/user/repo/main/README.md"
pollfrequency="24"
transformlinks="true"/>
---
<fetch-summary url="https://github.com/user/repo/main/README.md"
template="Last updated: {age}"/>
Important: The url attribute must exactly match the markdownurl from the corresponding <fetch> tag.
Real-World Integration Example
Here's how to integrate into a typical ASP.NET Core application:
// Startup.cs or Program.cs
public class MarkdownRenderingService
{
private readonly MarkdownFetchPreprocessor _preprocessor;
private readonly MarkdownPipeline _pipeline;
public MarkdownRenderingService(IServiceProvider serviceProvider)
{
// Create preprocessor (runs BEFORE pipeline)
_preprocessor = new MarkdownFetchPreprocessor(serviceProvider);
// Create pipeline with extensions (runs AFTER preprocessing)
_pipeline = new MarkdownPipelineBuilder()
// Add your other extensions here
.UseToc() // MUST be last! (v1.1.0+)
.Build();
}
public string RenderMarkdown(string markdown)
{
// Step 1: Preprocess to handle <fetch> tags
var processedMarkdown = _preprocessor.Preprocess(markdown);
// Step 2: Run through pipeline (TOC and other extensions)
return Markdown.ToHtml(processedMarkdown, _pipeline);
}
}
// Configure DI
builder.Services.AddFileBasedMarkdownFetch("./cache");
builder.Services.AddSingleton<MarkdownRenderingService>();
Why Preprocessor + Extension Architecture?
Fetch is a Preprocessor because:
- ✅ Runs once before pipeline, not during parsing
- ✅ Fetched content flows through the entire pipeline
- ✅ All your extensions see the combined content
- ✅ TOC can include headers from fetched content
- ✅ Consistent processing everywhere
TOC is an Extension because:
- ✅ Needs to parse the document structure
- ✅ Extracts headers after all content is assembled
- ✅ Integrates with Markdig's rendering pipeline
- ✅ Works on the final, preprocessed markdown
Caching Behavior
stateDiagram-v2
[*] --> CheckCache: Fetch Request
CheckCache --> Fresh: Cache exists & age < pollFrequency
CheckCache --> Stale: Cache exists & age >= pollFrequency
CheckCache --> Missing: No cache entry
Fresh --> ReturnCached: Return cached content
ReturnCached --> [*]
Stale --> FetchRemote: Attempt HTTP GET
Missing --> FetchRemote: Attempt HTTP GET
FetchRemote --> UpdateCache: Success
FetchRemote --> HasStale: Failure
UpdateCache --> ReturnFresh: Return new content
ReturnFresh --> [*]
HasStale --> ReturnStale: Return stale cache
HasStale --> ReturnError: No cache available
ReturnStale --> [*]
ReturnError --> [*]
note right of Fresh
pollFrequency = 0
means always stale
end note
note right of HasStale
Stale-while-revalidate
pattern ensures uptime
end note
Cache Rules:
pollfrequency="0"= Always fetch fresh (no cache)pollfrequency="24"= Cache for 24 hours- Failed fetch with cache = Returns stale cached content (graceful degradation)
- Failed fetch without cache = Returns error comment
Events and Monitoring
Monitor fetch operations in real-time:
sequenceDiagram
participant MD as Markdown Processor
participant EP as Event Publisher
participant FS as Fetch Service
participant ST as Storage Backend
participant L as Your Listeners
MD->>EP: FetchBeginning
EP->>L: Notify FetchBeginning
EP->>FS: FetchMarkdownAsync(url)
FS->>ST: Check Cache
alt Cache Fresh
ST-->>FS: Cached Content
FS->>EP: FetchCompleted (cached=true)
else Cache Stale/Missing
FS->>FS: HTTP GET
alt Success
FS->>ST: Update Cache
ST-->>FS: OK
FS->>EP: FetchCompleted (cached=false)
else Failure
FS->>EP: FetchFailed
EP->>L: Notify FetchFailed
end
end
EP->>L: Notify FetchCompleted
EP->>L: Notify ContentUpdated
FS-->>MD: MarkdownFetchResult
Note over L: Listeners can be: Logging, Metrics, Telemetry, Webhooks
Subscribe to Events
var eventPublisher = serviceProvider.GetRequiredService<IMarkdownFetchEventPublisher>();
eventPublisher.FetchBeginning += (sender, args) =>
{
Console.WriteLine($"Fetching {args.Url}...");
};
eventPublisher.FetchCompleted += (sender, args) =>
{
var source = args.WasCached ? "cache" : "remote";
Console.WriteLine($"Fetched {args.Url} from {source} in {args.Duration.TotalMilliseconds}ms");
};
eventPublisher.FetchFailed += (sender, args) =>
{
Console.WriteLine($"Failed to fetch {args.Url}: {args.ErrorMessage}");
};
Thread Safety
MarkdownFetchPreprocessoris thread-safe- Can be registered as Singleton in DI
- Safe for concurrent use across multiple requests
- All storage providers handle concurrent access:
- InMemory: Uses
ConcurrentDictionary - File: Uses
SemaphoreSlimfor file locking - Database: Relies on database transaction isolation
- InMemory: Uses
Error Handling
If a fetch fails, the preprocessor renders an HTML comment:
Your page continues to render normally.
Demo Application
See the Mostlylucid.Markdig.FetchExtension.Demo project for a complete working example:
cd Mostlylucid.Markdig.FetchExtension.Demo
dotnet run
Open http://localhost:5000 to see an interactive demo with:
- Live markdown editor
- Real-time fetch and TOC rendering
- Cache inspector
- Event monitoring
Testing
Comprehensive tests included:
dotnet test Mostlylucid.Markdig.FetchExtension.Tests
API Reference
IMarkdownFetchService
public interface IMarkdownFetchService
{
Task<MarkdownFetchResult> FetchMarkdownAsync(
string url, // URL to fetch
int pollFrequencyHours, // Cache duration in hours
int blogPostId); // Optional context ID (0 if not used)
}
MarkdownFetchResult
public class MarkdownFetchResult
{
public bool Success { get; set; }
public string? Content { get; set; }
public string? ErrorMessage { get; set; }
}
MarkdownFetchPreprocessor
public class MarkdownFetchPreprocessor
{
public MarkdownFetchPreprocessor(IServiceProvider serviceProvider);
// Synchronous preprocessing
public string Preprocess(string markdown, int blogPostId = 0);
// Async preprocessing
public Task<string> PreprocessAsync(string markdown, int blogPostId = 0);
}
Requirements
- .NET 9.0+
- Markdig 0.43.0+
Installation
# Core package (includes TOC extension and Fetch preprocessor)
dotnet add package Mostlylucid.Markdig.FetchExtension
# Optional database plugins
dotnet add package Mostlylucid.Markdig.FetchExtension.Sqlite
dotnet add package Mostlylucid.Markdig.FetchExtension.Postgres
dotnet add package Mostlylucid.Markdig.FetchExtension.SqlServer
Contributing
Issues and PRs welcome at github.com/scottgal/mostlylucidweb
License
Unlicense (public domain)
| 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
- Markdig (>= 0.43.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.10)
- Microsoft.Extensions.Hosting.Abstractions (>= 9.0.10)
- Microsoft.Extensions.Http (>= 9.0.10)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.10)
- Microsoft.Extensions.Options (>= 9.0.10)
- System.IO.Hashing (>= 9.0.10)
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.1.0 | 255 | 11/7/2025 |
| 1.0.0-alpha1 | 211 | 11/7/2025 |
| 0.0.1-alpha7 | 250 | 11/6/2025 |
| 0.0.1-alpha6 | 245 | 11/6/2025 |
mostlylucid.Markdig.FetchExtension
==================================
TABLE OF CONTENTS
-----------------
1. Version 1.1.0 (2025-11-07)
2. Version 1.0.0 (Initial Release)
3. Requirements
4. Documentation
5. License
=========================================
VERSION 1.1.0 (2025-11-07)
=========================================
MAJOR TOC EXTENSION ENHANCEMENTS
---------------------------------
For complete details, see TOC_ENHANCEMENTS_v1.1.0.md
HIGHLIGHTS:
* Smart heading level auto-detection (no more empty TOCs for blog posts!)
* Flexible syntax: single quotes, no quotes, extra whitespace all supported
* Improved error handling with helpful debug comments
* Performance improvements (removed debug logging, single-pass processing)
* Breaking change: UseToc() MUST be last in pipeline
* Comprehensive test coverage for all new features
SMART HEADING LEVEL DETECTION:
* Auto-adjusts minimum heading level based on document structure
* If document starts at H2 (common in blog posts), automatically uses H2 as minimum level
* Prevents empty TOC when documents don't have H1 headers
* Includes HTML comment showing auto-adjustment for debugging
* Example: Document with only H2-H4 now generates proper TOC starting at H2
FLEXIBLE SYNTAX PARSING:
* [TOC cssclass="my-class"] - Double quotes (original)
* [TOC cssclass='my-class'] - Single quotes (new)
* [TOC cssclass=my-class] - No quotes (new)
* [TOC cssclass = "my-class" ] - Extra spaces around equals (new)
* Leading/trailing whitespace now handled correctly
* Regex pattern updated: ^\s*\[TOC(?:\s+cssclass\s*=\s*["']?([a-zA-Z0-9_-]+)["']?)?\s*\]\s*$
IMPROVED ERROR HANDLING:
* Empty documents render HTML comment instead of throwing error
* Missing document renders helpful debug comment
* Better feedback when no headings found within level range
PERFORMANCE IMPROVEMENTS:
* Removed debug console logging throughout (cleaner production output)
* More efficient heading collection and filtering
* Single-pass heading processing
PIPELINE ORDER REQUIREMENT (BREAKING CHANGE):
* UseToc() extension MUST now be registered last in the pipeline
* This ensures proper interaction with other Markdig extensions
* Updated MarkdownBaseService to reflect correct ordering
COMPREHENSIVE TEST COVERAGE:
* Added tests for all new syntax variations
* Tests for auto-adjustment behavior
* Tests for edge cases (empty documents, unusual heading structures)
* Tests for whitespace handling
=========================================
VERSION 1.0.0 (Initial Release)
=========================================
Initial release of the Markdig Fetch Extension - a comprehensive solution for
fetching remote Markdown content and generating table of contents.
KEY FEATURES
------------
FETCH EXTENSION:
* Simple inline syntax: <fetch markdownurl="URL" pollfrequency="24h"/>
* Multiple storage backends: In-Memory, File-based, and custom implementations
* Smart caching with configurable poll frequency (hours)
* Stale-while-revalidate pattern: Returns cached content if fetch fails
* Link transformation: Automatically rewrites relative links to absolute URLs
* Fetch metadata summaries: Display when content was last fetched
* Flexible template system for metadata display
* Full dependency injection support
* Thread-safe operations across all storage providers
* Preprocessing architecture ensures fetched content flows through your entire
Markdig pipeline with all custom extensions
* Documentation mode: Add disable="true" to prevent tag processing, perfect for
writing documentation about the extension itself
TABLE OF CONTENTS (TOC) EXTENSION:
* Simple inline syntax: [TOC], [TOC:2-4], [TOC:2-4:my-class]
* Automatically generates hierarchical table of contents from headers
* Configurable heading level range (e.g., H2-H4)
* Custom CSS class support for styling
* Semantic HTML5 nav element output
* Automatic anchor link generation for all headings
* Integrates seamlessly with the fetch extension
FLEXIBLE TIME UNITS:
* Poll frequency now supports multiple time units: seconds (s), minutes (m), hours (h), days (d)
* Examples: "30s", "5m", "12h", "7d"
* Backwards compatible - plain numbers still default to hours
* Prevents large numbers like "1000000000s" by using appropriate units
STORAGE OPTIONS
---------------
* In-Memory: Perfect for demos, testing, simple apps (no persistence)
* File-Based: Single-server production with disk persistence
* Database Plugins: SQLite, PostgreSQL, SQL Server (separate packages)
* Custom: Implement IMarkdownFetchService for specialized needs
USAGE EXAMPLES
--------------
Fetch Extension:
services.AddInMemoryMarkdownFetch();
FetchMarkdownExtension.ConfigureServiceProvider(serviceProvider);
var pipeline = new MarkdownPipelineBuilder()
.UseAdvancedExtensions()
.Use<FetchMarkdownExtension>()
.Build();
In markdown: <fetch markdownurl="https://example.com/doc.md" pollfrequency="24h"/>
TOC Extension:
var pipeline = new MarkdownPipelineBuilder()
.UseAdvancedExtensions()
.UseToc() // MUST be last!
.Build();
In markdown: [TOC] or [TOC cssclass="my-class"]
Combined Usage:
var pipeline = new MarkdownPipelineBuilder()
.UseAdvancedExtensions()
.Use<FetchMarkdownExtension>()
.UseToc() // MUST be last!
.Build();
=========================================
REQUIREMENTS
=========================================
* .NET 9.0+
* Markdig 0.42.0+
* Microsoft.Extensions.DependencyInjection 9.0+
=========================================
DOCUMENTATION
=========================================
Full documentation: https://github.com/scottgal/mostlylucidweb/tree/main/Mostlylucid.Markdig.FetchExtension
Integration guide: See INTEGRATION_GUIDE.md in the repository
=========================================
LICENSE
=========================================
Unlicense (public domain)