Template Generator for Leetcode
About
This is a simple bookmarklet made for generating the files needed for my writeups on Jekyll-powered website. Instead of copy/pasting everything by hand, this extracts the problem description and solution code straight from Leetcode and also makes an empty page file complete with front matter already added in. It's extremely convienient!
My leetcode solutions site is organized in this way:
. ├── _descriptions/ │ ├── 123 example1.html │ └── 456 example2.html ├── _solutions/ │ ├── 123 example1.txt │ └── 456 example2.txt └── _writeups/ ├── 123 example1_w.html └── 456 example2_w.html
So the bookmarklet creates xxx name.html
,
xxx name.txt
, xxx name_w.html
which can easily be
moved to their respective folders. No special configurations are necessary
or anything.
How to use it
Since it's not a good idea to blindly execute JavaScript in your browser, you should look over the source code. Next you can either run that through a minifier and create a bookmarklet with that set as your URL or you can simply bookmark the link below (or drag it to your bookmark bar).
After that, simply go to any leetcode problem you've completed, make sure you are viewing the "Description" tab, and click the bookmarklet. Then make sure the text is correct and download your files. That's it.