documentationjs / documentationjs/documentation

Output Markdown is missing some newlines, but not all

Open
#1,595 4 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

When running documentation on a project or single file, from powershell CLI or built in VSCode CLI, markdown and html formatting is messy.

**Version:** `14.0.1` & `14.0.0`

**Input code:**
```typescript
/**
* Extracts a literal value by removing double curly braces
*
* @since v0.0.1
* @category Helpers
* @param {string} val - The string to process
* @returns {string}
* @example
* getTemplateLiteral('test') //=> ''
* getTemplateLiteral('{{test}}') //=> 'test'
* getTemplateLiteral('{{{test}}}') //=> '{test}'
* getTemplateLiteral('{{}}test') //=> ''
* getTemplateLiteral('{{}}') //=> ''
*/

export const getTemplateLiteral = (val) => {
if (String(val).startsWith('{{') && String(val).endsWith('}}')){
return String(val).slice(2,-2);
}
return '';
};
```

Command from CLI: `documentation build src/helpers/getTemplateLiteral.ts -f md -o README.md`

**Output README.md:**
````markdown
### Table of Contents* [getTemplateLiteral][1]
* [Parameters][2]
* [Examples][3]## getTemplateLiteralExtracts a literal value by removing double curly braces### Parameters* `val` **[string][4]** The string to process### Examples```javascript
getTemplateLiteral('test') //=> ''
getTemplateLiteral('{{test}}') //=> 'test'
getTemplateLiteral('{{{test}}}') //=> '{test}'
getTemplateLiteral('{{}}test') //=> ''
getTemplateLiteral('{{}}') //=> ''
```Returns **[string][4]** **Meta*** **since**: v0.0.1[1]: #gettemplateliteral[2]: #parameters[3]: #examples[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
````

Not sure if I've made a mistake here, but the output seems to be formatted very strangely, is this a bug?

Raw files attached to check line endings
[README.md](https://github.com/documentationjs/documentation/files/11242095/README.md)
[getTemplateLiteral.txt](https://github.com/documentationjs/documentation/files/11242096/getTemplateLiteral.txt)

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.