Tampa
Tampa

Reputation: 78254

Python flask and how to show code in a web page

My web framework is Flask.

I would like to create a section of a page that will show java script and html code fragments. I dont know the lingo for doing this. Are there any python flask plugins for this? ANy other type of js libaries? Again, I need js and html code snippets.

Thanks

Upvotes: 1

Views: 2020

Answers (2)

Jay
Jay

Reputation: 19857

Take a look at Prettify - Stackoverflow uses this to format code. It will format code on your page and make it look as it does here on this site.

You just include the JavaScript and CSS on your page.

<link rel="stylesheet" type="text/css"  href="css/colorschemes/prettify.css" />
<script type="text/javascript" src="js/prettify/prettify.js"></script>

See the setup instructions here

Upvotes: 4

Roland Smith
Roland Smith

Reputation: 43495

Have a look at pygments. It can handle a large number of formats.

Upvotes: 3

Related Questions