Dump your LeetCode solutions, and generate a static website to show them.
npm install leetcode-dump
Dump your LeetCode solutions, and generate a static website to show them.
Install |
Usage |
GitHub Actions
- Dump your LeetCode solutions in multiple languages.
- Including code, note, runtime speed, memory usage, timestamp ...
- Generate a static website to show your solutions.
- Index page, code highlight, search bar ...
- See screenshots for more details.
- Easy to use.
- Through npx, GitHub Actions, or Docker.
- Customizable.
- You can use "template" -T to design what the website should look like.
You need Node.js 16+.
``sh`
npm i -g leetcode-dump
`sh
❯ leetcode-dump --help
Usage: leetcode-dump [options] [command]
Options:
-V, --version output the version number
-s, --session
-o, --output
-c, --clean Clear Output Dir Before Start (default: false)
-l, --limit
-t, --timezone
-p, --pure Pure Mode, No Additional Informations to Add (default: false)
-T, --template
-r, --retry
-v, --verbose [bool] Verbose Mode (default: true)
-h, --help display help for command
Commands:
build [options] Build static site from dumped solutions
transform [options] Transform dumped solutions to a Vuepress source
`
Example:
`sh`
leetcode-dump -s "eyJ0eXAiOiJKV1...AJFGlVhZ7f5QL8"
This will use Vuepress to build a static site from solutions dumped by leetcode-dump.
`sh
❯ leetcode-dump build --help
Usage: leetcode-dump build [options]
Build static site from dumped solutions
Options:
-s, --source
-o, --output
-T, --template
-c, --config
-v, --verbose [bool] Verbose Mode (default: true)
-h, --help display help for command
`
Example:
`sh`
leetcode-dump build
This will generate a Vuepress content source from solutions dumped by leetcode-dump.
It is similar to leetcode-dump build, but you can do more things to customize the content source, then use Vuepress to build static site by yourself.
`sh
❯ leetcode-dump transform --help
Usage: leetcode-dump transform [options]
Transform dumped solutions to a Vuepress source
Options:
-s, --source
-o, --output
-T, --template
-v, --verbose [bool] Verbose Mode (default: true)
-h, --help display help for command
`
Example:
`sh`
leetcode-dump transform
If you install leetcode-dump globally, you can use lcd, the alias of leetcode-dump, as a command line tool.
There is a Template, you can simply use it and setup in a minute.
The docker image is available on Docker Hub.
You can simply run it by using docker run:
`sh`See Help
docker run --rm jacoblincool/leetcode-dump --help--rm: remove container after exit
`sh`Dump Solutions and Notes
docker run --rm -v $(pwd)/leetcode:/usr/workspace/leetcode jacoblincool/leetcode-dump -s "YOUR_LEETCODE_SESSION"--rm: remove container after exit
-v: mount volume, {current directory}/leetcode (host) <-> /usr/workspace/leetcode (container)
`sh`Build Static Site
docker run --rm -v $(pwd)/leetcode:/usr/workspace/leetcode -v $(pwd)/site:/usr/workspace/site jacoblincool/leetcode-dump build--rm: remove container after exit
-v: mount volumes:
{current directory}/leetcode (host) <-> /usr/workspace/leetcode (container)
{current directory}/site (host) <-> /usr/workspace/site (container)
You can simply change the mounted host volume to any location you want.
If you want to change the mounted container volume, you should also pass related options to leetcode-dump:
`shCustom Mounted Volumes
docker run --rm -v $(pwd)/solutions:/lc/sol jacoblincool/leetcode-dump -s "YOUR_LEETCODE_SESSION" -o /lc/sol
docker run --rm -v $(pwd):/lc jacoblincool/leetcode-dump build -s /lc/solutions -o /lc/site
> You can add
-t to docker run` to enable more beautiful log.