markdownFileToPagePath #
Page path of a Markdown file: its source path after rewrites, for example /a/intro.md for packages/a/src/intro.md and the rule 'packages/:pkg/src/:page*': ':pkg/:page*'. Without rewrites it is the source path. The route of the page and its relative links both start here.
Usage #
TypeScript
import { markdownFileToPagePath } from 'kawapress/generator'
const path = markdownFileToPagePath('/site/a.md', '/site')
Parameters
filestring
Absolute path of the Markdown file.
sourceRootstring
Absolute source folder, the resolved srcDir.
rewritesoptionalPageRewrites
The rewrites of the site config.
Returns The page path, for example /a/intro.md.
Full type signature
TypeScript
function markdownFileToPagePath(file: string, sourceRoot: string, rewrites?: PageRewrites): string

Comments