Skip to content

Documentation and Help

A feature can bring its own documentation. Clarive shows it in the in-app help together with the product documentation, so the people of the installation read everything in one place, even without access to the internet. The header ? opens that help at the doc of the screen the user is on.

Where the docs go

CLARIVE_BASE/features/hello-react/
└── docs/
    ├── en/
    │   ├── hello-react.markdown             <- descriptor of the folder below (its title and order)
    │   └── hello-react/                     <- a folder named after the feature id
    │       ├── intro.markdown
    │       └── viewer.markdown
    └── es/
        └── ...                              <- the same paths, translated

Put the docs in a folder named after the feature id: it is unique, so it never mixes with a section of the product, and the paths stay short (hello-react/intro). Where the files live does not decide where the help shows them (see below).

Images go in the feature's public/, which the core serves: public/images/hello.png is at /feature/hello-react/images/hello.png, and that is the url to put in the image.

Each doc is a Markdown file with a YAML header:

---
title: Hello React
index: 100        # order inside its folder (lower first)
icon: page
---

Text in Markdown. `!!! note`, `!!! warning`... boxes work as on docs.clarive.com.
  • A folder gets a title and a place when a .markdown file with its name sits next to it (hello-react.markdown for hello-react/). A folder without one shows only its contents.
  • The path of a doc is its file path under docs/<lang>/, without extension: hello-react/intro. Links to it use that path with a leading slash (/hello-react/intro), and addHelp and useHelp take it as it is.
  • A header with search: 0 leaves the doc out of the search.
  • Links to docs of the product work as well: [topics](/concepts/topic).

How it is shown

The help (#/help) has every doc of the installation: the product docs and those of every installed feature. The docs of the features are gathered under This installation, first in the menu:

  • one section per feature, with the version of its feature.yml next to its name. If the feature brings a single documented folder (as above), that folder is the section, with its own title; otherwise its docs go in a section named after the name of its feature.yml;
  • the page of This installation lists the installed features with their versions;
  • the paths do not change: hello-react/intro is still #/help/hello-react/intro, wherever the menu puts it;
  • docs written for the people of one installation (procedures, conventions) come in the feature of that customer, the same way.

The pages of a feature carry a badge with its name and version (Hello React 0.1.0).

Languages

The help follows the user's language. A doc missing in it is shown in English, and if it is not in English either, in any other language it has: a customer who writes its docs in Spanish only still sees them with the interface in English. The page then says "This page is not available in ..., it is shown in ...".

docs.public

docs:
    public: true    # default false

The docs of a feature are private to the installation unless docs.public is exactly true. It marks the docs that may be published on docs.clarive.com. Publishing them there is not automated yet, so today it does not change what the in-app help shows; the help is where every feature doc is read.

The server validates the key. Anything wrong keeps the docs private and is logged once per process:

Feature hello-react: feature.yml docs.public must be true or false, docs kept private
Feature hello-react: feature.yml docs must be a mapping, e.g. docs: { public: false }, docs kept private
Feature hello-react: feature.yml docs.pubic is not a known key, ignored

The View on docs.clarive.com link of a page only shows where the site has that page: product docs that are pages, not folders, and outside This installation.

Contextual help: what the ? opens

The header ? opens the doc of the current screen. It is decided in this order:

  1. the doc of the latest mounted component that asked for one with sdk.useHelp(doc);
  2. the doc the ExtJS screen opened on the same route declared with Cla.help_push({ title, path });
  3. the doc a feature gave to its routes with sdk.addHelp(route, doc), the longest route wins;
  4. the core map of screens to docs (plugins/app/src/components/Help/helpContext.js);
  5. nothing: the help index.

From a feature (SDK 1.1, declare sdk: "^1.1" in feature.yml):

export default function register(sdk) {
    sdk.addRoute('/hello-react', () => <HelloPage />);
    sdk.addHelp('/hello-react', 'hello-react/intro');    // covers /hello-react/... too
    sdk.addComponent('RevisionViewer', RevisionViewer);
}

// RevisionViewer.jsx: painted inside the topic, a core screen
export default function RevisionViewer({ revision }) {
    const { useHelp } = useSdk();
    useHelp('hello-react/viewer');    // while it is on the screen
    ...
}

ExtJS screens of the core (root/comp, root/fields, root/dashlets...) keep declaring their doc with Cla.help_push({ title, path }) when they open; t/docs.t checks those paths exist.

cla docs-check --feature hello-react

checks the links of the feature docs (to its own docs and to the product ones), their anchors and images, and the doc paths of its sdk.addHelp / sdk.useHelp calls. It exits with 1 when something is broken, so the feature pipeline can run it. See cla docs.

Development workflow

When you change... Do this
A doc in docs/<lang>/ Reload the browser (the help keeps the menu for the session). The server picks up the change on the next request and rebuilds the search index.
docs.public in feature.yml Nothing: it is read on every request.
addHelp / useHelp npm run build in the feature and reload the browser.

Installing or upgrading a feature (cla migra-start) clears the server cache, so its new docs show after the restart.