isMarkdownPage #

Whether file is a page of this scope, without reading any directory.

Usage #

TypeScript
import { 
isMarkdownPage
} from 'kawapress/generator'
const
scope
= {
sourceRoot
: '/site' }
const
yes
=
isMarkdownPage
('/site/a.md',
scope
)

Parameters

filestring

Absolute path of a file.

scopeMarkdownPageScope

Where the pages of the site are.

sourceRootstring

Absolute directory holding the Markdown sources, that is the resolved srcDir.

publicDiroptionalstring

Absolute directory of files that are copied as they are, that is the resolved publicDir. Markdown inside it is not a page. Leave it out when the site has no public directory.

excludeoptionalreadonly string[]

Glob patterns, relative to sourceRoot, of Markdown files that are not pages, that is the resolved srcExclude. Leave it out to keep every file.

rewritesoptionalPageRewrites

rewrites of the site config, which moves pages to other routes.

Returns true when the file is a Markdown page of the scope.

Full type signature
TypeScript
function isMarkdownPage(file: string, scope: MarkdownPageScope): boolean

Edit this page

Comments