https://github.com/documentationjs/documentation-theme-utils
https://github.com/documentationjs/documentation-theme-utils
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/documentationjs/documentation-theme-utils
- Owner: documentationjs
- Created: 2015-12-07T21:18:08.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2018-11-15T14:32:30.000Z (over 7 years ago)
- Last Synced: 2025-01-05T10:30:04.230Z (about 1 year ago)
- Language: JavaScript
- Size: 34.2 KB
- Stars: 1
- Watchers: 4
- Forks: 3
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# documentation-theme-utils
[](https://greenkeeper.io/)
[](https://circleci.com/gh/documentationjs/documentation-theme-utils/tree/master)
[](https://coveralls.io/github/documentationjs/documentation-theme-utils?branch=master)
Utilities that help in the process of building theme modules
for documentation.js.
## API
### link
Helper used to automatically link items to global JS documentation or to internal
documentation.
**Parameters**
- `text` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** text to potentially link
- `getHref` **\[[function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)]** a function that tries
to find a URL to point a named link to
- `description`
**Examples**
```javascript
link('string').url // => 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String'
```
Returns **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** [mdast](https://www.npmjs.com/package/mdast) node
### formatType
Helper used to format JSDoc-style type definitions into HTML or Markdown.
**Parameters**
- `node` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** type object in doctrine style
- `getHref` **[function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** a function that tries
to find a URL to point a named link to
**Examples**
```javascript
formatType({ type: 'NameExpression', name: 'String' })[0].url // => 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String'
```
Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)>** array of [mdast](https://www.npmjs.com/package/mdast) syntax trees