Skip to main content

init

Initializes a new htmldocs project in the current directory.
npx htmldocs@latest init

login

Authenticates the CLI with the cloud. This allows you to publish your documents to the cloud.
npx htmldocs@latest login

dev

Starts a local development server that will watch your files and automatically rebuild your document template when you make changes. Login not required.
npx htmldocs@latest dev
Options
--dir
string
default:"./documents"
Change the directory of your document templates.
--port
string
default:"3000"
Port to run dev server on

publish <file>

Publishes the document to the cloud for API use. Must be authenticated.
Be sure to run this from the root of your project.
npx htmldocs@latest publish <file>
Options
file
string
required
The file path of the document to publish.

--help

Shows all available commands and options.
npx htmldocs@latest --help
Options
-v, --verbose
boolean
Enable verbose logging
F.A.Q
You can define preview props for your document by adding a PreviewProps property to your default export. For example:
export default function Document(props) {
  return (
    <div>
      <h1>{props.title}</h1>
      <p>{props.content}</p>
    </div>
  );
}

Document.PreviewProps = {
  title: "Preview Title",
  content: "This is preview content",
};
These props will be used when previewing the document in the development server.
To publish documents, you need to authenticate with the cloud service. Use the htmldocs login command to start the authentication process. This will open a browser window where you can select a team and complete the authentication. Once authenticated, your tokens will be securely stored for future use.
By default, built files are stored in a dist directory in your project root. You can customize this location by setting the NEXT_PUBLIC_USER_PROJECT_LOCATION environment variable.
I