Skip to main content

Write documentation

We place high importance on the consistency and readability of documentation. We aim to improve it as often as possible.

Documentation changes generally come in two forms:

  • General improvements: typo corrections, error fixes, and better explanations through clearer writing and more examples.

title: Write documentation

We place high importance on the consistency and readability of documentation. We aim to improve it as often as possible.

Documentation changes generally come in two forms:

  • General improvements: typo corrections, error fixes, and better explanations through clearer writing and more examples.

  • New features: documentation of features that have been added to the framework since the last release.

This section explains how writers can craft their documentation changes in the most useful and least error-prone ways.

Getting the raw documentation

Though Wechaty's documentation is intended to be read as HTML at https://wechaty.js.org/docs/, we edit it as a collection of markdown files for maximum flexibility. These files live in the top-level docusaurus/docs/ directory at Wechaty Website repository at https://github.com/wechaty/wechaty.js.org.

If you'd like to start contributing to our docs, get the latest version of Wechaty website from the website repository.

Getting started with Docusaurus

Wechaty's documentation uses the Docusaurus documentation system v2. The basic idea is that powered by markdown with JSX supported(MDX), built using React documentation.

To build the documentation locally, install NPM dependencies:

npm install

Then build the website:

npm run docusaurus:start

Our locally-built documentation will be themed differently than the documentation at Docusaurus docs introduction. This is OK! If the changes look good on the local machine, they'll look good on the website.

How the documentation is organized

The documentation is organized into several categories:

  • Tutorials take the reader by the hand through a series of steps to create something.

    The important thing in a tutorial is to help the reader achieve something useful, preferably as early as possible, to give them confidence.

    Explain the nature of the problem we're solving, so that the reader understands what we're trying to achieve. Don't feel that you need to begin with explanations of how things work - what matters is what the reader does, not what you explain. It can be helpful to refer back to what you've done and explain afterward.

  • Explainations aim to explain a concept or subject at a fairly high level.

    Link to reference material rather than repeat it. Use examples and don't be reluctant to explain things that seem very basic to you - it might be the explanation someone else needs.

    Providing background context helps a newcomer connect the topic to things that they already know.

  • References contain technical reference for APIs. They describe the functioning of Wechaty's internal machinery and instruct in its use.

    Keep reference material tightly focused on the subject. Assume that the the reader already understands the basic concepts involved but needs to know or be reminded of how Wechaty does it.

    Reference guides aren't the place for general explanation. If you find yourself explaining basic concepts, you may want to move that material to a topic guide.

  • How-to Guides are recipes that take the reader through steps in key subjects.

    What matters most in a how-to guide is what a user wants to achieve. A how-to should always be result-oriented rather than focused on internal details of how Wechaty implements whatever is being discussed.

    In how-to guides, users are expected to take the initiative and look for the information they need themselves. Contents in this section are organized as recipes to a cookbook. Each topic is independent and is named after the result that users will achieve after they follow the steps inside. With that said, the target audience for this section is those equipped with at least basic knowledge of Wechaty.

    These guides are more advanced than tutorials and assume some knowledge about how Wechaty works. Assume that the reader has followed the tutorials and don't hesitate to refer the reader back to the appropriate tutorial rather than repeat the same material.

Writing style

When using pronouns about a hypothetical person, such as "a user with a session cookie", gender-neutral pronouns (they/their/them) should be used. Instead of:

  • he or she... use they.
  • him or her... use them.
  • his or her... use theirs.
  • his or hers... use theirs.
  • himself or herself... use themselves.

Try to avoid using words that minimize the difficulty involved in a task or operation, such as "easily", "simply", "just", "merely", "straightforward", and so on. People's experience may not match the expectations, and they may become frustrated when they do not find a step as "straightforward" or "simple" as it is implied to be.

We are following the Google developer documentation style guide. We suggest that you follow it.

Commonly used terms

Here are some style guidelines on commonly used terms throughout the documentation:

  • Wechaty when referring to the framework, capitalize Wechaty.

  • email no hyphen.

  • TypeScript/JavaScript when referring to the language, capitalize TypeScript/JavaScript.

  • realize, customize, initialize, etc. use the American "ize" suffix, not "ise."

  • subclass it's a single word without a hyphen, both as a verb ("subclass that model") and as a noun ("create a subclass").

  • Web, World Wide Web, the Web note Web is always capitalized when referring to the World Wide Web.

  • website use one word, without capitalization.

Wechaty-specific terminology

  • Bot it's capitalized.

  • Chatbot it's capitalized.

  • Puppet it's capitalized.

  • Puppet Provider it's capitalized.

  • Puppet Service it's capitalized.

  • TOKEN it's all capitalized.

  • Wechaty Puppet Service Token it's capitalized.

  • Software Development Kit it's all capitalized.

  • Wechaty gRPC it's all capitalized.

Other than these words we are following this https://developers.google.com/style/word-list.

Guidelines for Markdown files

These guidelines regulate the format of our MD (Markdown) and MDX (Markdown + JSX) documentation:

  • In section titles, capitalize only initial words and proper nouns.

  • Wrap the documentation at 80 characters wide, unless a code example is significantly less readable when split over two lines, or for another good reason.

  • The main thing to keep in mind as you write and edit docs is that the more semantic markup you can add the better. So:

    Add `django.contrib.auth` to the `INSTALLED_APPS`...
  • Use these heading styles::

    # One

    ## Two

    ### Three

    #### Four

    ##### Five

    Refer to this for more: https://guides.github.com/features/mastering-markdown/.

Special Thanks

I have to credit Django doc authors, because this documentation page is inspired by, and mostly copy/pasted from Django contributing docs

  • New features: documentation of features that have been added to the framework since the last release.

This section explains how writers can craft their documentation changes in the most useful and least error-prone ways.