API functions
Functions#
- buildCategoryTopics(bulletList, [options]) ⇒
Array.Object Build list of topics and subcategories in a category.
- buildHeaders(bulletlist, [level]) ⇒
Array Build headers as template variables
- buildSectionCategories(bulletList, [options]) ⇒
object Build items of navigation section.
- buildTopicPage(title, [options]) ⇒
string Create topic documentation topic in Markdown.
- getDocumentParts(sourceFile)
Get document parts in specified file
- saveDocumentParts(sourceFile, program)
Create parts files for a specified topic document
- getSidebars(sourceFilename) ⇒
object Extract sidebar title and sidebar outline from a Markdown file.
- getTopicHeaders(bulletlist, Command) ⇒
Array Build topic top headers
- getUniqueName(name) ⇒
string Return a variant string
- hasHeaders(topicItem) ⇒
boolean Checks whether the topic has headers
- isSingleTopic(topicItem) ⇒
boolean Checks whether a topic has children topics
- makeid(length) ⇒
string Return a random string with digital characters of specified length
- parseTitle(topicTitle) ⇒
object Extract topic title to extract relevant information
- saveDocument(fileName, content)
Create a text file in utf-8 format from specified name and content
- slug(source) ⇒
string Convert specified string into a slug.
Converts spaces, tabs, and visible special characters into dashes (-) -- except backslash (). Compresses sequence of dashes or special characters into a single dash. Removes heading or trailing dashes or special characters from the specified string.
buildCategoryTopics(bulletList, [options]) ⇒ Array.Object#
Build list of topics and subcategories in a category.
Kind: global function
Returns: Array.Object - List of topics and categories.
| Param | Type | Default | Description |
|---|---|---|---|
| bulletList | Array | The bullet list internal representation. | |
| [options] | object | { 'parent': './', 'prefix': '' } | Options for building topic slug and folders |
buildHeaders(bulletlist, [level]) ⇒ Array#
Build headers as template variables
Kind: global function
Returns: Array - Array of objects where each object is a set of template variables
Opts: object Command line options passed as properties
| Param | Type | Default | Description |
|---|---|---|---|
| bulletlist | Array | Representation of list in Markdown abstract tree | |
| [level] | number | 2 | Heading level for Markdown notation |
buildSectionCategories(bulletList, [options]) ⇒ object#
Build items of navigation section.
Kind: global function
Returns: object - Key-value where key is category title and value is a list of items or subcategories.
| Param | Type | Default | Description |
|---|---|---|---|
| bulletList | Array | The bullet list internal representation. | |
| [options] | object | { 'parent': './' } | Options for building section slug |
buildTopicPage(title, [options]) ⇒ string#
Create topic documentation topic in Markdown.
Kind: global function
Returns: string - Topic unique slug
| Param | Type | Default | Description |
|---|---|---|---|
| title | string | Topic title | |
| [options] | object | { 'headers': [], 'parent': './', 'prefix': '' } | Options for creating topic file. |
getDocumentParts(sourceFile)#
Get document parts in specified file
Kind: global function
| Param | Type | Description |
|---|---|---|
| sourceFile | string | Path to documentation file @ @returns {Array.{targetPath: string, content: string}} Array of part object, each part has targetPath and content properties |
saveDocumentParts(sourceFile, program)#
Create parts files for a specified topic document
Kind: global function
| Param | Type | Description |
|---|---|---|
| sourceFile | string | Path to topic document |
| program | object | Options passed on command |
getSidebars(sourceFilename) ⇒ object#
Extract sidebar title and sidebar outline from a Markdown file.
Kind: global function
Returns: object - Key-value where key is the sidebar title and value is bullet list tree.
| Param | Type | Description |
|---|---|---|
| sourceFilename | string | Filename of a Markdown file with outline |
getTopicHeaders(bulletlist, Command) ⇒ Array#
Build topic top headers
Kind: global function
Returns: Array - Headers in markdown notation
| Param | Type | Description |
|---|---|---|
| bulletlist | Array | Header list represented in Markdown abstrat tree |
| Command | object | line options passed as properties |
getUniqueName(name) ⇒ string#
Return a variant string
Kind: global function
Returns: string - Original string with suffixed text
| Param | Type | Description |
|---|---|---|
| name | string | The name to check for uniqueness |
hasHeaders(topicItem) ⇒ boolean#
Checks whether the topic has headers
Kind: global function
Returns: boolean - true if topic has headers, false otherwise.
| Param | Type | Description |
|---|---|---|
| topicItem | object | Topic to test whether it has headers |
isSingleTopic(topicItem) ⇒ boolean#
Checks whether a topic has children topics
Kind: global function
Returns: boolean - true if single topic, false otherwise
| Param | Type | Description |
|---|---|---|
| topicItem | object | Topic to test whether it is single topic |
makeid(length) ⇒ string#
Return a random string with digital characters of specified length
Kind: global function
Returns: string - Randomly chosen characters of specified length
| Param | Type | Description |
|---|---|---|
| length | number | The length of string to return. |
parseTitle(topicTitle) ⇒ object#
Extract topic title to extract relevant information
Kind: global function
Returns: object - Properties extracted from title
| Param | Type | Description |
|---|---|---|
| topicTitle | object | Topic title to parse. |
saveDocument(fileName, content)#
Create a text file in utf-8 format from specified name and content
Kind: global function
| Param | Type | Description |
|---|---|---|
| fileName | string | Name of the file to create. |
| content | string | String to place in the file. |
slug(source) ⇒ string#
Convert specified string into a slug.
Converts spaces, tabs, and visible special characters into dashes (-) -- except backslash (). Compresses sequence of dashes or special characters into a single dash. Removes heading or trailing dashes or special characters from the specified string.
Kind: global function
Returns: string - Trimmed, lowercase string with dashes(-)
| Param | Type | Description |
|---|---|---|
| source | string | String to covert to slug. |