jsdoc-sourcecode-tag
v1.0.2
Published
add @sourcecode tag
Downloads
51
Maintainers
Readme
jsdoc-sourcecode-tag
What is this?
A JSDoc plugin that adds recognition to the @sourcecode tag for using his data in your publish theme.
It can be used for demonstration part of codes in <pre> element
More info about jsdoc and publish theme:
- https://www.npmjs.com/package/jsdoc
- http://usejsdoc.org/
- http://usejsdoc.org/about-plugins.html
Installing
npm install --save jsdoc-sourcecode-tag
# or using yarn cli
yarn add jsdoc-sourcecode-tag
---
Usage
Add plugin to jsdoc conf.json http://usejsdoc.org/about-configuring-jsdoc.html
{
"plugins": ["./node_modules/jsdoc-sourcecode-tag/index"]
}
In your code
/**
* description
* @const {Function}
* @param {number} num
* @returns {boolean}
* @sourcecode
*/
const myFunction = function(num) {
// some cool code here
};
In your publish theme data you will get data.sourcecode
lineno
- where it's start in your codetype
- definition type, alias ofdata.meta.code.type
value
- string with your code, start fromconst myFun...
and to the end...};
.
tag value
+{number}
Add lines after ending of documented code
/**
* Want to show const declaration
* and same code part after that
* @const {number}
* @sourcecode +4
*/
const knockSeveralTimes = 10;
// 1
for (let i = 1; i <= knockSeveralTimes; i++) { // 2
console.log( `knock ${i}` ); // 3
} // 4
|+{number}
It remove all lines of documented code and will start count from new line after
/**
* @name nowYouSeeMyLoop
* @sourcecode |+3
*/
for (let i = 1; i <= knockSeveralTimes; i++) { // 1
console.log( `knock ${i}` ); // 2
} // 3
Tests
npm test
for testing js code style and test sorting methodnpm run fix
for automatically fix most of problems with js code style
Changelog
Please read CHANGELOG.md
To Do
write tests and more examples
Code of Conduct
Please read CODE_OF_CONDUCT.md
Contributing
Please read CONTRIBUTING.md