Skip to main content

preview

start a local HTTP server that renders a preview of the profile. useful for checking how the directory will display your file before publishing.


usage

npx declared-md preview [file]

if no file is given, the command looks for whoami.md, whois.md, or whatis.md in the current directory.


examples

npx declared-md preview
npx declared-md preview ./whoami.md

behavior

  1. validates the file. if invalid, shows errors and exits without starting the server.
  2. starts a local HTTP server at http://localhost:3939.
  3. opens the browser automatically.
  4. watches the file for changes and reloads the preview automatically.

press ctrl+c to stop the server.


output

previewing whoami.md
server running at http://localhost:3939
watching for changes...

notes

  • the preview matches the rendering of the public directory site, but may differ in minor styling details
  • the preview uses the same spec version as the installed CLI
  • the server port (3939) is not configurable in v1.0

troubleshooting

file is invalid: run validate first and fix all errors before using preview.

port in use: if 3939 is already in use, kill the process using that port and retry.