I have embedded JavaScript for p5js and Table of Contents using jQuery in my Jekyll site.
Jekyll renders 2 different elements - 1 element is non-functional and the other element works perfectly fine.
Here are the links and the pictures for checking the output:
Pictures:
Here is the source code: