Closes #529. Improve documentation generation for package options
Show difference between Atom Beautify package option and language config options in generated documentation
This commit is contained in:
parent
330abeedc9
commit
4e528809f0
|
@ -40,6 +40,31 @@ Handlebars.registerHelper('linkify', (title, options) ->
|
|||
)
|
||||
)
|
||||
|
||||
exampleConfig = (option) ->
|
||||
# console.log(option)
|
||||
t = option.type
|
||||
d = switch
|
||||
when option.default? then option.default
|
||||
when t is "string" then ""
|
||||
when t is "integer" then 0
|
||||
when t is "boolean" then false
|
||||
else null
|
||||
|
||||
json = {}
|
||||
namespace = option.language.namespace
|
||||
k = option.key
|
||||
c = {}
|
||||
c[k] = d
|
||||
json[namespace] = c
|
||||
return """```json
|
||||
#{JSON.stringify(json, undefined, 4)}
|
||||
```"""
|
||||
|
||||
Handlebars.registerHelper('example-config', (key, option, options) ->
|
||||
results = exampleConfig(key, option)
|
||||
# console.log(results)
|
||||
return new Handlebars.SafeString(results)
|
||||
)
|
||||
|
||||
context = {
|
||||
packageOptions: packageOptions
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
#### {{#if title}} {{#linkify title}}{{title}}{{/linkify}} {{else}} {{#linkify @key}}`{{@key}}`{{/linkify}} {{/if}}
|
||||
|
||||
**Key**: `{{@key}}`
|
||||
{{#if beautifiers}}
|
||||
**Namespace**: `{{language.namespace}}`
|
||||
|
||||
**Key**: `{{key}}`
|
||||
{{else}}
|
||||
**Important**: This option is only configurable from within Atom Beautify's setting panel.
|
||||
{{/if}}
|
||||
{{#if default}}
|
||||
|
||||
**Default**: `{{default}}`
|
||||
|
@ -20,3 +26,17 @@
|
|||
|
||||
{{description}}
|
||||
|
||||
{{#if beautifiers}}
|
||||
**Example `.jsbeautifyrc` Configuration**
|
||||
|
||||
{{example-config this}}
|
||||
|
||||
{{else}}
|
||||
**How to Configure**
|
||||
|
||||
1. You can open the [Settings View](https://github.com/atom/settings-view) by navigating to
|
||||
*Edit > Preferences (Linux)*, *Atom > Preferences (OS X)*, or *File > Preferences (Windows)*.
|
||||
2. Go into *Packages* and search for "*Atom Beautify*" package.
|
||||
3. Find the option "*{{title}}*" and change it to your desired configuration.
|
||||
|
||||
{{/if}}
|
3303
docs/options.md
3303
docs/options.md
File diff suppressed because it is too large
Load Diff
|
@ -117,6 +117,11 @@ module.exports = class Beautifiers extends EventEmitter
|
|||
# Init field for supported beautifiers
|
||||
op.beautifiers = []
|
||||
|
||||
# Remember Option's Key
|
||||
op.key = field
|
||||
|
||||
# Remember Option's Language
|
||||
op.language = lang
|
||||
|
||||
# Add option
|
||||
options[field] = op
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
module.exports = {
|
||||
analytics :
|
||||
title: 'Anonymous Analytics'
|
||||
type : 'boolean'
|
||||
default : true
|
||||
description : "There is [Segment.io](https://segment.io/) which forwards data to [Google
|
||||
|
@ -8,23 +9,28 @@ module.exports = {
|
|||
information, such as source code, is sent.
|
||||
See https://github.com/Glavin001/atom-beautify/issues/47 for more details."
|
||||
_analyticsUserId :
|
||||
title: 'Analytics User Id'
|
||||
type : 'string'
|
||||
default : ""
|
||||
description : "Unique identifier for this user for tracking usage analytics"
|
||||
_loggerLevel :
|
||||
title: "Logger Level"
|
||||
type : 'string'
|
||||
default : 'warn'
|
||||
description : 'Set the level for the logger'
|
||||
enum : ['verbose', 'debug', 'info', 'warn', 'error']
|
||||
beautifyEntireFileOnSave :
|
||||
title: "Beautify Entire File On Save"
|
||||
type : 'boolean'
|
||||
default : true
|
||||
description : "When beautifying on save, use the entire file, even if there is selected text in the editor"
|
||||
muteUnsupportedLanguageErrors :
|
||||
title: "Mute Unsupported Language Errors"
|
||||
type : 'boolean'
|
||||
default : false
|
||||
description : "Do not show \"Unsupported Language\" errors when they occur"
|
||||
muteAllErrors :
|
||||
title: "Mute All Errors"
|
||||
type : 'boolean'
|
||||
default : false
|
||||
description : "Do not show any/all errors when they occur"
|
||||
|
|
Loading…
Reference in New Issue