docs/static/v0.6/project/contributing/contributing-docs/index.html
Before contributing, please review the Documentation Contribution Flow. In the following steps you will set up your development environment, fork and clone the repository, run the site locally, and finally commit, sign-off, and push any changes made for review.
See the Meshery Documentation Design Specification which serves to provide an overview of the tooling and approach used to create Meshery’s documentation and it information architecture.
Meshery documentation is made of these components:
The Meshery Docs site is built using Jekyll - a simple static site generator. Jekyll can be installed on different platforms like Windows, Linux, and MacOS by the following steps
Note: Windows users can run Jekyll by following the Windows Installation Guide and also installing Ruby Version Manager RVM. RVM is a command-line tool which allows you to work with multiple Ruby environments on your local machine. Alternatively, if you’re running Windows 10 version 1903 Build 18362 or higher, you can upgrade to Windows Subsystem for Linux WSL and run Jekyll in Linux instead.
`sudo apt update
sudo apt install curl g++ gnupg gcc autoconf automake bison build-essential libc6-dev \
libffi-dev libgdbm-dev libncurses5-dev libsqlite3-dev libtool \
libyaml-dev make pkg-config sqlite3 zlib1g-dev libgmp-dev \
libreadline-dev libssl-dev
sudo gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
curl -sSL https://get.rvm.io | sudo bash -s stable
sudo usermod -a -G rvm `whoami``
If gpg --keyserver gives an error, you can use:
`sudo gpg --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3`
or
`sudo gpg2 --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB`
Restart your WSL VM before moving forward.
For installing Ruby, run:
Update the Gemfile located in meshery/docs directory
ruby '3.0.2'
Note: In place of 3.0.2 add your installed version
gem 'wdm','>=0.1.0' if Gem.win_platform?
Note: This is just a workaround for your local machine so do not commit or push the modified Gemfile or Gemfile.lock during Pull Requests
Next, go to this folder on your device C:\Ruby24-x64\lib\ruby\gems\2.4.0\gems\eventmachine-1.2.5-x64-mingw32\lib
Add require 'em/pure_ruby' in the first line of the eventmachine.rb file
`sudo apt-get update
sudo apt-get install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev`
`git clone https://github.com/rbenv/rbenv.git ~/.rbenv`
Note: Change bashrc with your shell specific rc file, for eg: if you are using zsh then the filename is zshrc.
`echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc`
`echo 'eval "$(rbenv init -)"' >> ~/.bashrc`
`source ~/.bashrc`
`type rbenv`
`rbenv install 2.7.5`
`rbenv install --list`
`rbenv global version`
`ruby -v`
Note: In case of any installation issues, use the discussion forum.
`git clone https://github.com/YOUR-USERNAME/meshery`
`cd docs`
`gem install bundler
bundle install`
Note: If you are a Mac user you do not need to install the Ruby dependencies, after moving on to the docs directory, you can serve the site.
`make docs`
`bundle exec jekyll serve --drafts --config _config_dev.yml`
From the Makefile, this command is actually running $ bundle exec jekyll serve --drafts --livereload --config _config_dev.yml. If this command causes errors try running the server without Livereload with this command: $ bundle exec jekyll serve --drafts --config _config_dev.yml. Just keep in mind you will have to manually restart the server to reflect any changes made without Livereload. There are two Jekyll configuration, jekyll serve for developing locally and jekyll build when you need to generate the site artefacts for production.
If you’ve Docker and make installed in your system, then you can serve the site locally
`make docker`
This doesn’t require the need for installing Jekyll and Ruby in your system
But, you need to make sure that GNU make is working in your system (might not work in Windows)
While performing the above step, if you’re facing errors with a message like below…
Your ruby version is x.x.x but your Gemfile specified 2.7.x
This is because Jekyll always considers the exact version of Ruby unlike JavaScript.
So, you need to follow either of the three steps to resolve this problem;
rvm or by any means given abovemake docker-docs to view the changesGemfile as below (not recommended! Do only if above two steps fail):source "https://rubygems.org"
ruby '2.7.5' //to any version you have installed
Automatically the Gemfile.lock will update once the make docs is given (for Windows, run bundle exec jekyll serve if WSL2 isn’t present)
WARNING: If you have followed the third step then please don’t commit the changes made on Gemfile and Gemfile.lock in your branch to preserve integrity, else the CI action will fail to generate the site preview during PR.
make docs`git commit -s -m “my commit message w/signoff”`
`git push origin <branch-name>`
Most popular clipboard plugins like Clipboard JS require the manual creation of a new ID for each code snippet. A different approach is used here. For code snippets, we either use html tags or markdown in the following manner:
`<pre class="codeblock-pre"><div class="codeblock">
<code class="clipboardjs">code_snippet_here</code>
</div></pre>`
You can also use the code component created for this feature to make it easy to use. It can be used by including code.html and then passing the code snippet to it.
If the code snippet does not cotain any special characters then, it can be used directly like,
{% include code.html code="code_snippet_here" %}.
If the code snippet has special characters then we need to capture it first in variable code_content like this,
{% capture code_content%}code_snippet_here{% endcapture %}
and then pass it to the component like this,
{% include code.html code=code_content %}.
That’s it.
NOTE: Don’t use code component when the snippet is in between an ordered list, it breaks the order and next item in the list will have numbering from 1. So better use <pre class="codeblock_pre">...</pre> method above instead when the snippet is in between an ordered list.
A full block:
````code snippet````
Inline formatting:
`\`code snippet\`: `code snippet``
Language specific:
````(language name)
code snippet
Whenever the code tags are detected, the clipboard javascript file is automatically loaded. Each code element is given a custom id and a clipboard-copy icon to copy the content.
## Documentation Contribution Flow Summary
**NOTE: For contributing `mesheryctl` reference section, refer [Contributing CLI](/v0.6/contributing-cli)**
The following is a concise summary of the steps to contribute to Meshery documentation.
1. Create a fork, if you have not already, by following the steps described [here](/v0.6CONTRIBUTING-gitflow.md)
2. In the local copy of your fork, navigate to the docs folder. `cd docs`
3. Create and checkout a new branch to make changes within `git checkout -b <my-changes>`
4. Edit/add documentation. `vi <specific page>.md`
5. Add redirect link on the old page (only when a new page is created that replaces the old page)
6. Run site locally to preview changes. `make docs`
7. Commit, [sign-off](/v0.6#commit-signing), and push changes to your remote branch. `git push origin <my-changes>`
8. Open a pull request (in your web browser) against the repo: https://github.com/meshery/meshery.
### Navigation Table of Contents in Sidebar (toc)
Sidebars use toc to create a table of contents. It is written in the following manner:
toc:
The output of the code snippet would be:
Group 1 Thing 1 Thing 2 Thing 3
### Alerts
#### What is an alert?
An alert is a box that can stand out to indicate important information. You can choose from levels success, warning, danger, info, and primary. This example is an info box, and the code for another might look like this:
{% include alert.html type="info" title="Here is another!" %}
Just for fun, here are all the types:
#### warning
This is a warning
#### danger
This alerts danger!
#### success
This alerts success
#### info
This is useful information.
#### primary
This is a primary alert
#### secondary
This is a secondary alert
### Alerts
#### What is an alert?
An alert is a box that can stand out to indicate important information. You can choose from levels success, warning, danger, info, and primary. This example is an info box, and the code for another might look like this:
{% include alert.html type="info" title="Here is another!" %}
Just for fun, here are all the types:
#### warning
This is a warning
#### danger
This alerts danger!
#### success
This alerts success
#### info
This is useful information.
#### primary
This is a primary alert
#### secondary
This is a secondary alert
### Quotes
You can include block quotes to emphasize text.
> Here is an example. Isn’t this much more prominent to the user?
## Development
### Editable Intra-page Table of Contents Toolbar
Control the display of this intra-page navigator with either page level or layout level frontmatter variables:
`display-toolbar`
Set to `true` (make “editable” toolbar visible) or `false` (hide “editable” toolbar)
### `if` conditional
This executes the block of code only if the given condition is true. It is executed in the following manner:
{% if product.title == 'Awesome Shoes' %} These shoes are awesome! {% endif %}
If the condition is true, the output would be:
These shoes are awesome!
### `for` loop
The for statement executes a block of code repeatedly. It is wriiten in the following manner:
{% for names in collection.names %} {{ name.title }} {% endfor %}
The output produced by the above code snippet:
Sam Ham Ethan
### Comment
Comments allow to leave a block of code unattended, any statements between opening and closing comment would not be executed.
### Include
The above tag is used to insert a already rendered file within the current template. It is written in the following manner:
{% include file.html %}
### Assign
The assign tag is used to create a new variable. It is written in the following manner:
{% assign variable1 = true %}
## Suggested Reading