Skip to content

Commit dcb94e7

Browse files
committed
Use eol.lf with jsdoc-to-markdown
Make sure the output of jsdoc-to-markdown always produces Unix line endings (LF and not CRLF or CR).
1 parent daaaff2 commit dcb94e7

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

docs/createDocs.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
/* eslint-disable no-use-before-define */
2+
3+
// This file is used only for development, so we disable the following check.
4+
/* eslint import/no-extraneous-dependencies: ["error", {"devDependencies": true}] */
5+
26
// https://auth0.com/docs/api/management/v2#!/Clients/post_clients
37
// https://terminusdb.eu.auth0.com/api/v2/
48

5-
// eslint-disable-next-line import/no-extraneous-dependencies
69
const jsdoc2md = require('jsdoc-to-markdown');
710
const fs = require('fs');
811
const path = require('path');
12+
const eol = require('eol');
13+
914
const { woqlClientMenu } = require('./navigationModel');
1015

1116
/* input and output paths */
@@ -69,7 +74,10 @@ function createFile(filePath, options, outputDir) {
6974
// const template = `{{#class name="${className}"}}{{>docs}}{{/class}}`
7075
// eslint-disable-next-line no-console
7176
console.log(`rendering ${filePath}`);
72-
const output = jsdoc2md.renderSync(options);
77+
// Use `eol.lf` to guarantee the string always has Unix (LF) line endings,
78+
// `jsdoc-to-markdown` may use different line endings depending on the OS, and
79+
// this can cause problems with rendering the Markdown.
80+
const output = eol.lf(jsdoc2md.renderSync(options));
7381
fs.writeFileSync(path.resolve(outputDir, `${fileName}.md`), setHeadings(fileName, output));
7482
}
7583
/// /([\w-]+)(.js)/

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020
"author": "[email protected]",
2121
"license": "Apache-2.0",
2222
"dependencies": {
23-
"pathval":">=1.1.1",
24-
"ajv":">=6.12.3",
25-
"follow-redirects":">=1.14.8",
23+
"ajv": ">=6.12.3",
2624
"axios": ">=0.25.0",
27-
"form-data": "^4.0.0",
2825
"babel-polyfill": "^6.26.0",
26+
"follow-redirects": ">=1.14.8",
27+
"form-data": "^4.0.0",
2928
"node-forge": ">=1.0.0",
29+
"pathval": ">=1.1.1",
3030
"underscore": ">=1.13.2"
3131
},
3232
"devDependencies": {
@@ -40,6 +40,7 @@
4040
"chai": "^4.3.4",
4141
"coveralls": "^3.1.1",
4242
"docsify-cli": "^4.4.2",
43+
"eol": "^0.9.1",
4344
"eslint": "^8.6.0",
4445
"eslint-config-airbnb-base": "^15.0.0",
4546
"eslint-config-prettier": "6.11.0",

0 commit comments

Comments
 (0)