Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output Markdown is missing some newlines, but not all #1595

Open
dataclear opened this issue Apr 16, 2023 · 4 comments
Open

Output Markdown is missing some newlines, but not all #1595

dataclear opened this issue Apr 16, 2023 · 4 comments

Comments

@dataclear
Copy link

dataclear commented Apr 16, 2023

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:

/**
 * 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:

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->### 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
getTemplateLiteral.txt

@ingun37
Copy link

ingun37 commented May 19, 2023

Did you find solution to this?

@dataclear
Copy link
Author

Did you find solution to this?

No, I ended up using a different documentation compiler.

@ingun37
Copy link

ingun37 commented May 19, 2023

FYI, I fixed by downgrading to 13.

@baydoun0
Copy link

baydoun0 commented May 23, 2024

I can reproduce this as well in 14.0.3. Pretty annoying, and not worth the deep dive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants