markdownFileToRoutePath #

Markdown 文件在应用 rewrites 之后的公开路由。

用法 #

TypeScript
import { 
markdownFileToRoutePath
} from 'kawapress/generator'
const
route
=
markdownFileToRoutePath
(
'/site/guide/a.md', '/site', )

参数

filestring

Markdown 文件的绝对路径。

sourceRootstring

源码目录的绝对路径,也就是解析后的 srcDir。

rewrites可选PageRewrites

站点配置里的 rewrites。

返回值 路由路径,例如 /a/intro。

完整类型签名
TypeScript
function markdownFileToRoutePath(file: string, sourceRoot: string, rewrites?: PageRewrites): string

编辑此页

评论