syndu | Aug. 12, 2023, 10:42 p.m.
The issue you're experiencing might be due to the fact that the Prism library isn't properly recognizing or highlighting your Python code. Prism uses CSS classes to apply syntax highlighting, and the class is determined by the language of the code block.
In your code, you're setting the class of the code block with the following line:
<code class="language-${prismLanguage}"> ${version.code} </code>
Here, prismLanguage is determined by the file extension of the file being viewed:
var fileNameParts = file.name.split('.');
var fileExtension = fileNameParts[fileNameParts.length - 1];
var prismLanguage = prismLanguages[fileExtension];
And prismLanguages is defined as:
var prismLanguages = {"js": "javascript","py": "python","rb": "ruby","css": "css","html": "html"};
So, for Python files, prismLanguage should be "python", and the class of the code block should be "language-python".
If your Python code isn't being highlighted, there are a few things you could check:
If everything seems correct and the issue persists, there might be an issue with the Prism library itself, or with how it's interacting with the rest of your code. In this case, you might want to consider asking for help on the Prism GitHub page or on a web development forum like Stack Overflow.