Skip to content

Commit 44cbe00

Browse files
committed
fix: apidocs table links
fixes: loopbackio/loopback-next#11649 Signed-off-by: Rifa Achrinza <25147899+achrinza@users.noreply.github.com>
1 parent dc08f34 commit 44cbe00

3 files changed

Lines changed: 74 additions & 0 deletions

File tree

package-lock.json

Lines changed: 56 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"@loopback/docs": "latest",
2727
"chalk": "^5.6.2",
2828
"fs-extra": "^11.3.6",
29+
"glob": "^13.0.6",
2930
"markdownlint-cli": "^0.49.0",
3031
"retry": "^0.13.1",
3132
"swagger-ui-dist": "^5.32.8",

update-lb4-docs.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const fs = require('fs-extra');
77
const path = require('path');
88
const yaml = require('js-yaml');
99
const assert = require('assert');
10+
const {glob} = require('glob');
1011

1112
const srcDocs = path.resolve(__dirname,'node_modules/@loopback/docs/site');
1213
const destDocs = path.resolve(__dirname, 'pages/en/lb4');
@@ -83,6 +84,22 @@ function copyFile(input) {
8384
// Most of the connector doc files are in the lb3 dir, copy them for lb4
8485
copyFile(connectorsReference);
8586

87+
const fixApidocs = async () => {
88+
const apidocsFiles = await glob(path.resolve(destDocs, 'apidocs/**/*.md'));
89+
for (apidocsFile of apidocsFiles) {
90+
try {
91+
let contents = fs.readFileSync(apidocsFile, 'utf-8');
92+
contents = contents.replaceAll('<td>', '<td markdown="1">');
93+
fs.writeFileSync(apidocsFile, contents, 'utf-8');
94+
} catch (err) {
95+
console.error('failed to update apidocs index %s', err.stack);
96+
process.exit(1);
97+
}
98+
}
99+
}
100+
101+
fixApidocs();
102+
86103
const fileToUpdate = path.resolve(destDocs, 'Testing-the-API.md');
87104

88105
// bug in `jekyll-relative-links` plugin; probably safe to remove when

0 commit comments

Comments
 (0)