forked from github/quartz
- glob.ts: add optional respectGitignore param (default true) so callers
can opt out of gitignore filtering for generated directories
- build.ts: pass respectGitignore=false when globbing content/ so
gitignored-but-generated markdown files are always picked up
- static.ts: copy top-level static/ → output/ root with gitignore disabled,
mirroring Hugo's convention so ox-hugo images at static/ox-hugo/* are
served at /ox-hugo/* as expected by the exported markdown src paths
- oxhugofm.ts: run replaceFigureWithMdImg before removeHugoShortcode so the
precise figure regex sees the intact shortcode before the generic {{.*}}
stripper destroys it; also upgrade figureTagRegex to figureShortcodeRegex
which matches the full shortcode form ox-hugo actually emits
24 lines
510 B
TypeScript
24 lines
510 B
TypeScript
import path from "path"
|
|
import { FilePath } from "./path"
|
|
import { globby } from "globby"
|
|
|
|
export function toPosixPath(fp: string): string {
|
|
return fp.split(path.sep).join("/")
|
|
}
|
|
|
|
export async function glob(
|
|
pattern: string,
|
|
cwd: string,
|
|
ignorePatterns: string[],
|
|
respectGitignore: boolean = true,
|
|
): Promise<FilePath[]> {
|
|
const fps = (
|
|
await globby(pattern, {
|
|
cwd,
|
|
ignore: ignorePatterns,
|
|
gitignore: respectGitignore,
|
|
})
|
|
).map(toPosixPath)
|
|
return fps as FilePath[]
|
|
}
|