documentationjs / documentationjs/documentation

Config arguments for documentation.formats.md

Open
#1,006 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
5.8k
Forks
481
PR merge metrics
No merged PRs in 30d

Description

Running version 5.3.5, using this libs with Node.js API

The documentation on Node.js API says that `documentation.formats.md` accepts an optional second argument (args)

https://github.com/documentationjs/documentation/blob/7d74060caf3221dee8594845b8431dea4c2abf7a/docs/NODE_API.md#L127-L136

However, it isn't said what kind of options can be passed. It seems that the config options passed when using CLI affect both `build` and `formats` tasks. So I found out that using

```js
documentation.build('file.js',{
hljs: {
highlightAuto: true,
languages: ['js', 'json', 'sql', 'sh', 'bash']
}
}).then((res)=> {
return documentation.formats.md(res);
});
```
has no effect, (every example is highlighted as `javascript`) whereas

```js
documentation.build('file.js')
.then((res)=> {
return documentation.formats.md(res, {
hljs: {
highlightAuto: true,
languages: ['js', 'json', 'sql', 'sh', 'bash']
}
});
});
```

does indeed produce the right language highlighting.

Perhaps it should be added to documentation the usage of `hljs` and `paths` to `documentation.formats.md`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.