Giter Club home page Giter Club logo

Comments (1)

JoshJancula avatar JoshJancula commented on June 17, 2024 1

For everyone else waiting on this feature, here is a patch solution based on @matteopini-horsa's proposed changes

Step 1) create file patch-compodoc.js & add the code below

#!/usr/bin/env node
const fs = require('fs');

const compoMod = `${process.cwd()}/node_modules/@compodoc/compodoc`;
const updates = [
  { // filename 'index-cli-Cr-tk_1e.js' is unique to compodoc v1.1.24, this will need to be updated to reflect the correct path for whichever version you're on
    target: `${compoMod}/dist/index-cli-Cr-tk_1e.js`,
    search: `if (!language) {`,
    replace: `if (language === 'mermaid') {
      //  setting the mermaid css class will enable the diagram to be rendered
      return '<div class="mermaid">'+code+'</div>';
  }
  if (!language) {`,
  },
  {
    target: `${compoMod}/src/templates/page.hbs`,
    search: `<script src="{{relativeURL data.depth }}js/lazy-load-graphs.js"></script>`,
    replace: `<script src="{{relativeURL data.depth }}js/lazy-load-graphs.js"></script>
    <!-- loading mermaid library -->
   <script src=" 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs'"></script>`,
  },
];

for (const update of updates) {
  const data = fs.readFileSync(update.target);
  const patched = data.toString().replace(update.search, update.replace);
  fs.writeFileSync(update.target, patched);
}
console.log('successfully patched compodoc');

Step 2) update your docs script to something like below

node ./patch-compodoc.js && npx @compodoc/compodoc -p tsconfig.json -s

from compodoc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.