pmndrs/docs
Documentation generator for `pmndrs/*` projects.
INSTALL
$ git clone https://github.com/pmndrs/docs.git
$ cd docs
$ npm ci
Configuration
var | description | example |
---|---|---|
MDX * | Path to *.mdx folderNB: can be relative or absolute | docs or ~/code/myproject/documentation |
NEXT_PUBLIC_LIBNAME * | Library name | React Three Fiber |
NEXT_PUBLIC_LIBNAME_SHORT | Library short name | r3f |
BASE_PATH | Base path for the final URL | /react-three-fiber |
DIST_DIR | Path to the output folder (within project) | out or docs/out/react-three-fiber |
OUTPUT | Set to export for static output | export |
HOME_REDIRECT | Where the home should redirect | /getting-started/introduction |
MDX_BASEURL | Base URL for inlining relative images | http://localhost:60141 or https://github.com/pmndrs/react-three-fiber/raw/master/docs |
EDIT_BASEURL | Base URL for displaying "Edit this page" URLs | https://github.com/pmndrs/react-three-fiber/edit/master/docs |
NEXT_PUBLIC_URL | Final URL of the published website | https://pmndrs.github.io/react-three-fiber |
ICON | Emoji or image to use as (fav)icon (path local to MDX ) | 🇨🇠or /icon.png or /favicon.ico |
LOGO | Logo src/path (either FQURL or local to MDX path) | /logo.png or https://worldvectorlogo.com/r3f.png |
GITHUB | Github URL | https://github.com/pmndrs/react-three-fiber |
DISCORD | Discord URL | https://discord.com/channels/740090768164651008/740093168770613279 |
THEME_PRIMARY | Primary accent color (see: https://tailwind-material-colors-docs.vercel.app) | #323e48 |
THEME_HINT | Hint/Note color (see: https://tailwind-material-colors-docs.vercel.app) | #d29922 |
THEME_SCHEME | Theme scheme (see: https://tailwind-material-colors-docs.vercel.app) | content or expressive or fidelity or monochrome or neutral or tonalSpot or vibrant |
THEME_CONTRAST | Theme contrast -- value between -1 and 1 | 0 or -1 or 1 or -.6 |
* Required
MDX_BASEURL
Given a advanced/introduction.mdx
file in the MDX
folder:
![](https://github.com/pmndrs/docs/raw/main/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 likehttps://github.com/pmndrs/uikit/raw/main/docs
, thanks tobuild.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
export GITHUB=https://github.com/pmndrs/docs
export DISCORD=https://discord.com/channels/740090768164651008/1264328004172255393
export THEME_PRIMARY="#323e48"
export THEME_HINT="#d29922"
export THEME_SCHEME="tonalSpot"
export THEME_CONTRAST=0
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
export GITHUB=https://github.com/pmndrs/docs
export DISCORD=https://discord.com/channels/740090768164651008/1264328004172255393
export THEME_PRIMARY="#323e48"
export THEME_HINT="#d29922"
export THEME_SCHEME="tonalSpot"
export THEME_CONTRAST=0
npm run build
kill $(lsof -ti:"$_PORT")
npx serve $MDX -p $_PORT --no-port-switching --no-clipboard &
npx serve out &
wait
)
Docker
$ docker build -t pmndrs-docs .
$ cd ~/code/pmndrs/react-three-fiber
$ (
trap 'kill -9 0' SIGINT
export _PORT=60141
export MDX=./docs
export NEXT_PUBLIC_LIBNAME="React Three Fiber"
export NEXT_PUBLIC_LIBNAME_SHORT="r3f"
export BASE_PATH=
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=/logo.png
export GITHUB=https://github.com/pmndrs/react-three-fiber
export DISCORD=https://discord.com/channels/740090768164651008/740093168770613279
export THEME_PRIMARY="#323e48"
export THEME_HINT="#d29922"
export THEME_SCHEME="tonalSpot"
export THEME_CONTRAST=0
rm -rf "$MDX/out"
docker run --rm --init -it \
-v "$MDX":/app/docs \
-e MDX \
-e NEXT_PUBLIC_LIBNAME \
-e BASE_PATH \
-e DIST_DIR="$MDX/out$BASE_PATH" \
-e OUTPUT \
-e HOME_REDIRECT \
-e MDX_BASEURL \
-e EDIT_BASEURL \
-e NEXT_PUBLIC_URL \
-e ICON \
-e LOGO \
-e GITHUB \
-e DISCORD \
-e THEME_PRIMARY \
-e THEME_HINT \
-e THEME_SCHEME \
-e THEME_CONTRAST \
pmndrs-docs npm run build
kill $(lsof -ti:"$_PORT")
npx serve $MDX -p $_PORT --no-port-switching --no-clipboard &
npx -y serve "$MDX/out" &
wait
)
Then go to: http://localhost:3000