Directory
src/content/docs/. Re-asked if left blank.Once shane-new-doc is installed (see Install & Quick Start), it drops a scripts/new-doc.js into the project. There are two ways to run it. If pnpm new-doc says the script doesn’t exist, see Verify the install — the short version is that some package managers skip the setup step, and Installation Internals explains exactly why and how to finish it by hand.
Run it with no arguments:
npm run new-docpnpm new-docyarn new-docYou’ll be walked through, in order:
Directory
src/content/docs/. Re-asked if left blank.Filename
Title / description
Sidebar order
sidebar.order. Must be numeric or left blank — a non-numeric entry re-prompts.If title is left blank, it defaults to the filename with its extension stripped.
The first two positional arguments must be directory and filename, in exactly that order — this pair is the one part of the command that can’t be reshuffled. Everything after them is a key:value pair, and those pairs — unlike the two positionals before them — can appear in any order, separated by / (or split across lines with a trailing \):
pnpm new-doc "guide" "getting-started" title:Getting Started/description:Intro to the project/order:1/mdx:TThis is exactly equivalent — same keys, different order:
pnpm new-doc "guide" "getting-started" \ mdx:T \ order:1 \ title:Getting Started \ description:Intro to the project| Key | Alias | Required | Description |
|---|---|---|---|
directory |
dir |
Yes | Positional #1, relative to src/content/docs/. |
filename |
— | Yes | Positional #2. |
title |
— | No | Doc title. Defaults to the filename (extension stripped) if omitted. |
description |
desc |
No | Doc description. Omitted from frontmatter entirely if empty. |
order |
sidebarorder |
No | Sidebar order. Must be a number if provided at all — an invalid value throws an error and stops the command. |
mdx |
— | No | Boolean, see below. T/true creates a .mdx file; otherwise .md. |
Boolean values (mdx) follow the same rule as shane-new-post: case-insensitive, and only t / true (any casing) is read as yes. f, false, an empty value, or omitting the key are all read as no — there’s no separate check for “false”, it’s simply everything that isn’t a “true” match.
@astrojs/starlight as a dependency, so it never touches unrelated projects.getting-started(2).md, and prints a notice when it does..md and .mdx; if the filename already ends in one of those, it’s used as-is and a notice is printed that the mdx flag was ignored.src/content/docs/ (e.g. via ..), even if the invalid characters check is somehow bypassed.