Markdown header fixes

This commit is contained in:
Paul-Vincent Roll 2017-06-11 23:44:43 +02:00 committed by GitHub
parent ca92a0af5c
commit 9f822c0991

View File

@ -44,27 +44,27 @@ As you can see, the `Module.register()` method takes two arguments: the name of
### Available module instance properties
After the module is initialized, the module instance has a few available module properties:
####`this.name`
#### `this.name`
**String**
The name of the module.
####`this.identifier`
#### `this.identifier`
**String**
This is a unique identifier for the module instance.
####`this.hidden`
#### `this.hidden`
**Boolean**
This represents if the module is currently hidden (faded away).
####`this.config`
#### `this.config`
**Boolean**
The configuration of the module instance as set in the user's config.js file. This config will also contain the module's defaults if these properties are not over written by the user config.
####`this.data`
#### `this.data`
**Object**
The data object contains additional metadata about the module instance:
@ -75,10 +75,10 @@ The data object contains additional metadata about the module instance:
- `data.position` - The position in which the instance will be shown.
####`defaults: {}`
#### `defaults: {}`
Any properties defined in the defaults object, will be merged with the module config as defined in the user's config.js file. This is the best place to set your modules's configuration defaults. Any of the module configuration properties can be accessed using `this.config.propertyName`, but more about that later.
####'requiresVersion:'
#### `requiresVersion:`
*Introduced in version: 2.1.0.*
@ -93,10 +93,10 @@ requiresVersion: "2.1.0",
### Subclassable module methods
####`init()`
#### `init()`
This method is called when a module gets instantiated. In most cases you do not need to subclass this method.
####`loaded(callback)`
#### `loaded(callback)`
*Introduced in version: 2.1.1.*
@ -111,7 +111,7 @@ loaded: function(callback) {
}
````
####`start()`
#### `start()`
This method is called when all modules are loaded an the system is ready to boot up. Keep in mind that the dom object for the module is not yet created. The start method is a perfect place to define any additional module properties:
**Example:**
@ -122,7 +122,7 @@ start: function() {
}
````
####`getScripts()`
#### `getScripts()`
**Should return: Array**
The getScripts method is called to request any additional scripts that need to be loaded. This method should therefore return an array with strings. If you want to return a full path to a file in the module folder, use the `this.file('filename.js')` method. In all cases the loader will only load a file once. It even checks if the file is available in the default vendor folder.
@ -142,7 +142,7 @@ getScripts: function() {
**Note:** If a file can not be loaded, the boot up of the mirror will stall. Therefore it's advised not to use any external urls.
####`getStyles()`
#### `getStyles()`
**Should return: Array**
The getStyles method is called to request any additional stylesheets that need to be loaded. This method should therefore return an array with strings. If you want to return a full path to a file in the module folder, use the `this.file('filename.css')` method. In all cases the loader will only load a file once. It even checks if the file is available in the default vendor folder.
@ -161,7 +161,7 @@ getStyles: function() {
````
**Note:** If a file can not be loaded, the boot up of the mirror will stall. Therefore it's advised not to use any external urls.
####`getTranslations()`
#### `getTranslations()`
**Should return: Dictionary**
The getTranslations method is called to request translation files that need to be loaded. This method should therefore return a dictionary with the files to load, identified by the country's short name.
@ -179,7 +179,7 @@ getTranslations: function() {
````
####`getDom()`
#### `getDom()`
**Should return:** Dom Object
Whenever the MagicMirror needs to update the information on screen (because it starts, or because your module asked a refresh using `this.updateDom()`), the system calls the getDom method. This method should therefore return a dom object.
@ -194,7 +194,7 @@ getDom: function() {
````
####`getHeader()`
#### `getHeader()`
**Should return:** String
Whenever the MagicMirror needs to update the information on screen (because it starts, or because your module asked a refresh using `this.updateDom()`), the system calls the getHeader method to retrieve the module's header. This method should therefor return a string. If this method is not subclassed, this function will return the user's configured header.
@ -211,7 +211,7 @@ getHeader: function() {
````
####`notificationReceived(notification, payload, sender)`
#### `notificationReceived(notification, payload, sender)`
That MagicMirror core has the ability to send notifications to modules. Or even better: the modules have the possibility to send notifications to other modules. When this module is called, it has 3 arguments:
@ -237,7 +237,7 @@ notificationReceived: function(notification, payload, sender) {
- `DOM_OBJECTS_CREATED` - All dom objects are created. The system is now ready to perform visual changes.
####`socketNotificationReceived: function(notification, payload)`
#### `socketNotificationReceived: function(notification, payload)`
When using a node_helper, the node helper can send your module notifications. When this module is called, it has 2 arguments:
- `notification` - String - The notification identifier.
@ -253,10 +253,10 @@ socketNotificationReceived: function(notification, payload) {
},
````
####`suspend()`
#### `suspend()`
When a module is hidden (using the `module.hide()` method), the `suspend()` method will be called. By subclassing this method you can perform tasks like halting the update timers.
####`resume()`
#### `resume()`
When a module is requested to be shown (using the `module.show()` method), the `resume()` method will be called. By subclassing this method you can perform tasks restarting the update timers.
@ -265,13 +265,13 @@ When a module is requested to be shown (using the `module.show()` method), the `
Each module instance has some handy methods which can be helpful building your module.
####`this.file(filename)`
#### `this.file(filename)`
***filename* String** - The name of the file you want to create the path for.<br>
**Returns String**
If you want to create a path to a file in your module folder, use the `file()` method. It returns the path to the filename given as the attribute. Is method comes in handy when configuring the [getScripts](#getscripts) and [getStyles](#getstyles) methods.
####`this.updateDom(speed)`
#### `this.updateDom(speed)`
***speed* Number** - Optional. Animation speed in milliseconds.<br>
Whenever your module need to be updated, call the `updateDom(speed)` method. It requests the MagicMirror core to update its dom object. If you define the speed, the content update will be animated, but only if the content will really change.
@ -289,7 +289,7 @@ start: function() {
...
````
####`this.sendNotification(notification, payload)`
#### `this.sendNotification(notification, payload)`
***notification* String** - The notification identifier.<br>
***payload* AnyType** - Optional. A notification payload.<br>
@ -300,7 +300,7 @@ If you want to send a notification to all other modules, use the `sendNotificati
this.sendNotification('MYMODULE_READY_FOR_ACTION', {foo:bar});
````
####`this.sendSocketNotification(notification, payload)`
#### `this.sendSocketNotification(notification, payload)`
***notification* String** - The notification identifier.<br>
***payload* AnyType** - Optional. A notification payload.<br>
@ -311,7 +311,7 @@ If you want to send a notification to the node_helper, use the `sendSocketNotifi
this.sendSocketNotification('SET_CONFIG', this.config);
````
####`this.hide(speed, callback, options)`
#### `this.hide(speed, callback, options)`
***speed* Number** - Optional (Required when setting callback or options), The speed of the hide animation in milliseconds.
***callback* Function** - Optional, The callback after the hide animation is finished.
***options* Function** - Optional, Object with additional options for the hide action (see below). (*Introduced in version: 2.1.0.*)
@ -328,7 +328,7 @@ Possible configurable options:
**Note 3:** If the dom is not yet created, the hide method won't work. Wait for the `DOM_OBJECTS_CREATED` [notification](#notificationreceivednotification-payload-sender).
####`this.show(speed, callback, options)`
#### `this.show(speed, callback, options)`
***speed* Number** - Optional (Required when setting callback or options), The speed of the show animation in milliseconds.
***callback* Function** - Optional, The callback after the show animation is finished.
***options* Function** - Optional, Object with additional options for the show action (see below). (*Introduced in version: 2.1.0.*)
@ -344,7 +344,7 @@ Possible configurable options:
**Note 2:** If the show animation is hijacked (an other method calls show on the same module), the callback will not be called.<br>
**Note 3:** If the dom is not yet created, the show method won't work. Wait for the `DOM_OBJECTS_CREATED` [notification](#notificationreceivednotification-payload-sender).
####Visibility locking
#### Visibility locking
(*Introduced in version: 2.1.0.*)
@ -401,7 +401,7 @@ Use this `force` method with caution. See `show()` method for more information.
####`this.translate(identifier)`
#### `this.translate(identifier)`
***identifier* String** - Identifier of the string that should be translated.
The Magic Mirror contains a convenience wrapper for `l18n`. You can use this to automatically serve different translations for your modules based on the user's `language` configuration.
@ -429,7 +429,7 @@ this.translate("INFO") //Will return a translated string for the identifier INFO
**Note:** although comments are officially not supported in JSON files, MagicMirror allows it by stripping the comments before parsing the JSON file. Comments in translation files could help other translators.
#####`this.translate(identifier, variables)`
##### `this.translate(identifier, variables)`
***identifier* String** - Identifier of the string that should be translated.
***variables* Object** - Object of variables to be used in translation.
@ -492,17 +492,17 @@ Of course, the above helper would not do anything useful. So with the informatio
### Available module instance properties
####`this.name`
#### `this.name`
**String**
The name of the module
####`this.path`
#### `this.path`
**String**
The path of the module
####`this.expressApp`
#### `this.expressApp`
**Express App Instance**
This is a link to the express instance. It will allow you to define extra routes.
@ -521,13 +521,13 @@ start: function() {
this.expressApp.use("/" + this.name, express.static(this.path + "/public"));
````
####`this.io`
#### `this.io`
**Socket IO Instance**
This is a link to the IO instance. It will allow you to do some Socket.IO magic. In most cases you won't need this, since the Node Helper has a few convenience methods to make this simple.
####'requiresVersion:'
#### `requiresVersion:`
*Introduced in version: 2.1.0.*
A string that defines the minimum version of the MagicMirror framework. If it is set, the system compares the required version with the users version. If the version of the user is out of date, it won't run the module.
@ -541,10 +541,10 @@ requiresVersion: "2.1.0",
### Subclassable module methods
####`init()`
#### `init()`
This method is called when a node helper gets instantiated. In most cases you do not need to subclass this method.
####`start()`
#### `start()`
This method is called when all node helpers are loaded and the system is ready to boot up. The start method is a perfect place to define any additional module properties:
**Example:**
@ -555,7 +555,7 @@ start: function() {
}
````
####`socketNotificationReceived: function(notification, payload)`
#### `socketNotificationReceived: function(notification, payload)`
With this method, your node helper can receive notifications from your modules. When this method is called, it has 2 arguments:
- `notification` - String - The notification identifier.
@ -574,7 +574,7 @@ socketNotificationReceived: function(notification, payload) {
Each node helper has some handy methods which can be helpful building your module.
####`this.sendSocketNotification(notification, payload)`
#### `this.sendSocketNotification(notification, payload)`
***notification* String** - The notification identifier.<br>
***payload* AnyType** - Optional. A notification payload.<br>
@ -594,7 +594,7 @@ The core Magic Mirror object: `MM` has some handy method that will help you in c
### Module selection
The only additional method available for your module, is the feature to retrieve references to other modules. This can be used to hide and show other modules.
####`MM.getModules()`
#### `MM.getModules()`
**Returns Array** - An array with module instances.<br>
To make a selection of all currently loaded module instances, run the `MM.getModules()` method. It will return an array with all currently loaded module instances. The returned array has a lot of filtering methods. See below for more info.
@ -602,7 +602,7 @@ To make a selection of all currently loaded module instances, run the `MM.getMod
**Note:** This method returns an empty array if not all modules are started yet. Wait for the `ALL_MODULES_STARTED` [notification](#notificationreceivednotification-payload-sender).
#####`.withClass(classnames)`
##### `.withClass(classnames)`
***classnames* String or Array** - The class names on which you want to filter.
**Returns Array** - An array with module instances.<br>
@ -615,7 +615,7 @@ var modules = MM.getModules().withClass('classname1 classname2');
var modules = MM.getModules().withClass(['classname1','classname2']);
````
#####`.exceptWithClass(classnames)`
##### `.exceptWithClass(classnames)`
***classnames* String or Array** - The class names of the modules you want to remove from the results.
**Returns Array** - An array with module instances.<br>
@ -628,7 +628,7 @@ var modules = MM.getModules().exceptWithClass('classname1 classname2');
var modules = MM.getModules().exceptWithClass(['classname1','classname2']);
````
#####`.exceptModule(module)`
##### `.exceptModule(module)`
***module* Module Object** - The reference to a module you want to remove from the results.
**Returns Array** - An array with module instances.<br>
@ -646,7 +646,7 @@ Of course, you can combine all of the above filters:
var modules = MM.getModules().withClass('classname1').exceptwithClass('classname2').exceptModule(aModule);
````
#####`.enumerate(callback)`
##### `.enumerate(callback)`
***callback* Function(module)** - The callback run on every instance.
If you want to perform an action on all selected modules, you can use the `enumerate` function: