Add in-page links to documentation, to beautifiers, etc
This commit is contained in:
parent
cf348cb7fa
commit
7b5fbf73ce
|
@ -27,6 +27,20 @@ optionTemplate = fs.readFileSync(optionTemplatePath).toString()
|
||||||
console.log('Building documentation from template and options...')
|
console.log('Building documentation from template and options...')
|
||||||
Handlebars.registerPartial('option', optionTemplate)
|
Handlebars.registerPartial('option', optionTemplate)
|
||||||
template = Handlebars.compile(optionsTemplate)
|
template = Handlebars.compile(optionsTemplate)
|
||||||
|
|
||||||
|
linkifyTitle = (title) ->
|
||||||
|
title = title.toLowerCase()
|
||||||
|
p = title.split(/[\s,+#;,\/?:@&=+$]+/) # split into parts
|
||||||
|
sep = "-"
|
||||||
|
p.join(sep)
|
||||||
|
|
||||||
|
Handlebars.registerHelper('linkify', (title, options) ->
|
||||||
|
return new Handlebars.SafeString(
|
||||||
|
"[#{options.fn(this)}](\##{linkifyTitle(title)})"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
context = {
|
context = {
|
||||||
packageOptions: packageOptions
|
packageOptions: packageOptions
|
||||||
languageOptions: languageOptions
|
languageOptions: languageOptions
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#### {{#if title}} {{title}} {{else}} `{{@key}}` {{/if}}
|
#### {{#if title}} {{#linkify title}}{{title}}{{/linkify}} {{else}} {{#linkify @key}}`{{@key}}`{{/linkify}} {{/if}}
|
||||||
|
|
||||||
**Key**: `{{@key}}`
|
**Key**: `{{@key}}`
|
||||||
{{#if default}}
|
{{#if default}}
|
||||||
|
@ -13,9 +13,10 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if beautifiers}}
|
{{#if beautifiers}}
|
||||||
|
|
||||||
**Supported Beautifiers**: {{#each beautifiers}} `{{this}}` {{/each}}
|
**Supported Beautifiers**: {{#each beautifiers}} {{#linkify this}}`{{this}}`{{/linkify}} {{/each}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
**Description**:
|
**Description**:
|
||||||
|
|
||||||
{{description}}
|
{{description}}
|
||||||
|
|
||||||
|
|
1044
docs/options.md
1044
docs/options.md
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue