Is it somehow possible to show syntax-highlighted python code in a webpage?
I found this:
<pre class="brush: python">
# python code here
</pre>
However, it shows all the code in black. I want import
to be orange, strings to be green.
Is it possible to do this?
Thank you!
If you wish to only display code, python in this case, consider using Github gist .
You can then embed it using the 'embed' option on the top right corner. It will give you a script tag that you can copy and add to your webpage like so:
<script src="https://gist.github.com/username/a39a422ebdff6e732753b90573100b16.js"></script>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.