This documentation is also published as Markdown for efficient machine reading: the whole site is indexed at /llms.txt, and every page has a clean Markdown copy under /_llms/. These are generated from the same source and cost far fewer tokens to read than this rendered HTML.

Skip to main content Skip to navigation

IncludeExpander Pennington.Markdown

Expands DocFX-style [!INCLUDE [title](path)] directives by splicing the referenced Markdown file's content in place. Targets are resolved relative to the referencing file and expanded recursively; a missing or cyclic target collapses to an HTML comment so the build still completes. Directives inside fenced code blocks are left verbatim so syntax can be documented.

Methods

Expand

#
public static string Expand(string markdown, FilePath sourceFile, IFileSystem fileSystem)

Expands every include directive in markdown. Paths resolve relative to sourceFile; relative links inside included content are not rebased, so they resolve as if written in the host page.

Parameters

markdown string
sourceFile FilePath
fileSystem IFileSystem

Returns

string

Pennington.Markdown.IncludeExpander

namespace Pennington.Markdown;

/// Expands DocFX-style [!INCLUDE [title](path)] directives by splicing the referenced Markdown file's content in place. Targets are resolved relative to the referencing file and expanded recursively; a missing or cyclic target collapses to an HTML comment so the build still completes. Directives inside fenced code blocks are left verbatim so syntax can be documented.
public class IncludeExpander
{
    /// Expands every include directive in markdown. Paths resolve relative to sourceFile; relative links inside included content are not rebased, so they resolve as if written in the host page.
    
public static string Expand(string markdown, FilePath sourceFile, IFileSystem fileSystem)
; }