Update md script and readme
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
# How to generate markdown from language server rst-files
|
# How to generate json file from markdown files
|
||||||
|
|
||||||
Go to xrpl-hooks-docs folder
|
Go to xrpl-hooks-docs folder
|
||||||
`cd xrpl-hooks-docs`
|
`cd xrpl-hooks-docs`
|
||||||
|
|
||||||
Then run the `convert-to-md.js` script in that folder:
|
Then run the `makeJson.js` script in that folder:
|
||||||
`node convert-to-md.js`
|
`node makeJson.js`
|
||||||
|
|
||||||
If everything goes well this should output `xrpl-hooks-docs-files.json` file which contains array of the error codes and markdown related to that.
|
If everything goes well this should output `xrpl-hooks-docs-files.json` file which contains array of the error codes and markdown related to that.
|
||||||
|
|
||||||
|
|||||||
14
xrpl-hooks-docs/makeJson.js
Normal file
14
xrpl-hooks-docs/makeJson.js
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
const fs = require("fs");
|
||||||
|
|
||||||
|
// Read all md files from md folders
|
||||||
|
const files = fs.readdirSync("./md");
|
||||||
|
const mdFiles = [];
|
||||||
|
files.forEach((file) => {
|
||||||
|
const fileName = file.split(".")[0];
|
||||||
|
|
||||||
|
const md = fs.readFileSync(`./md/${fileName}.md`).toString();
|
||||||
|
|
||||||
|
mdFiles.push({ code: fileName, markdown: md });
|
||||||
|
});
|
||||||
|
|
||||||
|
fs.writeFileSync("xrpl-hooks-docs-files.json", JSON.stringify(mdFiles));
|
||||||
Reference in New Issue
Block a user