pmndrs/docs

Documentation generator for `pmndrs/*` projects.

INSTALL

$ git clone https://github.com/pmndrs/docs.git
$ cd docs
$ npm ci

Configuration

vardescriptionexample
MDX*Path to *.mdx folder
NB: can be relative or absolute
docs or ~/code/myproject/documentation
NEXT_PUBLIC_LIBNAME*Library nameReact Three Fiber
NEXT_PUBLIC_LIBNAME_SHORTLibrary short namer3f
BASE_PATHBase path for the final URL/react-three-fiber
DIST_DIRPath to the output folder (within project)out or docs/out/react-three-fiber
OUTPUTSet to export for static outputexport
HOME_REDIRECTWhere the home should redirect/getting-started/introduction
MDX_BASEURLBase URL for inlining relative imageshttp://localhost:60141or https://github.com/pmndrs/react-three-fiber/raw/master/docs
EDIT_BASEURLBase URL for displaying "Edit this page" URLshttps://github.com/pmndrs/react-three-fiber/edit/master/docs
NEXT_PUBLIC_URLFinal URL of the published websitehttps://pmndrs.github.io/react-three-fiber
ICONEmoji or image to use as (fav)icon (path local to MDX)🇨🇭 or /icon.png or /favicon.ico
LOGOLogo src/path (either FQURL or local to MDX path)/logo.png or https://worldvectorlogo.com/r3f.png

* Required

MDX_BASEURL

Given a advanced/introduction.mdx file in the MDX folder:

![](https://github.com/pmndrs/docs/raw/tooling/docs/getting-started/dog.png)

becomes (for a MDX_BASEURL=http://localhost:60141 value):

![](http://localhost:60141/advanced/dog.png)

http://localhost:60141 being the MDX folder served.

[!TIP] When deployed on GitHub Pages, MDX_BASEURL will typically value something like https://github.com/pmndrs/uikit/raw/main/docs, thanks to build.yml rule.

dev

$ (
  trap 'kill -9 0' SIGINT

  export _PORT=60141

  export MDX=docs
  export NEXT_PUBLIC_LIBNAME="Poimandres"
  export NEXT_PUBLIC_LIBNAME_SHORT="pmndrs"
  export BASE_PATH=
  export DIST_DIR=
  export OUTPUT=export
  export HOME_REDIRECT=
  export MDX_BASEURL=http://localhost:$_PORT
  export EDIT_BASEURL="vscode://file/$MDX"
  export NEXT_PUBLIC_URL=
  export ICON=
  export LOGO=gutenberg.jpg

  kill $(lsof -ti:"$_PORT")
  npx serve $MDX -p $_PORT --no-port-switching --no-clipboard &
  npm run dev &

  wait
)

Then go to: http://localhost:3000

[!TIP] If HOME_REDIRECT= empty, / will not redirect, and instead displays an index of libraries.

build

$ (
  trap 'kill -9 0' SIGINT

  rm -rf out

  export _PORT=60141

  export MDX=docs
  export NEXT_PUBLIC_LIBNAME="Poimandres"
  export NEXT_PUBLIC_LIBNAME_SHORT="pmndrs"
  export BASE_PATH=
  export DIST_DIR=
  export OUTPUT=export
  export HOME_REDIRECT=/getting-started/introduction
  export MDX_BASEURL=http://localhost:$_PORT
  export EDIT_BASEURL=
  export NEXT_PUBLIC_URL=
  export ICON=
  export LOGO=gutenberg.jpg

  npm run build

  kill $(lsof -ti:"$_PORT")
  npx serve $MDX -p $_PORT --no-port-switching --no-clipboard &
  npx serve out &

  wait
)

http://localhost:3000