expandMarkdownSource #
Writes out <!--@include: ...--> and <<< ... in a page source, so every reader of the page, from the compiler to the search index, sees the same Markdown. Directives inside fenced code blocks stay as they are written, which lets a page show the syntax itself.
Usage #
TypeScript
import { expandMarkdownSource } from 'kawapress/generator'
const { source } = expandMarkdownSource('# Hi', {
file: '/site/a.md',
sourceRoot: '/site',
})Parameters
sourcestring
The Markdown source of the page.
locationMarkdownSourceLocation
Where the page is, so relative paths resolve.
filestring
Absolute path of the Markdown file.
sourceRootstring
Absolute source directory, which @/ paths start from.
Returns The expanded source with the files it was read from.
Full type signature
TypeScript
function expandMarkdownSource(source: string, location: MarkdownSourceLocation): ExpandedMarkdownSource

Comments