Add documentation anchor support

This commit is contained in:
Juan Cruz Viotti 2015-04-16 10:42:09 -04:00
parent 26f50e7a74
commit 9c65d11e66
3 changed files with 76 additions and 45 deletions

View File

@ -16,92 +16,93 @@ Now you have access to all the commands referenced below.
- Application - Application
- app create <name> - [app create &#60;name&#62;](#/pages/using/cli.md#app-create-60-name-62-)
- apps - [apps](#/pages/using/cli.md#apps)
- app <name> - [app &#60;name&#62;](#/pages/using/cli.md#app-60-name-62-)
- app restart <name> - [app restart &#60;name&#62;](#/pages/using/cli.md#app-restart-60-name-62-)
- app rm <name> - [app rm &#60;name&#62;](#/pages/using/cli.md#app-rm-60-name-62-)
- app associate <name> - [app associate &#60;name&#62;](#/pages/using/cli.md#app-associate-60-name-62-)
- init - [init](#/pages/using/cli.md#init)
- Authentication - Authentication
- whoami - [whoami](#/pages/using/cli.md#whoami)
- login [token] - [login [token]](#/pages/using/cli.md#login-token-)
- logout - [logout](#/pages/using/cli.md#logout)
- signup - [signup](#/pages/using/cli.md#signup)
- Device - Device
- devices - [devices](#/pages/using/cli.md#devices)
- device <name> - [device &#60;name&#62;](#/pages/using/cli.md#device-60-name-62-)
- device rm <name> - [device rm &#60;name&#62;](#/pages/using/cli.md#device-rm-60-name-62-)
- device identify <uuid> - [device identify &#60;uuid&#62;](#/pages/using/cli.md#device-identify-60-uuid-62-)
- device rename <name> [newName] - [device rename &#60;name&#62; [newName]](#/pages/using/cli.md#device-rename-60-name-62-newname-)
- devices supported - [devices supported](#/pages/using/cli.md#devices-supported)
- device init [device] - [device init [device]](#/pages/using/cli.md#device-init-device-)
- Drive - Drive
- drives - [drives](#/pages/using/cli.md#drives)
- Environment Variables - Environment Variables
- envs - [envs](#/pages/using/cli.md#envs)
- env rm <id> - [env rm &#60;id&#62;](#/pages/using/cli.md#env-rm-60-id-62-)
- env add <key> [value] - [env add &#60;key&#62; [value]](#/pages/using/cli.md#env-add-60-key-62-value-)
- env rename <id> <value> - [env rename &#60;id&#62; &#60;value&#62;](#/pages/using/cli.md#env-rename-60-id-62-60-value-62-)
- Examples - Examples
- examples - [examples](#/pages/using/cli.md#examples)
- example <id> - [example &#60;id&#62;](#/pages/using/cli.md#example-60-id-62-)
- example clone <id> - [example clone &#60;id&#62;](#/pages/using/cli.md#example-clone-60-id-62-)
- Help - Help
- help [command...] - [help [command...]](#/pages/using/cli.md#help-command-)
- Information - Information
- version - [version](#/pages/using/cli.md#version)
- Keys - Keys
- keys - [keys](#/pages/using/cli.md#keys)
- key <id> - [key &#60;id&#62;](#/pages/using/cli.md#key-60-id-62-)
- key rm <id> - [key rm &#60;id&#62;](#/pages/using/cli.md#key-rm-60-id-62-)
- key add <name> [path] - [key add &#60;name&#62; [path]](#/pages/using/cli.md#key-add-60-name-62-path-)
- Logs - Logs
- logs <uuid> - [logs &#60;uuid&#62;](#/pages/using/cli.md#logs-60-uuid-62-)
- Notes - Notes
- note <|note> - [note &#60;|note&#62;](#/pages/using/cli.md#note-60-note-62-)
- OS - OS
- os download <id> - [os download &#60;id&#62;](#/pages/using/cli.md#os-download-60-id-62-)
- os install <image> [device] - [os install &#60;image&#62; [device]](#/pages/using/cli.md#os-install-60-image-62-device-)
- Plugin - Plugin
- plugins - [plugins](#/pages/using/cli.md#plugins)
- plugin install <name> - [plugin install &#60;name&#62;](#/pages/using/cli.md#plugin-install-60-name-62-)
- plugin update <name> - [plugin update &#60;name&#62;](#/pages/using/cli.md#plugin-update-60-name-62-)
- plugin rm <name> - [plugin rm &#60;name&#62;](#/pages/using/cli.md#plugin-rm-60-name-62-)
- Preferences - Preferences
- preferences - [preferences](#/pages/using/cli.md#preferences)
- Update - Update
- update - [update](#/pages/using/cli.md#update)
# Application # Application
## app create &#60;name&#62; ## app create &#60;name&#62;
Use this command to create a new resin.io application. Use this command to create a new resin.io application.
@ -195,6 +196,7 @@ Examples:
$ resin init --project my/app/directory $ resin init --project my/app/directory
# Authentication # Authentication
## whoami ## whoami
Use this command to find out the current logged in username. Use this command to find out the current logged in username.
@ -257,6 +259,7 @@ user name
user password user password
# Device # Device
## devices ## devices
Use this command to list all devices that belong to a certain application. Use this command to list all devices that belong to a certain application.
@ -378,6 +381,7 @@ wifi ssid, if network is wifi
wifi key, if network is wifi wifi key, if network is wifi
# Drive # Drive
## drives ## drives
Use this command to list all drives that are connected to your machine. Use this command to list all drives that are connected to your machine.
@ -387,6 +391,7 @@ Examples:
$ resin drives $ resin drives
# Environment Variables # Environment Variables
## envs ## envs
Use this command to list all environment variables for a particular application. Use this command to list all environment variables for a particular application.
@ -463,6 +468,7 @@ Examples:
$ resin env rename 376 emacs $ resin env rename 376 emacs
# Examples # Examples
## examples ## examples
Use this command to list available example applications from resin.io Use this command to list available example applications from resin.io
@ -491,6 +497,7 @@ Example:
$ resin example clone 3 $ resin example clone 3
# Help # Help
## help [command...] ## help [command...]
Get detailed help for an specific command. Get detailed help for an specific command.
@ -501,11 +508,13 @@ Examples:
$ resin help os download $ resin help os download
# Information # Information
## version ## version
Display the Resin CLI version. Display the Resin CLI version.
# Keys # Keys
## keys ## keys
Use this command to list all your SSH keys. Use this command to list all your SSH keys.
@ -553,6 +562,7 @@ Examples:
$ cat ~/.ssh/id_rsa.pub | resin key add Main $ cat ~/.ssh/id_rsa.pub | resin key add Main
# Logs # Logs
## logs &#60;uuid&#62; ## logs &#60;uuid&#62;
Use this command to show logs for a specific device. Use this command to show logs for a specific device.
@ -586,6 +596,7 @@ number of lines to display
continuously stream output continuously stream output
# Notes # Notes
## note &#60;|note&#62; ## note &#60;|note&#62;
Use this command to set or update a device note. Use this command to set or update a device note.
@ -606,6 +617,7 @@ Examples:
device name device name
# OS # OS
## os download &#60;id&#62; ## os download &#60;id&#62;
Use this command to download the device OS configured to a specific network. Use this command to download the device OS configured to a specific network.
@ -682,6 +694,7 @@ Examples:
confirm non interactively confirm non interactively
# Plugin # Plugin
## plugins ## plugins
Use this command to list all the installed resin plugins. Use this command to list all the installed resin plugins.
@ -729,6 +742,7 @@ Examples:
confirm non interactively confirm non interactively
# Preferences # Preferences
## preferences ## preferences
Use this command to open the preferences form. Use this command to open the preferences form.
@ -741,6 +755,7 @@ Examples:
$ resin preferences $ resin preferences
# Update # Update
## update ## update
Use this command to update the Resin CLI Use this command to update the Resin CLI

View File

@ -23,7 +23,23 @@ for commandCategory in capitanodoc.categories
result.toc = _.cloneDeep(result.categories) result.toc = _.cloneDeep(result.categories)
result.toc = _.map result.toc, (category) -> result.toc = _.map result.toc, (category) ->
category.commands = _.map category.commands, (command) -> category.commands = _.map category.commands, (command) ->
return command.signature return {
signature: command.signature
# TODO: Make anchor prefix a configurable setting
# in capitanodoc.json
anchor: '#/pages/using/cli.md#' + command.signature
.replace(/\s/g,'-')
.replace(/</g, '60-')
.replace(/>/g, '-62-')
.replace(/\[/g, '')
.replace(/\]/g, '-')
.replace(/--/g, '-')
.replace(/\.\.\./g, '')
.replace(/\|/g, '')
.toLowerCase()
}
return category return category
console.log(markdown.display(result)) console.log(markdown.display(result))

View File

@ -25,7 +25,7 @@ exports.command = (command) ->
exports.category = (category) -> exports.category = (category) ->
result = """ result = """
# #{category.title} # #{category.title}\n
""" """
for command in category.commands for command in category.commands
@ -46,7 +46,7 @@ exports.toc = (toc) ->
for command in category.commands for command in category.commands
result += """ result += """
\t- #{command}\n \t- [#{ent.encode(command.signature)}](#{command.anchor})\n
""" """
return result return result