SaswatPadhi / pseudocode.js

Beautiful pseudocode for the Web
https://saswatpadhi.github.io/pseudocode.js
MIT License
224 stars 33 forks source link

Question: How do I make use of the local js and css files? #25

Closed gchhablani closed 1 year ago

gchhablani commented 3 years ago

I cloned the repository and linked the local /docs/pseudocode.js and /docs/pseudocode.css on my html page. But I am unable to make the Algorithm appear. Can someone help me with this?

Thanks, Gunjan

SaswatPadhi commented 3 years ago

Hi,

Could you tell us a bit more:

1) Do you see any errors in your browser's console?

2) Are you using KaTeX or MathJax rendering?

Thanks.

SaswatPadhi commented 3 years ago

Also, have you tried grabbing the CSS and JS files from JsDeliver instead (Step 2 in the README instructions)

gchhablani commented 3 years ago

Hi,

I am using Jekyll with GitHub pages. So, the issue is that when I used JsDeliver, the algorithm was rendering but only randomly when trying to render it locally. When I pushed the code to GitHub, nothing is rendered : https://gchhablani.github.io/papers/interpretBERTRC

{% if page.usemathjax %}
   <!--PseudoCode-->
   <!--https://github.com/SaswatPadhi/pseudocode.js-->

   <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/pseudocode@latest/build/pseudocode.min.css">
   <script src="https://cdn.jsdelivr.net/npm/pseudocode@latest/build/pseudocode.min.js">
   </script> 

    <script type="text/x-mathjax-config">
      MathJax.Hub.Config({
      tex2jax: {
      inlineMath: [ ['$','$'], ["\\(","\\)"] ],
      processEscapes: true,
      processEnvironments: true,
    },
      TeX: { equationNumbers: { autoNumber: "AMS" } }
      });
    </script>

     <script type="text/javascript" async src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"></script>

   {% endif %}

I get the following message on the console:

image

My goal is to render the algorithm perfectly on GitHub. I tried using this repository as a submodule and adding local references and that didn't work either.

gchhablani commented 3 years ago

Nevermind. I was using the wrong URL for mathjax. Now I switched to <script src='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS_CHTML'> and it shows no error.

Can you explain why this happened?

SaswatPadhi commented 1 year ago

Hi, sorry that I noticed this super late! Looks like you have fixed your issue :+1: This might have something to do with the CDN issue (cdnjs vs jsdelivr).

I am closing this issue for now, but please feel free to reopen if you run into this again.