metarhia / metadoc

Metarhia Documentation Generator
https://metarhia.com
MIT License
10 stars 0 forks source link

Ignored title of a function #69

Open lundibundi opened 5 years ago

lundibundi commented 5 years ago

If I add const functionLongTitle = () => {}; to the example.js with some description its doc-comment is ignored.

───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
modified: test/example.js
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
@ test/example.js:281 @ PrototypeClass.prototype.method1 = function(num) {};
 //   arr <Array>
 PrototypeClass.method2 = function(num) {};

+// Description of a function with a very long title that cannot fit in one line
+// and spans multiple lines.
+const functionLongTitle = () => {};

 // List of supported standard types:
 //   `boolean`,
 //   `null`,
@ test/example.js:398 @ module.exports = {

   nullObject: null,
   nullObjectCreate: Object.create(null),
+  functionLongTitle,
 };
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
modified: test/example.md
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
@ test/example.md:280 @ method1 description

 - `<ExampleClass>`

+## functionLongTitle()

 [meta doc]: https://github.com/metarhia/metadoc
 [introspect()]: https://github.com/metarhia/metadoc#introspectnamespace-text
 [object]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object

I assume this is due to the searching for function implementation in the source file and hitting other such function defined above (const noDescriptionFunction = () => {};).

Though I'm not sure if we want to handle this case right now.

/cc @SemenchenkoVitaliy

SemenchenkoVitaliy commented 5 years ago

Yes, this is because @metarhia/doc searches for a function code and if two functions have the same code, docs for both of them will be the same as docs for the first one.