This repository contains the source code for Blocknet's API documentation website.
Powered by Slate Docs.
Using Windows 10:
Download & install ruby+devkit 2.4.7 x64 from here https://rubyinstaller.org/downloads/archives/.
Download & install nodejs from here https://nodejs.org/en/.
gem install bundler -v 1.16.1
# from root directory of api-docs
bundle install
bundle exec middleman server
Using Linux or MacOS:
# either run this to run locally
bundle install
bundle exec middleman server
# OR run this to run with vagrant
vagrant up
Using Docker:
Download and install docker.
# build the docker image
docker build -t blocknetdx/api-docs .
# run from the root directory of this project
docker run --rm --name api-docs -p 4567:4567 -v $(pwd)/source:/srv/api-docs/source blocknetdx/api-docs:latest serve
You can now see the docs at http://localhost:4567. This will reload automatically when changes are saved.
- Syntax - These documents use Markdown syntax.
- Content - For better maintenance, the content is composed of separate files in
source/includes/
. Add new files to the docs by including the file name underincludes:
insource/index.html.md
. This also adds the content as a menu item. - Layout - The page template is managed with
source/layouts/layout.erb
andsource/stylesheets/
. - Formatting Conventions:
- Styling:
- Italics - Referencing menu/button text (Settings, Submit, Cancel, etc)
- Bold+Italics - Word emphasis (available balances)
inline code
- code, commands (servicenode list
), calls (dxGetOrders
), file contents (ExchangeWallets=
), state (finished
), parameters (dryrun
) , files (blocknetdx.conf
), directories (BlocknetDX/
)
- Naming:
- Parameters - Lowercase, underscores (correct:
order_id
,orderid
; incorrect:order id
,order-id
,orderID
)
- Parameters - Lowercase, underscores (correct:
- Spacing:
- 10 lines separating each call
- 2 lines separating each section within a call
- 2 lines separating response types
- Styling:
- Add notes to
source/includes/_changelog.md
.- Use the following header format:
M/D/YYY | ---------- |
- Replace
M/D/YYY
with the publishing date in said format. - See past changelog entries for reference.
- Use the following header format:
- Build the docs with the
bundle exec middleman build
command.- Docker to build
docker run --rm --name api-docs -v $(pwd)/build:/srv/api-docs/build -v $(pwd)/source:/srv/api-docs/source blocknetdx/api-docs:latest
- Docker windows
docker run --rm --name api-docs -v %cd%/build:/srv/api-docs/build -v %cd%/source:/srv/api-docs/source blocknetdx/api-docs:latest
- Docker to build
- Deploy
build/
contents to staging site for testing. - Deploy
build/
contents to https://api.blocknet.org/ by copying all files and folders inbuild/
folder todocs/
folder, then committing the changes, then pushing the commit to themaster
branch of the api-docs repo on GitHub. On Mac/Linux, this step might look something like this:
cp -R build/* docs
git add .
git commit -m "publish changes"
git push
Note, if you don't have permissions to push to master
branch of the api-docs
repo, you'll need to push to a branch or fork of it, then make a Pull Request to have your changes merged to master
branch.
Hint: If you haven't yet committed your changes to markdown (.md
) files, and you want to review all your changes using git utilities like git status
and git diff
, you can exclude all the changes in the docs
folder from being considered by these tools by temporarily adding docs/
to the .gitignore
file.