e-Learning-by-SSE / nm-self-learning

https://staging.sse.uni-hildesheim.de/selflearn
3 stars 4 forks source link

LiaScript: Build & Upload Proxy Library #92

Closed Elscha closed 9 months ago

Elscha commented 9 months ago

@AlexanWeb built a proxy library to include LiaScript/markdownify without dependencies to Parcel. Open action are:

spark-sse commented 9 months ago

Nice!

I think some question needs to be answered for this.

I suggest a small meeting to discuss the way of the selflearn integration.

Process update: scheduling of a meeting startet to address these questions

Elscha commented 9 months ago

The proxy library can be obtained from https://github.com/orgs/e-Learning-by-SSE/packages/npm/package/nm-liascript-exporter-lib

and used as follows:

import libLiaScr from "@e-learning-by-sse/nm-liascript-exporter-lib/dist/index.js";

function readJsonFile(filePath: string): any {
  try {
    const liaJson = fs.readFileSync(filePath, "utf8");
    return JSON.parse(liaJson);
  } catch (e) {
    console.warn("Error reading file: " + filePath);
    console.warn(e);
    return null;
  }
}

const dataObject = readJsonFile("./src/Minimal.json");

libLiaScr(dataObject)
  .then((doc: string) => {
    console.log("ok", doc);
    fs.writeFileSync("example.md", doc);
  })
  .catch((err: string) => {
    console.warn("err", err);
  });

Further parts for improvement (but without a fast solution, yet):