Quick Pull Request
Thank you for considering to contribute to our seeed-studio files!
This streamlined contribution process, is to be able to quickly PR files(no need deploy websites locally). If you want to check the changes or the page adding locally, you can click here.
All IN ONE code
Image you only add md files and images:
Please visit the Seeed Studio Wiki Platform's Github Repository and then
fork
the 'wiki-documents' repository of your own.Copy all code in once and run the commands(remember replace
{your repo}
as your forked repo):
For example, if my GitHub username is MatthewJeffson
, my first command is: git clone --no-checkout --depth 1 https://github.com/MatthewJeffson/wiki-documents.git
git clone --no-checkout --depth 1 https://github.com/{your repo}}/wiki-documents.git
cd wiki-documents
git sparse-checkout init --cone
git sparse-checkout set sidebars.js docs
git switch docusaurus-version
git pull origin docusaurus-version
There will be a foler called "wiki-documents" in your PC.
- Store all files(The markdown files and pictures) in the "Contributor_Files" folder:
- Push all files to the GitHub, running these commands:
git add .
git commit -m "Add new document"
git push origin docusaurus-version
- Click "Pull Request" on your side repo and everything is done.
STEP BY STEP Introduction with Auto-Check
Here are the introduction for the above, and presenting Auto-check codes.
First, clone the repository using the following command:
git clone --no-checkout --depth 1 https://github.com/Seeed-Studio/wiki-documents.git
Here, we use two options:
--no-checkout
: Clone the repository without checking out any files, only fetching the repository metadata. This speeds up the cloning process.--depth 1
: Clone only the latest commit of files and metadata, without fetching the entire history. This further reduces the amount of data downloaded.
After cloning, navigate to the repository directory:
cd wiki-documents
Next, enable Git's sparse checkout feature:
git sparse-checkout init --cone
Sparse checkout allows checking out only a subset of files in the repository, rather than the entire repository. The
--cone
option enables the cone mode, which supports more flexible path matching.Then, configure the sparse checkout rules:
git sparse-checkout set sidebars.js docs
This command tells Git to check out only the
sidebars.js
file and thedocs
directory.sidebars.js
is the Docusaurus configuration file, and thedocs
directory contains all the Markdown documents.After configuring the sparse checkout rules, ensure you switch to the
docusaurus-version
branch:git switch docusaurus-version
This step is necessary because the documentation is developed and maintained on this branch.
After switching to the target branch, pull the configured files and directories:
git pull origin docusaurus-version
This command pulls the latest version of
sidebars.js
anddocs
from thedocusaurus-version
branch of the remote repository.Now, contributors can add new Markdown files in the
docs
directory and modify thesidebars.js
file to add the paths of the new documents.After adding new documents, use the Lint Markdown tool to check the syntax of the new files:
npm install -g @lint-md/cli
npx @lint-md/cli docs/new-file.mdIf there are any syntax errors or violations of conventions in the new files, Lint Markdown will provide prompts. Contributors can make modifications based on the prompts until there are no error messages.
If contributors want to automatically fix some common syntax errors, they can use the
--fix
option:npx @lint-md/cli docs/new-file.md --fix
This command will automatically fix some common formatting issues, such as missing spaces between Chinese and English text, incorrect use of ellipsis, etc.
Finally, after completing all modifications, contributors can commit the changes and push to the remote repository:
git add .
git commit -m "Add new document"
git push origin docusaurus-versionWith this, the new document is successfully added to the
docusaurus-version
branch of the remote repository.
By using the Lint Markdown tool in steps 8 and 9, we can ensure that the newly added documents adhere to the conventions, improving the overall quality and consistency of the documentation.
This streamlined contribution process, along with the use of sparse checkout and Lint Markdown, optimizes the workflow for contributors, making it more efficient and user-friendly.