web/versioned_docs/version-0.14/writingguide.md
Our docs are the first touch point for new Wasp users. It's the top of our funnel. If we lose them on the docs, they will never get a chance to use Wasp (even if they might like it).
This guide combines the excellent Vue Docs Writing Guide and our own learnings from the process of writing documentation. We've copied many of the points (mostly) verbatim, removed some that don't apply to Wasp, and added some that do. We've also changed examples to be more relevant for Wasp.
Writing the docs will take longer than you expect (even if you expect it will take a long time). To make the process as painless as possible, read this guide thoroughly(with particular emphasis on the Processes section).
Each feature page is divided into two sections: The guide, and The API reference.
The guide tells a story about a feature and takes the reader through a step-by-step process to get the feature working. It goes through the feature's most important parts and does not have to be exhaustive. The goal is to provide 20% of the knowledge that helps users handle 80% of use cases.
The guide is almost a tutorial, the only difference being that it can assume some context for the rest of the application. The text can link to parts of the API reference, but you should avoid such links in most cases. When you provide them, you also need to provide a context so users know whether they should follow this link on their first reading. Otherwise, many users end up exhausting their cognitive capacity link-hopping, trying to fully learn every aspect of a feature before moving on, and as a result, never finish that first read-through of the guide. Remember that a smooth read is more important than being thorough. We want to give people the information they need to avoid a frustrating experience, but they can always come back and read further, or Google a less common problem when they encounter it.
The API reference is an exhaustive list of the feature's API and must describe everything:
Both the guide and the API Reference should be self-sufficient and contain examples showcasing the feature. Always assume that the reader is only reading one or the other. The guide doesn't need to explain everything about the feature, only the most important bits, but the API reference must be exhaustive.
Make sure to feature each example in all languages Wasp supports (currently TypeScript and JavaScript) using tabs. You should almost always use tabs, even when there's no difference between the example in TypeScript and the example in JavaScript. This might seem redundant, but it makes our examples future-proof and helps reassure the reader we haven't forgotten about their language.
useQuery hook" because it describes a solution.
A better heading might be "Making Query data reactive" because it provides the context of the problem the useQuery hook solves.
Users won't start paying attention to the explanation of a feature until they have some idea of why/when they'd use it.useQuery hook" (then show import and usage of the useQuery hook), instead of "To make the data Query returns reactive, you can pass it into the useQuery hook and destructure the data field from the returned object."<BlogPost> component example is better than <ComponentA>.<BlogPost> component example is better than <CurrencyExchangeSettings>.attribute is better than attr, message is better than msg), unless you want to specifically reference an abbreviation in the API (e.g., the auth declaration). Abbreviation symbols included on standard keyboards (e.g., @, #, &) are OK.:) to end a sentence, rather than a period (.).Always use relative links (e.g. ../../overview.md) to link to other pages, unless you are writing a reusable snippet.
Never use absolute links starting with /docs because they break our versioned docs, instead use links "absolute to the file root".
Writing a link "absolute to the file root":
/ represents the docs folder).md)For example, /docs/introduction should be written as /introduction/introduction.md because this file is located at ./docs/introduction/introduction.md.
Or another example /docs/auth/entities#accessing-the-auth-fields becomes /auth/entities/entities.md#accessing-the-auth-fields. This file is located at ./docs/auth/entities/entities.md.