Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Electron document style guide


May 25, 2021 Electron


Table of contents


Title

  • At the top of each page, there must be a the level.
  • Chapters on the same page must have ## of title.
  • Sub-chapters need to increase the number of hashtags in the title based on depth.
  • All initials in the page title must be capital, except for connecting words such as "of" and "and".
  • Only the first initial of the chapter title must be capital.

Take the example Quick Start

# Quick Start

...

## Main process

...

## Renderer process

...

## Run your app

...

### Run as a distribution

...

### Manually downloaded Electron binary

...

For API references, you can make exceptions to these rules.

Markdown rules

  • Use bash instead bash the block of code cmd to syntax highlighting problems).
  • The row length should be controlled within 80 columns.
  • List nesting does not exceed level 2 (due to Markdown rendering issues).
  • All js and javascript blocks of code are marked as standard-markdown .

Use word selection

  • Use "will" instead of "will" when describing the results.
  • Preferred "in the process" over "on".

API reference

The following rules apply only to documents for the API.

The title of the page

Each page must be require('electron') BrowserWindow autoUpdater and session

Under the page title must be > description that begins with .

Take an example session

# session

> Manage browser sessions, cookies, cache, proxy settings, etc.

Module methods and events

For non-class modules, their methods and events must be listed in the sections of The ## Methods and ## Events

Take an autoUpdater

# autoUpdater

## Events

### Event: 'error'

## Methods

### `autoUpdater.setFeedURL(url[, requestHeaders])`

Class

  • API classes or classes that are part of a module must be listed in the section . . ## Class: TheClassName
  • A page can have more than one class.
  • Constructors must be ### of title.
  • Static methods ### Static Methods section of .
  • The instance method must be listed in the section of the . . ### Instance Methods
  • All methods with return values must be described in the form of [TYPE] ( TYPE ) - Return Description".
    • If the method returns an Object can use a colon followed by a line break and then specify its structure using a sequenceless table of properties of the same style as the function parameters.
  • Instance events must be listed in the section of . . . ### Instance Events
  • Instance properties ### Instance Properties section of . . . Instance Properties.
    • The instance property must be "A (Property Type) ..." Start describing.

The Session and Cookies here as examples:

# session

## Methods

### session.fromPartition(partition)

## Properties

### session.defaultSession

## Class: Session

### Instance Events

#### Event: 'will-download'

### Instance Methods

#### `ses.getCacheSize(callback)`

### Instance Properties

#### `ses.cookies`

## Class: Cookies

### Instance Methods

#### `cookies.get(filter, callback)`

Method

Method chapters must take the following form:

### `objectName.methodName(required[, optional]))`

* `required` String - A parameter description.
* `optional` Integer (optional) - Another parameter description.

...

The title can ### and the #### on whether it is a module or a method of the class.

For modules, objectName name of the module. For a class, it must be the name of the instance of the class and cannot be the same as the name of the module.

For example, session of the Session class under the Session ses objectName

Optional parameters are represented by square brackets [] parameters, and if this optional parameter follows another parameter, a comma is required:

required[, optional]

The following method is more detailed information for each parameter. The types of arguments are represented by common types:

If parameters or methods are unique to some platforms, they are represented by an italic list separated by spaces after the data type. The values can macOS Windows Linux

* `animate` Boolean (optional) _macOS_ _Windows_ - Animate the thing.

Array parameters, which must describe the elements that may be included in the description below the specified array.

Function of the Function type parameter should clearly describe how it was called and list the types of parameters that will be passed to it.

Event

The event chapter must take the following form:

### Event: 'wake-up'

Returns:

* `time` String

...

The title can ### or the #### on whether it is a module or a class event.

The parameters of the event follow the same rules as the method.

Property

The property chapter must take the following form:

### session.defaultSession

...

The title can ### and the #### on whether it is a module or a class property.

Document translation

The translation file for the Electron document is docs-translations directory.

To add another set of settings (or part of it):

  • Create a subdirecte named after a language abbreviation.
  • Translate the file.
  • Update the files in README.md link to translated files.
  • A link added to the translation catalog on Electron's main README.

Please note that docs-translations can only contain files that have been translated and should not be copied there.